Add PPC to U-Boot bootloader support.

This should be useful for SAM440 and SAM460 boards for example.
The generic U-Boot code still has some ARM-specific parts that must be moved out though.
This commit is contained in:
François Revol 2012-04-10 18:41:41 +02:00
parent 75cc1dbd2e
commit cffda6bf03
2 changed files with 68 additions and 0 deletions

View File

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

View File

@ -0,0 +1,49 @@
/*
* Copyright 2005, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
* 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