qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/3] linux-user: Handle ELFv2 PPC64 binaries in


From: Ulrich Weigand
Subject: Re: [Qemu-devel] [PATCH 1/3] linux-user: Handle ELFv2 PPC64 binaries in user mode.
Date: Thu, 8 May 2014 15:30:35 +0200

Doug Kwan (關振德) <address@hidden> wrote on 08.05.2014 10:43:14:

On Thu, May 8, 2014 at 1:36 AM, Alexander Graf <address@hidden> wrote:
>> -    _regs->gpr[2] = ldq_raw(infop->entry + 8) + infop->load_bias;
>> -    infop->entry = ldq_raw(infop->entry) + infop->load_bias;
>> +    if (get_ppc64_abi(infop) < 2) {
>> +      _regs->gpr[2] = ldq_raw(infop->entry + 8) + infop->load_bias;
>> +      infop->entry = ldq_raw(infop->entry) + infop->load_bias;
>> +    } else {
>> +      _regs->gpr[12] = infop->entry;  /* r12 set to global entry
address */
>>
>> Uli, is this correct? Also, why don't w need to adjust for the
>> load_bias with ELFv2 anymore?
>
> No.  This is a bug.  It was not caught by testing because load_bias
> is 0 I guess.

Actually, it looks correct to me.  The value of infop->entry itself
was presumably already adjusted for the load bias by common code.

However, on ELFv1, that value points to the descriptor, but the values
we *load* from that descriptor *also* need to be adjusted by the load
bias, since the image has not yet been relocated at this stage.

With ELFv2, the (already adjusted) infop->entry value points directly
to the code, so no further adjustment is required.

Bye,
Ulrich

reply via email to

[Prev in Thread] Current Thread [Next in Thread]