flat assembler
Message board for the users of flat assembler.
Index
> Main > Exit program without libraries |
Author |
|
Furs 09 May 2018, 23:40
Wikipedia has some examples for Linux: https://en.wikipedia.org/wiki/Exit_%28system_call%29
There is no stable way to do it in Windows, because the system calls vary between Windows versions. That's why Microsoft want you to use their libraries (e.g. kernel32.dll) since those are stable. I guess you could just: Code: ret EDIT: Because the wiki example for 32-bit Linux is in GAS, here's translation to FASM: Code: _start: mov eax, 1 ; System call number 1: exit() mov ebx, 0 ; Exits with exit status 0 int 0x80 ; Passes control to interrupt vector ; invokes system call—in this case system call ; number 1 with argument 0 Code: format ELF64 executable 3 entry start segment readable executable start: ; STUFF ; exiting mov eax, 60 ; sys_exit syscall number: 60 xor edi, edi ; set exit status to 0 (`xor edi, edi` is equal to `mov edi, 0` ) syscall ; call it |
|||
09 May 2018, 23:40 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.