Skip to contentSkip to conversation

Simple question about powerpc asm.

DISCUSSION HongWoo Lee 3 participants 4 messages Jul 18, 2009

lore
Share & tools
lore
#0 lore raw

Hi all,

I was reading kernel level source and found this macro.

#define SET_REG_TO_LABEL(reg, label) \

   lis     reg,(label)@highest;                    \
   ori     reg,reg,(label)@higher;                 \
   rldicr  reg,reg,32,31;                          \
   oris    reg,reg,(label)@h;                      \
   ori     reg,reg,(label)@l;

But, I couldn't find any clue related with @highest, @higher, @h, @l.

If anybody know about this directives(?), please explain it. Or just let me know the keyword, so I can search with those keyword.

Thanks in advance.

HongWoo.

#1 lore raw
Quoted 11 lines · HongWoo Lee

Hi all,

I was reading kernel level source and found this macro.

#define SET_REG_TO_LABEL(reg, label)                \
   lis     reg,(label)@highest;                    \
   ori     reg,reg,(label)@higher;                 \
   rldicr  reg,reg,32,31;                          \
   oris    reg,reg,(label)@h;                      \
   ori     reg,reg,(label)@l;
Quoted 5 lines

But, I couldn't find any clue related with @highest, @higher, @h, @l.

If anybody know about this directives(?), please explain it. Or just let me know the keyword, so I can search with those keyword.

PowerPC instructions are 32-bit long. So, there are only 16 bits available within the instruction for constant values. Since address can be up to 64 bits, we have to load it a piece at a time. The "@" within the assembler instruct it to give a specially-processed form of a symbol value:

@highest -- refers to bits 48-63 of a constant
@higher -- refers to bits 32-47 of a constant
@h -- refers to bits 16-31 of a constant
@l -- refers to bits 0-15 of a constant

Quoted 7 lines

Thanks in advance.

HongWoo.
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

#2 lore raw

Dear Valentine,

Quoted 11 lines · In message <[email protected]> you wrote:

PowerPC instructions are 32-bit long. So, there are only 16 bits available within the instruction for constant values. Since address can be up to 64 bits, we have to load it a piece at a time. The "@" within the assembler instruct it to give a specially-processed form of a symbol value:

@highest -- refers to bits 48-63 of a constant
@higher -- refers to bits 32-47 of a constant
@h -- refers to bits 16-31 of a constant
@l -- refers to bits 0-15 of a constant

Actually these bit numbers are wrong, as bit 0 is the MSB for PowerPC ;-)

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
Emotions are alien to me.  I'm a scientist.
	-- Spock, "This Side of Paradise", stardate 3417.3
#3 lore raw
Quoted 5 lines · Wolfgang Denk

Dear Valentine,

Quoted 2 lines · In message <[email protected]> you wrote:

PowerPC instructions are 32-bit long. So, there are only 16 bits available within the instruction for constant values. Since address can be up to 64 bits, we have to load it a piece at a time. The "@" within the assembler instruct it to give a specially-processed form of a symbol value:

Quoted 7 lines
Quoted 4 lines

@highest -- refers to bits 48-63 of a constant
@higher -- refers to bits 32-47 of a constant
@h -- refers to bits 16-31 of a constant
@l -- refers to bits 0-15 of a constant

Actually these bit numbers are wrong, as bit 0 is the MSB for PowerPC ;-)

All right, you got me ;)
Even copy-pasting from the IBM docs, one has to double-check :)

Regards,
Val.

Quoted 5 lines

Best regards,

Wolfgang Denk