Accessing sda_rel data in assembler

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

Accessing sda_rel data in assembler

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

I have a global variable declared in a C module that I need to access from an assembler module. If I disassemble the C code, I can see that it is using addressing relative to r13 to access this data.

 

My question is, in assembler, what is the syntax to do this same kind of access? How do I tell the assembler to form the relative offset of myVar from the base of its data section (which is .sbss).

 

.extern myVar 

    lzw    r3, (myVar ???) (r13)

 

What do I put in the ??? spot to tell it that this offset is relative to _ABS_SDA_BASE_ ?

 

Karl

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,214件の閲覧回数
stanish
NXP Employee
NXP Employee

Hello Karl,

 

I'd suggest you to try this syntax:

 

lwz r3,myVar@sdax(r13) 

 

 

 Stanish

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,215件の閲覧回数
stanish
NXP Employee
NXP Employee

Hello Karl,

 

I'd suggest you to try this syntax:

 

lwz r3,myVar@sdax(r13) 

 

 

 Stanish

0 件の賞賛
返信
1,214件の閲覧回数
Karl_H
Contributor III

Thanks so much. The version of the assembler reference manual that I was using doesn't list that magic word. But after seeing your reply, I added "sdax" to my google search that I was doing on this last week and it pointed me to a better version of the assembler reference manual that has this token documented as a way of doing small-data-relative accesses. It has other good stuff that my original version doesn't as well.

 

Karl

 

0 件の賞賛
返信