0

Apologies for the poorly worded question, but this has been puzzling me.

To demonstrate what I am trying to convey, here's an example program:

push rbp
mov rbp,rsp
dec rsp
mov rcx,rsp
mov al,"c"
mov [rcx],al
mov rax,4
mov rdx,1
mov rbx,1
int 0x80
leave
ret

However, when compiled and executed, linux does not print anything to the terminal, when it is expected to print "c"

Is there something i'm missing?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Epsilon
  • 13
  • 2
  • What language are you writing? Please update your tags accordingly. – Kind Stranger Mar 01 '18 at 03:00
  • 1
    `rsp` is outside the low 32 bits of virtual address space, so truncating it (by using the 32-bit `int 0x80` ABI) results in a `-EFAULT` error return from the system call. – Peter Cordes Mar 01 '18 at 03:33

0 Answers0