2006-04-26 15:08:19 +00:00
|
|
|
/* 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
|
2010-03-14 17:19:58 +00:00
|
|
|
#include "config.h"
|
2010-03-14 15:05:53 +00:00
|
|
|
#include "libopenbios/bindings.h"
|
2010-03-14 20:34:01 +00:00
|
|
|
#include "arch/common/nvram.h"
|
2006-04-26 15:08:19 +00:00
|
|
|
#include "libc/diskio.h"
|
2010-03-14 16:09:44 +00:00
|
|
|
#include "libopenbios/sys_info.h"
|
2006-04-26 15:08:19 +00:00
|
|
|
#include "boot.h"
|
|
|
|
|
|
2010-08-01 15:13:48 +00:00
|
|
|
void *elf_boot_notes = NULL;
|
2010-04-02 13:29:12 +00:00
|
|
|
|
|
|
|
|
void go(void)
|
|
|
|
|
{
|
|
|
|
|
ucell address, type, size;
|
|
|
|
|
int image_retval = 0;
|
|
|
|
|
|
2010-03-26 22:33:50 +00:00
|
|
|
/* 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();
|
|
|
|
|
|
2010-04-02 14:17:45 +00:00
|
|
|
printk("\nJumping to entry point " FMT_ucellx " for type " FMT_ucellx "...\n", address, type);
|
2010-03-26 22:33:50 +00:00
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
|
case 0x0:
|
|
|
|
|
/* Start ELF boot image */
|
2010-04-02 14:03:38 +00:00
|
|
|
image_retval = start_elf(address, (uint32_t)&boot_notes);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 0x1:
|
|
|
|
|
/* Start ELF image */
|
2010-03-26 22:33:50 +00:00
|
|
|
image_retval = start_elf(address, (uint32_t)NULL);
|
|
|
|
|
break;
|
|
|
|
|
|
2010-03-28 20:18:30 +00:00
|
|
|
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;
|
|
|
|
|
|
2010-03-26 22:33:50 +00:00
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-02 13:29:12 +00:00
|
|
|
|
2006-04-26 15:08:19 +00:00
|
|
|
void boot(void)
|
|
|
|
|
{
|
2010-08-01 15:13:48 +00:00
|
|
|
/* No platform-specific boot code */
|
|
|
|
|
return;
|
2006-04-26 15:08:19 +00:00
|
|
|
}
|