Assembly and System Calls

前端 未结 2 1254
情歌与酒
情歌与酒 2021-01-24 06:03

Im having a bit of trouble understanding the more complex system calls in assembly. I wrote a exec system call and it worked great

 .bss

.text

.globl _start

         


        
2条回答
  •  天命终不由人
    2021-01-24 06:14

    You don't put strings in a register. You should pass a pointer (the address) to a null (0) terminated string (C style) in the register for this function. Some system calls (like write) take a pointer (not necessarily terminated by '\0') and length in two registers.

    # somewhere in the data section:
    myString:
       .asciz "/bin/bash"
    

    and pass $myString using the register.

提交回复
热议问题