PUSH {lr} and POP {lr} in ARM Arch64

后端 未结 2 1820
天命终不由人
天命终不由人 2021-01-22 16:20

What is the equivalent instruction for PUSH{lr} and POP{lr} in ARM Arch64 instruction set .

Is STR X30, [SP, #8] correct ? could y

2条回答
  •  逝去的感伤
    2021-01-22 16:33

    If you ask the C compiler to generate an assembly language listing from your source, you'll see how it handles pushing data on the stack for ARMv8. This might not be the only way to do it, but GCC does it this way:

       sub  sp, sp, #32     \\ Open up some temp stack space
       stp  x19, x20, [sp]  \\ save 2 pairs of registers
       stp  x21, x30, [sp,#16]
     
       ldp  x19, x20, [sp]  \\ restore 2 pairs of registers
       ldp  x21, x30, [sp,#16]
       add  sp, sp, #32     \\ "free" the temp stack space
    

提交回复
热议问题