Skip to content

Commit

Permalink
Pass ppc32 kernel entry point from C code
Browse files Browse the repository at this point in the history
  • Loading branch information
le-jzr committed Oct 20, 2018
1 parent 2cea4c5 commit 4db05ea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion boot/arch/ppc32/include/arch/asm.h
Expand Up @@ -32,7 +32,7 @@
#include <stddef.h>
#include <arch/main.h>

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);

Expand Down
8 changes: 4 additions & 4 deletions boot/arch/ppc32/src/asm.S
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion boot/arch/ppc32/src/main.c
Expand Up @@ -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));
}

0 comments on commit 4db05ea

Please sign in to comment.