diff options
author | 2015-08-28 09:58:54 +0800 | |
---|---|---|
committer | 2015-09-01 12:44:00 +0800 | |
commit | e44e3482bdb4d0ebde2d8b41830ac2cdb07948fb (patch) | |
tree | 66b09f592c55df2878107a468a91d21506104d3f /qemu/roms/openbios/arch/x86/boot.c | |
parent | 9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (diff) |
Add qemu 2.4.0
Change-Id: Ic99cbad4b61f8b127b7dc74d04576c0bcbaaf4f5
Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Diffstat (limited to 'qemu/roms/openbios/arch/x86/boot.c')
-rw-r--r-- | qemu/roms/openbios/arch/x86/boot.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/qemu/roms/openbios/arch/x86/boot.c b/qemu/roms/openbios/arch/x86/boot.c new file mode 100644 index 000000000..d40ab8c5b --- /dev/null +++ b/qemu/roms/openbios/arch/x86/boot.c @@ -0,0 +1,74 @@ +/* tag: openbios boot command for x86 + * + * Copyright (C) 2003-2004 Stefan Reinauer + * + * See the file "COPYING" for further information about + * the copyright and warranty status of this work. + */ + +#undef BOOTSTRAP +#include "config.h" +#include "libopenbios/bindings.h" +#include "arch/common/nvram.h" +#include "libc/diskio.h" +#include "libopenbios/sys_info.h" +#include "boot.h" + +void go(void) +{ + ucell address, type, size; + int image_retval = 0; + + /* Get the entry point and the type (see forth/debugging/client.fs) */ + feval("saved-program-state >sps.entry @"); + address = POP(); + feval("saved-program-state >sps.file-type @"); + type = POP(); + feval("saved-program-state >sps.file-size @"); + size = POP(); + + printk("\nJumping to entry point " FMT_ucellx " for type " FMT_ucellx "...\n", address, type); + + switch (type) { + case 0x0: + /* Start ELF boot image */ + image_retval = start_elf(address, (uint32_t)&elf_boot_notes); + break; + + case 0x1: + /* Start ELF image */ + image_retval = start_elf(address, (uint32_t)NULL); + break; + + case 0x5: + /* Start a.out image */ + image_retval = start_elf(address, (uint32_t)NULL); + break; + + case 0x10: + /* Start Fcode image */ + printk("Evaluating FCode...\n"); + PUSH(address); + PUSH(1); + fword("byte-load"); + image_retval = 0; + break; + + case 0x11: + /* Start Forth image */ + PUSH(address); + PUSH(size); + fword("eval2"); + image_retval = 0; + break; + } + + printk("Image returned with return value %#x\n", image_retval); +} + + +void boot(void) +{ + /* No platform-specific boot code */ + return; +} |