Author: blueswirl
Date: 2008-11-02 20:25:05 +0100 (Sun, 02 Nov 2008)
New Revision: 244
Modified:
openbios-devel/arch/sparc32/boot.c
openbios-devel/arch/sparc32/boot.h
openbios-devel/arch/sparc32/romvec.c
Log:
Fix OpenBSD >4.2 crash when printing out bootpath
Modified: openbios-devel/arch/sparc32/boot.c
===================================================================
--- openbios-devel/arch/sparc32/boot.c 2008-09-29 17:20:02 UTC (rev 243)
+++ openbios-devel/arch/sparc32/boot.c 2008-11-02 19:25:05 UTC (rev 244)
@@ -41,12 +41,12 @@
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 @@
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);
Modified: openbios-devel/arch/sparc32/boot.h
===================================================================
--- openbios-devel/arch/sparc32/boot.h 2008-09-29 17:20:02 UTC (rev 243)
+++ openbios-devel/arch/sparc32/boot.h 2008-11-02 19:25:05 UTC (rev 244)
@@ -16,7 +16,7 @@
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;
Modified: openbios-devel/arch/sparc32/romvec.c
===================================================================
--- openbios-devel/arch/sparc32/romvec.c 2008-09-29 17:20:02 UTC (rev 243)
+++ openbios-devel/arch/sparc32/romvec.c 2008-11-02 19:25:05 UTC (rev 244)
@@ -50,6 +50,7 @@
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 @@
}
void *
-init_openprom(unsigned long memsize)
+init_openprom(unsigned long memsize, const char *path)
{
ptphys = totphys;
ptmap = totmap;
@@ -564,7 +565,12 @@
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;