6 #include "libopenbios/bindings.h"
7 #include "arch/common/nvram.h"
8 #include "libc/diskio.h"
9 #include "libc/vsprintf.h"
10 #include "libopenbios/sys_info.h"
13 uint64_t kernel_image;
15 uint64_t qemu_cmdline;
16 uint64_t cmdline_size;
19 extern int sparc64_of_client_interface( int *params );
24 ucell address, type, size;
27 /* Get the entry point and the type (see forth/debugging/client.fs) */
28 feval("saved-program-state >sps.entry @");
30 feval("saved-program-state >sps.file-type @");
32 feval("saved-program-state >sps.file-size @");
35 printk("\nJumping to entry point " FMT_ucellx " for type " FMT_ucellx "...\n", address, type);
39 /* Start ELF boot image */
40 image_retval = start_elf(address, (uint64_t)&elf_boot_notes);
45 image_retval = start_client_image(address, (uint64_t)&sparc64_of_client_interface);
49 /* Start a.out image */
50 image_retval = start_client_image(address, (uint64_t)&sparc64_of_client_interface);
54 /* Start Fcode image */
55 printk("Evaluating FCode...\n");
63 /* Start Forth image */
71 printk("Image returned with return value %#x\n", image_retval);
74 /* ( path len -- path len ) */
80 /* Copy the incoming path */
82 path = pop_fstr_copy();
84 /* Boot preloaded kernel */
86 void (*entry)(unsigned long p1, unsigned long p2, unsigned long p3,
87 unsigned long p4, unsigned long p5);
89 printk("[sparc64] Kernel already loaded\n");
90 entry = (void *) (unsigned long)kernel_image;
91 entry(0, 0, 0, 0, (unsigned long)&sparc64_of_client_interface);
94 /* Invoke Linux directly -- probably not supported */
96 /* No path specified, so grab defaults from /chosen */
101 fword("get-package-property");
103 /* Update our local copy of path as well as the one on the stack */
105 path = pop_fstr_copy();
109 param = strchr(path, ' ');
113 } else if (cmdline_size) {
114 param = (char *)qemu_cmdline;
116 push_str("boot-args");
117 push_str("/options");
120 fword("get-package-property");
122 param = pop_fstr_copy();
125 /* Invoke platform-specific Linux loader */
126 linux_load(&sys_info, path, param);