Sam460ex: Add a Linux-type kernel entry point

* the onboard U-Booot and 2nd-stage loader only know a few OS types,
we'll try faking Linux there.
This commit is contained in:
François Revol 2012-05-17 17:36:19 +02:00
parent d86473dfb9
commit 693b3532c7
3 changed files with 82 additions and 2 deletions

View File

@ -13,8 +13,9 @@ HAIKU_BOOT_PLATFORM = u-boot ;
# load address for haiku_loader
HAIKU_BOARD_LOADER_BASE = 0x00000000 ;
# entry points (raw binary, and netbsd loader emulation)
HAIKU_BOARD_LOADER_ENTRY_RAW = 0x00000000 ;
HAIKU_BOARD_LOADER_ENTRY_NBSD = 0x00000008 ;
HAIKU_BOARD_LOADER_ENTRY_LINUX = 0x00000000 ;
#HAIKU_BOARD_LOADER_ENTRY_NBSD = 0x00000008 ;
#HAIKU_BOARD_LOADER_ENTRY_RAW = 0x00000010 ;
# load address for haiku_loader uimage
# (must be different than real load address)

View File

@ -0,0 +1,17 @@
/*
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef SYSTEM_ARCH_X86_ASM_DEFS_H
#define SYSTEM_ARCH_X86_ASM_DEFS_H
#define SYMBOL(name) .global name; name
#define SYMBOL_END(name) 1: .size name, 1b - name
#define STATIC_FUNCTION(name) .type name, @function; name
#define FUNCTION(name) .global name; .type name, @function; name
#define FUNCTION_END(name) 1: .size name, 1b - name
#endif /* SYSTEM_ARCH_X86_ASM_DEFS_H */

View File

@ -0,0 +1,62 @@
//#include <arch/ppc/arch_cpu.h>
#include <asm_defs.h>
.text
/*
* Entry points to the loader that U-Boot passes control to.
*/
/*
* called as Linux kernel entry
* *MUST* be first symbol
*/
SYMBOL(_start_linux):
/*
* ELF entry
*/
SYMBOL(_start):
li %r11, 0
b _start_common
SYMBOL_END(_start_linux)
SYMBOL_END(_start)
SYMBOL(_start_common):
lis %r12, gUBootGlobalData@ha
ori %r12, %r12, gUBootGlobalData@l
stw %r2, 0(%r12)
stw %r11, 8(%r12) // gUBootOS
b start_linux_ppc_fdt
// return
blr
SYMBOL_END(_start_common)
//XXX: doesn't seem to work
//.data
SYMBOL(gUBootGlobalData):
.long 0
SYMBOL_END(gUBootGlobalData)
SYMBOL(gUImage):
.long 0
SYMBOL_END(gUImage)
SYMBOL(gUBootOS):
//XXX: bug? Using .byte makes the next asm symbol
// to be at the same address
// .byte 0
.long 0
SYMBOL_END(gUBootOS)