-
Notifications
You must be signed in to change notification settings - Fork 21
/
shim_masm.asm
55 lines (47 loc) · 931 Bytes
/
shim_masm.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
ifdef rax
mangle macro name
exitm <name>
endm
extern mangle(shim_prepared):dword
.code
shim_prepare2:
cmp mangle(shim_prepared), 0
jz _continue
ret
_continue:
push r9
push r8
push rdx
push rcx
call mangle(shim_prepare)
pop rcx
pop rdx
pop r8
pop r9
ret
PREPARE_NAME textequ <shim_prepare2>
.code
else
.386
.model flat
mangle macro name
exitm @catstr(<_>, <name>)
endm
PREPARE_NAME textequ <shim_prepare>
_TEXT$ SEGMENT PARA PUBLIC 'CODE'
endif
declare macro name
local ptrname, funcname
ptrname equ mangle(@catstr(<p>, name))
extern ptrname:ptr
funcname equ mangle(@catstr(<Shim>, name))
align 16
public funcname
funcname:
call mangle(%PREPARE_NAME)
jmp [ptrname]
endm
extern mangle(shim_prepared):dword
mangle(shim_prepare) proto
include shim_declare.inc
end