Update 2024-07-27-sys-write-string.md
This commit is contained in:
parent
1286e82c7b
commit
e858bb74b3
@ -12,7 +12,7 @@ An approachable way for beginners to understand how syscalls are made in Linux i
|
|||||||
|
|
||||||
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:
|
||||||
|
|
||||||
- `rdi` → the call identifier. for `sys_write`, it's `1` from reading the first column of that table
|
- `rax` → the call identifier. for `sys_write`, it's `1` from reading the first column of that table
|
||||||
- `rdi` → file descriptor, `1` being for `stdout`
|
- `rdi` → file descriptor, `1` being for `stdout`
|
||||||
- `rsi` → contents of buffer (i.e. the string)
|
- `rsi` → contents of buffer (i.e. the string)
|
||||||
- `rdx` → length of the buffer for stdout
|
- `rdx` → length of the buffer for stdout
|
||||||
@ -23,7 +23,7 @@ The first step is to define the `.data` section and initialize memory for `rsi`.
|
|||||||
The syntax looks like this:
|
The syntax looks like this:
|
||||||
<variable name> <type> <value>
|
<variable name> <type> <value>
|
||||||
|
|
||||||
`0xa` is just the ASCII hex representation of a new line.
|
`0x0a` is just the ASCII hex representation of a new line.
|
||||||
|
|
||||||
```
|
```
|
||||||
; sys_write_string.asm
|
; sys_write_string.asm
|
||||||
|
Loading…
Reference in New Issue
Block a user