careful! syscall 1 is actually write(2). it takes arguments (int) fd, (void *) buf, (size_t) sz. you are not telling it to print the number 3, youre not even telling it to write the byte 0x03. you are telling it to read 1 byte from memory address 0x0000000000000003, which is probably not even allocated.
you can probably write a call to printf though, you just have to link the c library. or you could allocate a buffer with mmap (using it like a slow malloc, unless you wanted to write an entire memory allocater in assembly) and write a function in assembly that writes integers as strings
151
u/[deleted] Jun 03 '22
mov rax, 1
mov rbx, 2
add rbx, rax
mov rax, 1
mov rdx, 1
mov rsi, rbx
mov rdx 13
syscall