[PATCH 2/2] KVM: PPC: hypervisor large decrementer support
Michael Ellerman
mpe at ellerman.id.au
Tue Jun 7 23:04:13 AEST 2016
On Fri, 2016-06-03 at 07:46 +1000, Benjamin Herrenschmidt wrote:
> On Wed, 2016-06-01 at 16:23 +1000, Michael Neuling wrote:
> > FWIW you can use:
> > andis. reg,reg,(LPCR_LD)@ha
>
> @h in that case. Probably the same result but technically @ha is for
> arithmetic operations.
In this case it doesn't matter, because LPCR_LD is a single bit constant.
But if bit 15 of your constant happens to be 1, using @ha will mean 1 is added
to the high 16 bits of the value.
eg. if you have:
#define CONSTANT 0x00208000
lis r4,CONSTANT at ha
You get:
10000118: 21 00 80 3c lis r4,33
^
= 0x21
Documented (sort of) here:
http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#RELOC-TYPE
#ha(value) denotes the high adjusted value: bits 16 through 31 of the indicated value, compensating for #lo() being treated as a signed number:
#ha(x) = (((x >> 16) + ((x & 0x8000) ? 1 : 0)) & 0xffff)
cheers
More information about the Linuxppc-dev
mailing list