code warrior disassemble code question

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

code warrior disassemble code question

ソリューションへジャンプ
1,914件の閲覧回数
lvyang
Contributor III

code warrior IDE(5.9.0)

MCU:SPC560P34

e_stwu   rsp,-32(rsp)

 

I find this code on every function disassemble code first line.

who can tell me what's the meaning or reference doc?

Thanks.

ラベル(1)
0 件の賞賛
返信
1 解決策
1,712件の閲覧回数
martin_kovar
NXP Employee
NXP Employee

Hi,

this instruction allocates stack for the function. At the end of the function, there is something like se_addi r1,0x20 which returns stack pointer to the previous position (before function was called).

Regards,

Martin

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
1,713件の閲覧回数
martin_kovar
NXP Employee
NXP Employee

Hi,

this instruction allocates stack for the function. At the end of the function, there is something like se_addi r1,0x20 which returns stack pointer to the previous position (before function was called).

Regards,

Martin

0 件の賞賛
返信
1,712件の閲覧回数
lvyang
Contributor III

Hi Martin,

Does the compile define the symble "rsp" as a stack pointer?

If so how to realize push and pop function.

Thanks in advance.

0 件の賞賛
返信
1,712件の閲覧回数
martin_kovar
NXP Employee
NXP Employee

Hello,

rsp is only (compiler) symbolic name for r1 register. If you look at the PPC EABI standard, you will find there that r1 register is always stack pointer.

What do you mean by push and pop functions?

If you create and call function in C language, compiler automatically create stack frame for this function.

But you can use nofralloc directive in your asm function:

pastedImage_1.png

Regards,

Martin

0 件の賞賛
返信
1,712件の閲覧回数
lvyang
Contributor III

Thanks a lot.

0 件の賞賛
返信