Fix OpenBSD >4.2 crash when printing out bootpath

git-svn-id: svn://coreboot.org/openbios/openbios-devel@244 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2008-11-02 19:25:05 +00:00
parent 59f731027a
commit f6ddfeb0e7
3 changed files with 12 additions and 6 deletions

View File

@@ -41,12 +41,12 @@ void boot(void)
oldpath = "fd()";
break;
case 'c':
path = strdup("disk");
path = strdup("disk:d");
oldpath = "sd(0,0,0):d";
break;
default:
case 'd':
path = strdup("cdrom");
path = strdup("cdrom:b");
// FIXME: hardcoding this looks almost definitely wrong.
// With sd(0,2,0):b we get to see the solaris kernel though
//oldpath = "sd(0,2,0):d";
@@ -86,7 +86,7 @@ void boot(void)
obp_arg.argv[1] = param;
}
romvec = init_openprom(qemu_mem_size);
romvec = init_openprom(qemu_mem_size, path);
if (kernel_size) {
int (*entry)(const void *romvec_ptr, int p2, int p3, int p4, int p5);

View File

@@ -16,7 +16,7 @@ int linux_load(struct sys_info *, const char *filename, const char *cmdline,
unsigned int start_elf(unsigned long entry_point, unsigned long param);
void *init_openprom(unsigned long memsize);
void *init_openprom(unsigned long memsize, const char *path);
void boot(void);
extern struct sys_info sys_info;

View File

@@ -50,6 +50,7 @@ static int obp_devread(int dev_desc, char *buf, int nbytes);
static int obp_devseek(int dev_desc, int hi, int lo);
struct linux_arguments_v0 obp_arg;
static const char *bootpath;
static const struct linux_arguments_v0 * const obp_argp = &obp_arg;
static void (*sync_hook)(void);
@@ -507,7 +508,7 @@ static void obp_fortheval_v2(char *str)
}
void *
init_openprom(unsigned long memsize)
init_openprom(unsigned long memsize, const char *path)
{
ptphys = totphys;
ptmap = totmap;
@@ -564,7 +565,12 @@ init_openprom(unsigned long memsize)
romvec0.pv_v2devops.v2_dev_read = obp_devread;
romvec0.pv_v2devops.v2_dev_write = obp_devwrite;
romvec0.pv_v2devops.v2_dev_seek = obp_devseek;
romvec0.pv_v2bootargs.bootpath = &obp_arg.argv[0];
push_str(path);
fword("pathres-resolve-aliases");
bootpath = pop_fstr_copy();
romvec0.pv_v2bootargs.bootpath = &bootpath;
romvec0.pv_v2bootargs.bootargs = &obp_arg.argv[1];
romvec0.pv_v2bootargs.fd_stdin = &obp_fd_stdin;
romvec0.pv_v2bootargs.fd_stdout = &obp_fd_stdout;