ScrapExplorer - README

Home / arch / x64 / linux / return Lines: 1 | Size: 666 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1return 2====== 3 4Returning 0 from main using basic assembly 5 6Source code structure 7--------------------- 8 9In the program we only run three instructions 10 11 12We first move the value 60 to the rax register, this will tell linux that we 13want to exit the program. 14 15 mov rax, 60 16 17We then move the value 0 to the rdi register, this is the argument that we pass 18into the exit syscall. The RDI register stores the code that's being used to exit. 19 20 mov rdi, 0 21 22We then run the syscall instruction to exit the program. 23 24 syscall 25 26The program will return 0 to the shell. We can confirm this by running the 27program and then using echo $? to see the return value. 28 29 30 ./return 31 echo $?
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.