Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / arch / x86 / boot.c
1 /* tag: openbios boot command for x86
2  *
3  * Copyright (C) 2003-2004 Stefan Reinauer
4  *
5  * See the file "COPYING" for further information about
6  * the copyright and warranty status of this work.
7  */
8
9 #undef BOOTSTRAP
10 #include "config.h"
11 #include "libopenbios/bindings.h"
12 #include "arch/common/nvram.h"
13 #include "libc/diskio.h"
14 #include "libopenbios/sys_info.h"
15 #include "boot.h"
16
17 void go(void)
18 {
19         ucell address, type, size;
20         int image_retval = 0;
21
22         /* Get the entry point and the type (see forth/debugging/client.fs) */
23         feval("saved-program-state >sps.entry @");
24         address = POP();
25         feval("saved-program-state >sps.file-type @");
26         type = POP();
27         feval("saved-program-state >sps.file-size @");
28         size = POP();
29
30         printk("\nJumping to entry point " FMT_ucellx " for type " FMT_ucellx "...\n", address, type);
31
32         switch (type) {
33                 case 0x0:
34                         /* Start ELF boot image */
35                         image_retval = start_elf(address, (uint32_t)&elf_boot_notes);
36                         break;
37
38                 case 0x1:
39                         /* Start ELF image */
40                         image_retval = start_elf(address, (uint32_t)NULL);
41                         break;
42
43                 case 0x5:
44                         /* Start a.out image */
45                         image_retval = start_elf(address, (uint32_t)NULL);
46                         break;
47
48                 case 0x10:
49                         /* Start Fcode image */
50                         printk("Evaluating FCode...\n");
51                         PUSH(address);
52                         PUSH(1);
53                         fword("byte-load");
54                         image_retval = 0;
55                         break;
56
57                 case 0x11:
58                         /* Start Forth image */
59                         PUSH(address);
60                         PUSH(size);
61                         fword("eval2");
62                         image_retval = 0;
63                         break;
64         }
65
66         printk("Image returned with return value %#x\n", image_retval);
67 }
68
69
70 void boot(void)
71 {
72         /* No platform-specific boot code */
73         return;
74 }