What sets little endian state when launching a ppc64le Linux kernel on POWER CPU?
1
vote
0
answers
110
views
I've been doing some research on ppc64le Linux and am unclear on how the POWER CPU is set to little endian. As I understand it the machine and CPU state will run as big endian by default in firmware. But what is responsible for switching into the intended endian when launching the kernel?
Without getting into specifics launching a kernel on POWER/PPC would be summarised as follows:
- Firmware executes on machine reset and resets machine state.
- Firmware loads bootloader and passes over control.
- Boot loader loads kernel and launches it.
I've searched online and found no answers. I've looked into boot loader code such as grub, qemu-vof and slof, though there is a lot to sift through, and it was unclear. I've looked into Linux startup code and can see it reads the MSR_LE state at times but I cannot see it setting it on startup.
So, what is responsible for setting endian? The boot loader or the kernel? Or even something else?
My answer would be the boot loader since it is responsible for loading in the ELF image and launching it in the intended endian. But I so far haven't found any ASM sources where this is clear when launching into an entry point. I'd appreciate finding out what is responsible for setting endian and any source listings detailing how it is done.
Asked by Damien Stewart
(11 rep)
Sep 4, 2023, 06:39 AM