diff options
author | Yang Zhang <yang.z.zhang@intel.com> | 2015-08-28 09:58:54 +0800 |
---|---|---|
committer | Yang Zhang <yang.z.zhang@intel.com> | 2015-09-01 12:44:00 +0800 |
commit | e44e3482bdb4d0ebde2d8b41830ac2cdb07948fb (patch) | |
tree | 66b09f592c55df2878107a468a91d21506104d3f /qemu/roms/openbios/libopenbios/initprogram.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/libopenbios/initprogram.c')
-rw-r--r-- | qemu/roms/openbios/libopenbios/initprogram.c | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/qemu/roms/openbios/libopenbios/initprogram.c b/qemu/roms/openbios/libopenbios/initprogram.c new file mode 100644 index 000000000..1fa33ba66 --- /dev/null +++ b/qemu/roms/openbios/libopenbios/initprogram.c @@ -0,0 +1,85 @@ +/* + * Creation Date: <2010/04/02 13:00:00 mcayland> + * Time-stamp: <2010/04/02 13:00:00 mcayland> + * + * <initprogram.c> + * + * C implementation of (init-program) word + * + * Copyright (C) 2010 Mark Cave-Ayland (mark.cave-ayland@siriusit.co.uk) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 + * + */ + +#include "config.h" +#include "kernel/kernel.h" +#include "libopenbios/bindings.h" +#include "libopenbios/initprogram.h" + +/* Because the a.out loader requires platform-specific headers */ +#ifdef CONFIG_LOADER_AOUT +#include "libopenbios/aout_load.h" +#endif + +#include "libopenbios/bootinfo_load.h" +#include "libopenbios/elf_load.h" +#include "libopenbios/fcode_load.h" +#include "libopenbios/forth_load.h" +#include "libopenbios/xcoff_load.h" + + +void init_program(void) +{ + /* Get the value of load-base and use it to determine the correct loader + to use */ + ucell addr; + + feval("load-base"); + addr = POP(); + +#ifdef CONFIG_LOADER_AOUT + if (is_aout((struct exec *)cell2pointer(addr))) { + aout_init_program(); + return; + } +#endif + +#ifdef CONFIG_LOADER_BOOTINFO + if (is_bootinfo((char *)cell2pointer(addr))) { + bootinfo_init_program(); + return; + } +#endif + +#ifdef CONFIG_LOADER_ELF + if (is_elf((Elf_ehdr *)cell2pointer(addr))) { + elf_init_program(); + return; + } +#endif + +#ifdef CONFIG_LOADER_FCODE + if (is_fcode((unsigned char *)cell2pointer(addr))) { + fcode_init_program(); + return; + } +#endif + +#ifdef CONFIG_LOADER_FORTH + if (is_forth((char *)cell2pointer(addr))) { + forth_init_program(); + return; + } +#endif + +#ifdef CONFIG_LOADER_XCOFF + if (is_xcoff((COFF_filehdr_t *)cell2pointer(addr))) { + xcoff_init_program(); + return; + } +#endif + +} |