segmentation fault at every assembly code

后端 未结 2 465
走了就别回头了
走了就别回头了 2021-01-29 05:58

I\'am trying to learn assemly on raspberry pi.But I couldn\'t get started, every code i write gets \"Segmentation Fault\".

.text
.global _start
_start:
   MOV R0         


        
2条回答
  •  南笙
    南笙 (楼主)
    2021-01-29 06:06

    In the EABI that the Raspberry Pi uses, SWI 0 is just the system call entry. You still need to specify which function you want using r7. So, something like this should work:

    .text
    .global _start
    _start:
       MOV R0, #2
       MOV R7, #1 ; sys_exit
       SWI 0
    

提交回复
热议问题