Skip to content

Commit 8a88e1c

Browse files
committed
new syscall macros
1 parent 3faa47e commit 8a88e1c

1 file changed

Lines changed: 29 additions & 4 deletions

File tree

include/syscall.s

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
;; define the SYSTEM_CALL macro
2-
3-
1+
;;; Define the SYSTEM_CALL macro
2+
;;; YOU MUST USE A %DEFINE IF YOU USE THIS MACRO
3+
;;; Will emit a hlt instruction if no %define is present
4+
45
%macro SYSTEM_CALL 0
56
%ifdef INT80
67
int 0x80
@@ -11,6 +12,30 @@
1112
%elifdef CALLGATE32
1213
call [gs:eiz+0x10]
1314
%else
14-
hlt ;YOU MUST USE A %DEFINE IF YOU USE THIS MACRO
15+
hlt
16+
%endif
17+
%endmacro
18+
19+
%macro SYSTEM_CALL 1
20+
21+
%ifdef INT80
22+
xor eax,eax;used most frequently with 32bit shellcode
23+
mov al, %1
24+
SYSTEM_CALL
25+
26+
%elifdef SYSENTER
27+
push byte %1
28+
pop rax ;used most frequently with 64bit shellcode
29+
SYSTEM_CALL
30+
31+
%elifdef SYSCALL
32+
int3
33+
hlt
34+
%elifdef CALLGATE32 ;32bit only
35+
xor eax,eax
36+
mov al, %1
37+
SYSTEM_CALL
38+
%else
39+
hlt
1540
%endif
1641
%endmacro

0 commit comments

Comments
 (0)