"Fossies" - the Fresh Open Source Software Archive

Member "UXP-2019.06.08/other-licenses/7zstub/src/Asm/x86/7zAsm.asm" (8 Jun 2019, 2040 Bytes) of package /linux/www/UXP-2019.06.08.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Generic Assembler source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 ; 7zAsm.asm -- ASM macros
    2 ; 2018-02-03 : Igor Pavlov : Public domain
    3 
    4 MY_ASM_START macro
    5   ifdef x64
    6     .code
    7   else
    8     .386
    9     .model flat
   10     _TEXT$00 SEGMENT PARA PUBLIC 'CODE'
   11   endif
   12 endm
   13 
   14 MY_PROC macro name:req, numParams:req
   15   align 16
   16   proc_numParams = numParams
   17   ifdef x64
   18     proc_name equ name
   19   else
   20     proc_name equ @CatStr(@,name,@, %numParams * 4)
   21   endif
   22   proc_name PROC
   23 endm
   24 
   25 MY_ENDP macro
   26   ifdef x64
   27     ret
   28   else
   29     if proc_numParams LT 3
   30       ret
   31     else
   32       ret (proc_numParams - 2) * 4
   33     endif
   34   endif
   35   proc_name ENDP
   36 endm
   37 
   38 ifdef x64
   39   REG_SIZE equ 8
   40   REG_LOGAR_SIZE equ 3
   41 else
   42   REG_SIZE equ 4
   43   REG_LOGAR_SIZE equ 2
   44 endif
   45 
   46   x0 equ EAX
   47   x1 equ ECX
   48   x2 equ EDX
   49   x3 equ EBX
   50   x4 equ ESP
   51   x5 equ EBP
   52   x6 equ ESI
   53   x7 equ EDI
   54 
   55   x0_W equ AX
   56   x1_W equ CX
   57   x2_W equ DX
   58   x3_W equ BX
   59 
   60   x5_W equ BP
   61   x6_W equ SI
   62   x7_W equ DI
   63 
   64   x0_L equ AL
   65   x1_L equ CL
   66   x2_L equ DL
   67   x3_L equ BL
   68 
   69   x0_H equ AH
   70   x1_H equ CH
   71   x2_H equ DH
   72   x3_H equ BH
   73 
   74 ifdef x64
   75   x5_L equ BPL
   76   x6_L equ SIL
   77   x7_L equ DIL
   78 
   79   r0 equ RAX
   80   r1 equ RCX
   81   r2 equ RDX
   82   r3 equ RBX
   83   r4 equ RSP
   84   r5 equ RBP
   85   r6 equ RSI
   86   r7 equ RDI
   87   x8 equ r8d
   88   x9 equ r9d
   89   x10 equ r10d
   90   x11 equ r11d
   91   x12 equ r12d
   92   x13 equ r13d
   93   x14 equ r14d
   94   x15 equ r15d
   95 else
   96   r0 equ x0
   97   r1 equ x1
   98   r2 equ x2
   99   r3 equ x3
  100   r4 equ x4
  101   r5 equ x5
  102   r6 equ x6
  103   r7 equ x7
  104 endif
  105 
  106 MY_PUSH_4_REGS macro
  107     push    r3
  108     push    r5
  109     push    r6
  110     push    r7
  111 endm
  112 
  113 MY_POP_4_REGS macro
  114     pop     r7
  115     pop     r6
  116     pop     r5
  117     pop     r3
  118 endm
  119 
  120 
  121 ifdef x64
  122 
  123 ; for WIN64-x64 ABI:
  124 
  125 REG_PARAM_0 equ r1
  126 REG_PARAM_1 equ r2
  127 REG_PARAM_2 equ r8
  128 REG_PARAM_3 equ r9
  129 
  130 MY_PUSH_PRESERVED_REGS macro
  131     MY_PUSH_4_REGS
  132     push    r12
  133     push    r13
  134     push    r14
  135     push    r15
  136 endm
  137 
  138 
  139 MY_POP_PRESERVED_REGS macro
  140     pop     r15
  141     pop     r14
  142     pop     r13
  143     pop     r12
  144     MY_POP_4_REGS
  145 endm
  146 
  147 endif