1 ; 7zAsm.asm -- ASM macros
\r
2 ; 2022-05-16 : Igor Pavlov : Public domain
\r
5 ; UASM can require these changes
\r
6 ; OPTION FRAMEPRESERVEFLAGS:ON
\r
7 ; OPTION PROLOGUE:NONE
\r
8 ; OPTION EPILOGUE:NONE
\r
11 ; @wordsize is defined only in JWASM and ASMC and is not defined in MASM
\r
12 ; @wordsize eq 8 for 64-bit x64
\r
13 ; @wordsize eq 2 for 32-bit x86
\r
37 ; Use ABI_CDECL for x86 (32-bit) only
\r
38 ; if ABI_CDECL is not defined, we use fastcall abi
\r
46 OPTION PROLOGUE:NONE
\r
47 OPTION EPILOGUE:NONE
\r
55 _TEXT$00 SEGMENT PARA PUBLIC 'CODE'
\r
59 MY_PROC macro name:req, numParams:req
\r
61 proc_numParams = numParams
\r
64 elseif (IS_LINUX gt 0)
\r
66 elseif (IS_CDECL gt 0)
\r
67 proc_name equ @CatStr(_,name)
\r
69 proc_name equ @CatStr(@,name,@, %numParams * 4)
\r
77 elseif (IS_CDECL gt 0)
\r
79 elseif (proc_numParams LT 3)
\r
82 ret (proc_numParams - 2) * 4
\r
90 REG_LOGAR_SIZE equ 3
\r
93 REG_LOGAR_SIZE equ 2
\r
160 MY_PUSH_2_REGS macro
\r
165 MY_POP_2_REGS macro
\r
174 MY_PUSH_4_REGS macro
\r
181 MY_POP_4_REGS macro
\r
189 ; for fastcall and for WIN-x64
\r
190 REG_PARAM_0_x equ x1
\r
192 REG_PARAM_1_x equ x2
\r
198 REG_ABI_PARAM_0_x equ REG_PARAM_0_x
\r
199 REG_ABI_PARAM_0 equ REG_PARAM_0
\r
200 REG_ABI_PARAM_1_x equ REG_PARAM_1_x
\r
201 REG_ABI_PARAM_1 equ REG_PARAM_1
\r
209 REG_PARAM_2_x equ x8
\r
213 REG_ABI_PARAM_0_x equ REG_PARAM_0_x
\r
214 REG_ABI_PARAM_0 equ REG_PARAM_0
\r
215 REG_ABI_PARAM_1_x equ REG_PARAM_1_x
\r
216 REG_ABI_PARAM_1 equ REG_PARAM_1
\r
217 REG_ABI_PARAM_2_x equ REG_PARAM_2_x
\r
218 REG_ABI_PARAM_2 equ REG_PARAM_2
\r
219 REG_ABI_PARAM_3 equ REG_PARAM_3
\r
223 REG_LINUX_PARAM_0_x equ x7
\r
224 REG_LINUX_PARAM_0 equ r7
\r
225 REG_LINUX_PARAM_1_x equ x6
\r
226 REG_LINUX_PARAM_1 equ r6
\r
227 REG_LINUX_PARAM_2 equ r2
\r
228 REG_LINUX_PARAM_3 equ r1
\r
229 REG_LINUX_PARAM_4_x equ x8
\r
230 REG_LINUX_PARAM_4 equ r8
\r
231 REG_LINUX_PARAM_5 equ r9
\r
233 REG_ABI_PARAM_0_x equ REG_LINUX_PARAM_0_x
\r
234 REG_ABI_PARAM_0 equ REG_LINUX_PARAM_0
\r
235 REG_ABI_PARAM_1_x equ REG_LINUX_PARAM_1_x
\r
236 REG_ABI_PARAM_1 equ REG_LINUX_PARAM_1
\r
237 REG_ABI_PARAM_2 equ REG_LINUX_PARAM_2
\r
238 REG_ABI_PARAM_3 equ REG_LINUX_PARAM_3
\r
239 REG_ABI_PARAM_4_x equ REG_LINUX_PARAM_4_x
\r
240 REG_ABI_PARAM_4 equ REG_LINUX_PARAM_4
\r
241 REG_ABI_PARAM_5 equ REG_LINUX_PARAM_5
\r
243 MY_ABI_LINUX_TO_WIN_2 macro
\r
248 MY_ABI_LINUX_TO_WIN_3 macro
\r
254 MY_ABI_LINUX_TO_WIN_4 macro
\r
264 MY_PUSH_PRESERVED_ABI_REGS macro
\r
277 MY_POP_PRESERVED_ABI_REGS macro
\r