aboutsummaryrefslogtreecommitdiffstats
path: root/roms/openbios/arch/x86/boot.c
diff options
context:
space:
mode:
authorfishsoupisgood <github@madingley.org>2019-04-29 01:17:54 +0100
committerfishsoupisgood <github@madingley.org>2019-05-27 03:43:43 +0100
commit3f2546b2ef55b661fd8dd69682b38992225e86f6 (patch)
tree65ca85f13617aee1dce474596800950f266a456c /roms/openbios/arch/x86/boot.c
downloadqemu-3f2546b2ef55b661fd8dd69682b38992225e86f6.tar.gz
qemu-3f2546b2ef55b661fd8dd69682b38992225e86f6.tar.bz2
qemu-3f2546b2ef55b661fd8dd69682b38992225e86f6.zip
Initial import of qemu-2.4.1HEADmaster
Diffstat (limited to 'roms/openbios/arch/x86/boot.c')
-rw-r--r--roms/openbios/arch/x86/boot.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/roms/openbios/arch/x86/boot.c b/roms/openbios/arch/x86/boot.c
new file mode 100644
index 00000000..d40ab8c5
--- /dev/null
+++ b/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;
+}