Update 2024-07-27-sys-write-string.md

This commit is contained in:
0x3bb 2024-07-27 20:04:06 +00:00
parent ad208d8f2e
commit 1286e82c7b

View File

@ -8,7 +8,7 @@ I'm reading a book on x86-64 NASM.
One of the exercises involves printing a string to stdout by leveraging a Linux syscall called `sys_write`, but doesn't mention the reasoning behind the `mov` instructions into the registers or how they're used once you make the syscall. One of the exercises involves printing a string to stdout by leveraging a Linux syscall called `sys_write`, but doesn't mention the reasoning behind the `mov` instructions into the registers or how they're used once you make the syscall.
An approachable way for beginners to understand how syscalls are made in Linux is referring to the [Linux System Call Table](https://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/). It documents each parameter and which in which specific register it expects to find it. An approachable way for beginners to understand how syscalls are made in Linux is referring to the [Linux System Call Table](https://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/). It documents each parameter and in which specific register it expects to find it.
Looking at that table, it can be concluded the following registers need to be populated: Looking at that table, it can be concluded the following registers need to be populated: