From: He Ying <heying24@huawei.com>
To: Oliver O'Halloran <oohall@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Paul Mackerras <paulus@samba.org>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH] powerpc: Fix kernel-jump address for ppc64 wrapper boot
Date: Tue, 8 Jun 2021 14:33:26 +0800 [thread overview]
Message-ID: <9dc8b323-7846-0975-16f0-6e3e447383a4@huawei.com> (raw)
In-Reply-To: <CAOSf1CELBh4F334LK6+zy+BPOXKcOm92QZw4g71hQ7oQNa68nw@mail.gmail.com>
Hello,
在 2021/6/8 13:26, Oliver O'Halloran 写道:
> On Fri, Jun 4, 2021 at 7:39 PM He Ying <heying24@huawei.com> wrote:
>> From "64-bit PowerPC ELF Application Binary Interface Supplement 1.9",
>> we know that the value of a function pointer in a language like C is
>> the address of the function descriptor and the first doubleword
>> of the function descriptor contains the address of the entry point
>> of the function.
>>
>> So, when we want to jump to an address (e.g. addr) to execute for
>> PPC-elf64abi, we should assign the address of addr *NOT* addr itself
>> to the function pointer or system will jump to the wrong address.
> How have you tested this?
I tested ppc64-elf big-endian. I changed the Kconfig so that ppc64
big-endian
selects PPC64_WRAPPER_BOOT. I used qemu to run the cuImage and found
the problem. It made me confused. By applying this patch, I found it works.
I thought it works for ppc64le too. So I upstream this patch.
>
> IIRC the 64bit wrapper is only used for ppc64le builds. For that case
> the current code is work because the LE ABI (ABIv2) doesn't use
> function descriptors. I think even for a BE kernel we need the current
> behaviour because the vmlinux's entry point is screwed up (i.e.
> doesn't point a descriptor) and tools in the wild (probably kexec)
> expect it to be screwed up.
Yes, you're right. PPC64_WRAPPER_BOOT is only used for ppc64le builds
currently.
LE ABI (ABI v2) doesn't use function descriptors. Is that right? I don't
test that. If so,
this patch should be dropped. But why does ppc64 have different ABIs? So
strange.
If the wrapper is built to ppc64be, my patch is tested right. The entry
point in the ELF
header is always right so you can assign the header->e_entry to the
function pointer
and then jump to the entry by calling the function. But in the ppc
wrapper, the address
is intialized to 0 or malloced to be an address later. In this
situation, I think my patch
should be right for ppc64be.
>
> ABIv2 (LE) reference:
> https://openpowerfoundation.org/?resource_lib=64-bit-elf-v2-abi-specification-power-architecture
> .
next prev parent reply other threads:[~2021-06-08 6:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-04 9:22 He Ying
2021-06-08 4:55 ` Christophe Leroy
2021-06-08 11:03 ` He Ying
2021-06-08 5:26 ` Oliver O'Halloran
2021-06-08 6:33 ` He Ying [this message]
2021-06-08 7:29 ` Oliver O'Halloran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9dc8b323-7846-0975-16f0-6e3e447383a4@huawei.com \
--to=heying24@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nathan@kernel.org \
--cc=oohall@gmail.com \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®