e_stwu/stwu problem

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
3,750件の閲覧回数
Routh
Contributor I

Hi,

I have problem about stack on my 5604b system.

I want to create a section of stack frame, the size of which is 0xA8 byte.

the code like this:

e_stwu r1, -0xA8 (r1)

but the result is r1=r1-0x58 , I don't know what happened.How can I reliaze this purpose?

Very grateful for your assistance

1 解決策
2,691件の閲覧回数
TomE
Specialist II

You need to read up on the instruction you're trying to use.

 

Documented in "Variable-Length Encoding (VLE) Programming Environments Manual," as:

 

    e_stwu rS,D8(rA)

 

There are only 8 SIGNED bits available in the VLE version for the offset, so you're limited to -0x80 to 0x7f (0x70 or 0x7c for alignment).

 

Initially I thoughy you could code it as:

 

e_stwu r1, -0x70 (r1)

e_stwu r1, -0x38 (r1)

 

BUT that would end up with the wrong value stored on the stack, breaking the stack linkage, so it needs something a little smarter than that involving another temporary register.

 

I'd suggest you write a small C function with more than 0x80 bytes of function-local variables/storage, compile it and then disassemble it to see how the compiler solved this problem. Then copy what it did into your assembly code.

 

Tom

元の投稿で解決策を見る

3 返答(返信)
2,692件の閲覧回数
TomE
Specialist II

You need to read up on the instruction you're trying to use.

 

Documented in "Variable-Length Encoding (VLE) Programming Environments Manual," as:

 

    e_stwu rS,D8(rA)

 

There are only 8 SIGNED bits available in the VLE version for the offset, so you're limited to -0x80 to 0x7f (0x70 or 0x7c for alignment).

 

Initially I thoughy you could code it as:

 

e_stwu r1, -0x70 (r1)

e_stwu r1, -0x38 (r1)

 

BUT that would end up with the wrong value stored on the stack, breaking the stack linkage, so it needs something a little smarter than that involving another temporary register.

 

I'd suggest you write a small C function with more than 0x80 bytes of function-local variables/storage, compile it and then disassemble it to see how the compiler solved this problem. Then copy what it did into your assembly code.

 

Tom

2,691件の閲覧回数
Bloodhound
Contributor I

Would have been great to see the code produced because I have run in to the same problem with the command

e_stwu  

r1,-0x84(r1)

0 件の賞賛
返信
2,691件の閲覧回数
pradeepmc
Contributor II

Posting the reply even though it is late. Since it may help other people. 

We can use the below when the offset is more the 0x7f. 

e_stw r1, -0x84(r1)

e_add16i r1,r1, -0x84

0 件の賞賛
返信