diff --git a/x86_64/1_stdio.asm b/x86_64/1_stdio.asm index 211c669..3eb7dfb 100644 --- a/x86_64/1_stdio.asm +++ b/x86_64/1_stdio.asm @@ -20,6 +20,7 @@ section .bss section .text _start: ; x64 has the syscall function, in contrast to int in x86 and ARM + ; See /usr/include/asm/unistd_64.h for the numbers ; Write to stdout mov rax, 1 @@ -44,7 +45,6 @@ _start: mov rsi, strBuffer syscall - ; Exit routine mov rax, 60 ; 60 is the exit routine xor rdi, rdi ; our return code (0) diff --git a/x86_64/README.md b/x86_64/README.md index e5e2683..7f28aa7 100644 --- a/x86_64/README.md +++ b/x86_64/README.md @@ -14,4 +14,6 @@ ld -o # Default gcc -o # When using C library functions ``` -Based upon the work of [Carmo M de F Barbosa](https://gitlab.com/mcmfb/intro_x86-64) \ No newline at end of file +Based upon the work of [Carmo M de F Barbosa](https://gitlab.com/mcmfb/intro_x86-64) + +The Linux system call table and useful links can be found [here](http://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/). \ No newline at end of file diff --git a/x86_64/debug.sh b/x86_64/debug.sh index 6f7176f..9bc454a 100644 --- a/x86_64/debug.sh +++ b/x86_64/debug.sh @@ -10,13 +10,5 @@ if [ ! -x "$1" ]; then exit 1 fi -echo "I will launch gdbtui soon. Use \"break *\" to debug the program." -echo "Use \"layout asm\" to use a more assembly friendly layout" -echo "Use \"si\" to single step each instruction" -echo "" - -echo "$(readelf -h $1 | egrep "Entry point")" -read -p "Copy the above address and press any key to continue..." - -gdbtui -q $1 - +breakPoint="$(readelf -h $1 | egrep -i "entry" | egrep -o "0x[a-f0-9]+")" +gdbtui -q -ex "layout asm" -ex "break *$breakPoint" $1