===========================================
SYSCALL
===========================================
Takes 7 arguments based on values stored in registers, as shown below in a table
Argument Registers
----------------------
ID rax * Can either be 0 for sys_read, 1 for sys_write to screen or 2 for sys_open can find the rest online
1 rdi * should hold filedescriptor
2 rsi * should hold buffer , location of string
3 rdx * hold length
4 r10
5 r8
6 r9
* # is a physical number, $ is an address
syscall ID ARG1 ARG2 ARG3 ARG4 ARG5 ARG6
sys_write 1 #filedescriptor $buffer #count
filedescriptor = 0 standard input, 1 standard output, 2 standard error
Buffer = location of string to write
Count = Length of string
===========================================
SECTIONS
===========================================
There are 3 sections in the x86_64
.data * Where all the data is defined memory we use BEFORE compilation
.text * Where the code goes
.bss * Allocate/REserve memory for future use
===========================================
LABELS
===========================================
label part of the code, upon compilation the compiler will calculate the location in which the label will sit in memory
The _start label is essential for all programs, if the linker cannof find _start it will throw an error
===========================================
GLOBAL
===========================================
Used when you want the linker to be able to know the address of some label.
Comments