diff --git a/src/system/boot/platform/u-boot/arch/ppc/Jamfile b/src/system/boot/platform/u-boot/arch/ppc/Jamfile new file mode 100644 index 0000000000..651d61c6b5 --- /dev/null +++ b/src/system/boot/platform/u-boot/arch/ppc/Jamfile @@ -0,0 +1,19 @@ +SubDir HAIKU_TOP src system boot platform openfirmware arch ppc ; + +SubDirHdrs $(HAIKU_TOP) src system boot platform $(TARGET_BOOT_PLATFORM) ; +UsePrivateSystemHeaders ; +UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ] + [ FDirName kernel boot platform $(HAIKU_BOOT_PLATFORM) ] ; + +SubDirC++Flags -fno-rtti ; + +KernelStaticLibrary boot_platform_openfirmware_ppc : + arch_mmu.cpp + arch_cpu_asm.S + arch_start_kernel.S + cpu.cpp + mmu.cpp +; + +SEARCH on [ FGristFiles arch_cpu_asm.S arch_mmu.cpp ] + = [ FDirName $(HAIKU_TOP) src system kernel arch $(TARGET_ARCH) ] ; diff --git a/src/system/boot/platform/u-boot/arch/ppc/arch_start_kernel.S b/src/system/boot/platform/u-boot/arch/ppc/arch_start_kernel.S new file mode 100644 index 0000000000..2156e1d7a8 --- /dev/null +++ b/src/system/boot/platform/u-boot/arch/ppc/arch_start_kernel.S @@ -0,0 +1,49 @@ +/* + * Copyright 2005, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ + +#define FUNCTION(x) .global x; .type x,@function; x + +/* status_t arch_start_kernel(struct kernel_args *kernelArgs, + addr_t kernelEntry, addr_t kernelStackTop); + + r3 - kernelArgs + r4 - kernelEntry + r5 - kernelStackTop +*/ +FUNCTION(arch_start_kernel): + // push a stack frame + stwu %r1, -32(%r1) + mflr %r0 + stw %r0, 36(%r1) + + // save the old stack pointer in r29 + stw %r29, 20(%r1) + mr %r29, %r1 + + // set up the kernel stack + subi %r1, %r5, 16 + + // clear the pointer to the previous frame + li %r0, 0 + stw %r0, 0(%r1) + + // enter the kernel + mtlr %r4 + li %r4, 0 + blrl + + /* Actually we should never get here, but at least for debugging purposes + it's quite nice to return in an orderly manner. */ + + // reset the boot loader stack + mr %r1, %r29 + lwz %r29, 20(%r1) + + // pop the stack frame + lwz %r0, 36(%r1) + mtlr %r0 + addi %r1, %r1, 32 + blr +