-
Notifications
You must be signed in to change notification settings - Fork 0
jhswartz/mle-x86
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
MACHINE LANGUAGE ENCODER / x86 Relative offset support for x86. INSTALLATION # mkdir -p /usr/share/mle # cp -a x86 /usr/share/mle/ USAGE The following program illustrates the use of the 8-bit and 32-bit relative-offset calculators provided by the x86 plug-in. $ cat demo/echo.src [ . x86 ] Magic: 90 Start: # Quit if argc is less than or equal to 1. 59 # pop rcx 48 83 f9 01 # cmp 1 rcx 7e [ rel8 Quit ] # jle Quit # Skip argv[0]. 5e # pop rsi Echo: # Quit if the next argument is NULL. 5e # pop rsi 48 85 f6 # test rsi rsi 7e [ rel8 Quit ] # jz Quit # Otherwise, print it. e8 [ rel32 PrintString ] # call PrintString # Print the separator. 6a 01 5a # mov 1 rdx 48 8d 35 [ rel32 Separator ] # lear Separator rsi e8 [ rel32 Print ] # call Print # Continue. eb [ rel8 Echo ] # jmp Echo PrintString: # Get the length of the string. 48 89 f7 # mov rsi rdi 48 31 c0 # xor rax rax 48 31 c9 # xor rcx rcx 48 ff c9 # dec rcx f2 ae # repnz scasb 48 89 ca # mov rdx, rcx 48 f7 d2 # not rdx 48 ff ca # dec rdx Print: # write(STDOUT_FILENO, buffer, length) 6a 01 5f # mov STDOUT_FILENO rdi 6a 01 58 # mov SYS_WRITE rax 0f 05 # syscall c3 # ret Quit: # Print the terminator. 6a 01 5a # mov 1 rdx 48 8d 35 [ rel32 Terminator ] # lear Terminator rsi e8 [ rel32 Print ] # call Print # Exit. 6a 00 5f # mov EXIT_SUCCESS rdi 6a 3c 58 # mov SYS_EXIT rax 0f 05 # syscall Separator: 20 Terminator: 0a $ mle < demo/echo.src > demo/echo $ chmod 755 demo/echo $ ls -al demo/echo -rwxr-xr-x 1 user input 94 Oct 15 12:30 demo/echo $ demo/echo take it or leave it take it or leave it SEE ALSO https://github.com/jhswartz/mle https://github.com/jhswartz/mli AUTHOR Justin Swartz <justin.swartz@risingedge.co.za>
About
Relative offset support for x86
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published