public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
* Simple question about powerpc asm.
@ 2009-07-18  9:24 HongWoo Lee
  2009-07-18 10:31 ` Valentine
  0 siblings, 1 reply; 4+ messages in thread
From: HongWoo Lee @ 2009-07-18  9:24 UTC (permalink / raw)
  To: linuxppc-dev

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Simple question about powerpc asm.
  2009-07-18  9:24 Simple question about powerpc asm HongWoo Lee
@ 2009-07-18 10:31 ` Valentine
  2009-07-18 12:54   ` Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: Valentine @ 2009-07-18 10:31 UTC (permalink / raw)
  To: HongWoo Lee; +Cc: linuxppc-dev

HongWoo Lee wrote:
> 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.
> 

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

> Thanks in advance.
> 
> HongWoo.
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists•ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Simple question about powerpc asm.
  2009-07-18 10:31 ` Valentine
@ 2009-07-18 12:54   ` Wolfgang Denk
  2009-07-18 13:55     ` Valentine
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Denk @ 2009-07-18 12:54 UTC (permalink / raw)
  To: Valentine; +Cc: HongWoo Lee, linuxppc-dev

Dear Valentine,

In message <4A61A48D.8060601@ru•mvista.com> 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

-- 
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: wd@denx•de
Emotions are alien to me.  I'm a scientist.
	-- Spock, "This Side of Paradise", stardate 3417.3

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Simple question about powerpc asm.
  2009-07-18 12:54   ` Wolfgang Denk
@ 2009-07-18 13:55     ` Valentine
  0 siblings, 0 replies; 4+ messages in thread
From: Valentine @ 2009-07-18 13:55 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: HongWoo Lee, linuxppc-dev

Wolfgang Denk wrote:
> Dear Valentine,
> 
> In message <4A61A48D.8060601@ru•mvista.com> 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
> ;-)

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

Regards,
Val.

> 
> Best regards,
> 
> Wolfgang Denk
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-07-18 13:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-18  9:24 Simple question about powerpc asm HongWoo Lee
2009-07-18 10:31 ` Valentine
2009-07-18 12:54   ` Wolfgang Denk
2009-07-18 13:55     ` Valentine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox