mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
Since the original boot code had been previously refactored to make use of saved-program-state, we can take the existing code
and with only slight modification use it as a C implementation of the go word. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk> git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@727 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
committed by
Mark Cave-Ayland
parent
1b273803c2
commit
a025a2e653
@@ -22,13 +22,14 @@ uint32_t kernel_size;
|
||||
uint32_t qemu_cmdline;
|
||||
uint32_t cmdline_size;
|
||||
char boot_device;
|
||||
static const void *romvec;
|
||||
static int (*entry)(const void *romvec_ptr, int p2, int p3, int p4, int p5);
|
||||
|
||||
static int try_path(const char *path, char *param, const void *romvec)
|
||||
|
||||
static int try_path(const char *path, char *param)
|
||||
{
|
||||
void *boot_notes = NULL;
|
||||
ucell valid, address, type, size;
|
||||
int image_retval = 0;
|
||||
ucell valid;
|
||||
|
||||
push_str(path);
|
||||
fword("pathres-resolve-aliases");
|
||||
@@ -78,6 +79,16 @@ static int try_path(const char *path, char *param, const void *romvec)
|
||||
|
||||
|
||||
start_image:
|
||||
go();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
@@ -122,8 +133,6 @@ start_image:
|
||||
}
|
||||
|
||||
printk("Image returned with return value %#x\n", image_retval);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +141,6 @@ void boot(void)
|
||||
char *path = pop_fstr_copy(), *param, altpath[256];
|
||||
const char *oldpath = path;
|
||||
int unit = 0;
|
||||
const void *romvec;
|
||||
int result;
|
||||
|
||||
if(!path) {
|
||||
@@ -209,7 +217,7 @@ void boot(void)
|
||||
else
|
||||
printk("without parameters.\n");
|
||||
|
||||
result = try_path(path, param, romvec);
|
||||
result = try_path(path, param);
|
||||
if (!result) {
|
||||
push_str(path);
|
||||
PUSH(':');
|
||||
@@ -218,7 +226,7 @@ void boot(void)
|
||||
POP();
|
||||
POP();
|
||||
|
||||
try_path(altpath, param, romvec);
|
||||
try_path(altpath, param);
|
||||
}
|
||||
|
||||
printk("Unsupported image format\n");
|
||||
|
||||
@@ -19,7 +19,8 @@ void *init_openprom(void);
|
||||
// boot.c
|
||||
extern struct sys_info sys_info;
|
||||
extern const char *bootpath;
|
||||
void boot(void);
|
||||
extern void boot(void);
|
||||
extern void go(void);
|
||||
|
||||
// sys_info.c
|
||||
extern unsigned int qemu_mem_size;
|
||||
|
||||
@@ -26,8 +26,7 @@ extern int sparc64_of_client_interface( int *params );
|
||||
static int try_path(const char *path, char *param)
|
||||
{
|
||||
void *boot_notes = NULL;
|
||||
ucell valid, address, type, size;
|
||||
int image_retval = 0;
|
||||
ucell valid;
|
||||
|
||||
#ifdef CONFIG_LOADER_ELF
|
||||
/* ELF Boot loader */
|
||||
@@ -72,6 +71,16 @@ static int try_path(const char *path, char *param)
|
||||
|
||||
|
||||
start_image:
|
||||
go();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
@@ -85,7 +94,7 @@ start_image:
|
||||
switch (type) {
|
||||
case 0x0:
|
||||
/* Start ELF boot image */
|
||||
image_retval = start_elf(address, (uint64_t)boot_notes);
|
||||
image_retval = start_elf(address, (uint64_t)NULL);
|
||||
break;
|
||||
|
||||
case 0x5:
|
||||
@@ -112,10 +121,9 @@ start_image:
|
||||
}
|
||||
|
||||
printk("Image returned with return value %#x\n", image_retval);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void boot(void)
|
||||
{
|
||||
char *path=pop_fstr_copy(), *param;
|
||||
|
||||
@@ -21,7 +21,8 @@ extern uint64_t kernel_size;
|
||||
extern uint64_t qemu_cmdline;
|
||||
extern uint64_t cmdline_size;
|
||||
extern char boot_device;
|
||||
void boot(void);
|
||||
extern void boot(void);
|
||||
extern void go(void);
|
||||
|
||||
// sys_info.c
|
||||
extern uint64_t qemu_mem_size;
|
||||
|
||||
@@ -23,8 +23,7 @@ struct sys_info sys_info;
|
||||
static int try_path(const char *path, char *param)
|
||||
{
|
||||
void *boot_notes = NULL;
|
||||
ucell valid, address, type, size;
|
||||
int image_retval = 0;;
|
||||
ucell valid;
|
||||
|
||||
#ifdef CONFIG_LOADER_ELF
|
||||
/* ELF Boot loader */
|
||||
@@ -69,6 +68,16 @@ static int try_path(const char *path, char *param)
|
||||
|
||||
|
||||
start_image:
|
||||
go();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
@@ -109,10 +118,9 @@ start_image:
|
||||
}
|
||||
|
||||
printk("Image returned with return value %#x\n", image_retval);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void boot(void)
|
||||
{
|
||||
char *path=pop_fstr_copy(), *param;
|
||||
|
||||
@@ -15,4 +15,5 @@ unsigned int start_elf(unsigned long entry_point, unsigned long param);
|
||||
|
||||
/* boot.c */
|
||||
extern struct sys_info sys_info;
|
||||
void boot(void);
|
||||
extern void boot(void);
|
||||
extern void go(void);
|
||||
|
||||
Reference in New Issue
Block a user