From 4db05eabc7fa0bd0ef4a266c375abc1210212cba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Z=C3=A1rev=C3=BAcky?= Date: Thu, 18 Oct 2018 20:45:48 +0200 Subject: [PATCH] Pass ppc32 kernel entry point from C code --- boot/arch/ppc32/include/arch/asm.h | 2 +- boot/arch/ppc32/src/asm.S | 8 ++++---- boot/arch/ppc32/src/main.c | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/boot/arch/ppc32/include/arch/asm.h b/boot/arch/ppc32/include/arch/asm.h index 266a3bcf2b..fa7108cb24 100644 --- a/boot/arch/ppc32/include/arch/asm.h +++ b/boot/arch/ppc32/include/arch/asm.h @@ -32,7 +32,7 @@ #include #include -extern void jump_to_kernel(void *, void *, size_t, void *) +extern void jump_to_kernel(void *, void *, size_t, void *, uintptr_t) __attribute__((noreturn)); extern void real_mode(void); diff --git a/boot/arch/ppc32/src/asm.S b/boot/arch/ppc32/src/asm.S index 44f520bcea..d4bc7977af 100644 --- a/boot/arch/ppc32/src/asm.S +++ b/boot/arch/ppc32/src/asm.S @@ -126,6 +126,7 @@ FUNCTION_BEGIN(jump_to_kernel) # r4 = translate table (physical address) # r5 = pages to translate # r6 = real mode meeting point (physical address) + # r7 = kernel entry point (virtual address in kernel's address space) # disable interrupts @@ -159,6 +160,7 @@ SYMBOL(real_mode) # r3 = bootinfo (physical address) # r4 = translate table (physical address) # r5 = pages to translate + # r7 = kernel entry point (virtual address in kernel's address space) # move the images of components to the proper # location using the translate table @@ -398,15 +400,13 @@ SYMBOL(real_mode) # start the kernel # - # pc = PA2KA(BOOT_OFFSET) + # pc = kernel's entry point (r7) # r3 = bootinfo (physical address) # sprg0 = BOOT_OFFSET # sprg3 = physical memory size # sp = 0 (enforces the usage of sprg0 as exception stack) - lis r31, PA2KA(BOOT_OFFSET)@ha - addi r31, r31, PA2KA(BOOT_OFFSET)@l - mtspr srr0, r31 + mtspr srr0, r7 lis r31, BOOT_OFFSET@ha addi r31, r31, BOOT_OFFSET@l diff --git a/boot/arch/ppc32/src/main.c b/boot/arch/ppc32/src/main.c index 90318874b1..91c10b022f 100644 --- a/boot/arch/ppc32/src/main.c +++ b/boot/arch/ppc32/src/main.c @@ -134,5 +134,6 @@ void bootstrap(void) } printf("Booting the kernel...\n"); - jump_to_kernel(bootinfo_pa, transtable_pa, pages, real_mode_pa); + jump_to_kernel(bootinfo_pa, transtable_pa, pages, real_mode_pa, + PA2KA(BOOT_OFFSET)); }