From f8e7d10b85514bec7a8d6c91c901756a72cf26f2 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Sat, 20 May 2006 22:40:47 +0000 Subject: Let the bootloader pass esym to the kernel, and let the kernel make good use of this if it finds out it has not been directly loaded by the PROM; not tested yet. --- sys/arch/aviion/aviion/locore.S | 20 ++++++++++++++------ sys/arch/aviion/aviion/machdep.c | 11 +++++++++-- sys/arch/aviion/stand/libsa/exec_aout.c | 6 +++--- 3 files changed, 26 insertions(+), 11 deletions(-) (limited to 'sys') diff --git a/sys/arch/aviion/aviion/locore.S b/sys/arch/aviion/aviion/locore.S index c8e7945c5f2..3b9ef76b003 100644 --- a/sys/arch/aviion/aviion/locore.S +++ b/sys/arch/aviion/aviion/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.2 2006/05/20 11:57:02 miod Exp $ */ +/* $OpenBSD: locore.S,v 1.3 2006/05/20 22:40:43 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat. * Copyright (c) 1998 Steve Murphree, Jr. @@ -68,11 +68,8 @@ #include #include -/* - * The memory looks like: - * 0x0000 - 0x1000 trap vectors - * 0x1000 == start Boot loader jumps here. - */ +#define SYM_MAGIC 0x6274ef2e + text GLOBAL(kernelstart) @@ -97,6 +94,8 @@ ASLOCAL(main_start) * r3 boot device * r4 boot unit number * r5 boot partition number + * r6 magic number if not loaded by the PROM + * r7 end of loaded binary if not loaded by the PROM */ or.u r13, r0, hi16(_C_LABEL(prom_bootargs)) st r2, r13, lo16(_C_LABEL(prom_bootargs)) @@ -106,6 +105,15 @@ ASLOCAL(main_start) st r4, r13, lo16(_C_LABEL(bootunit)) or.u r13, r0, hi16(_C_LABEL(bootpart)) st r5, r13, lo16(_C_LABEL(bootpart)) +#if defined(DDB) || NKSYMS > 0 + or.u r12, r0, hi16(SYM_MAGIC) + or r12, r12, lo16(SYM_MAGIC) + cmp r2, r6, r12 + bcnd ne0, r2, 1f + or.u r13, r0, hi16(_C_LABEL(esym)) + st r7, r13, lo16(_C_LABEL(esym)) +1: +#endif /* set cputyp */ ldcr r1, PID diff --git a/sys/arch/aviion/aviion/machdep.c b/sys/arch/aviion/aviion/machdep.c index 4cbca926d1e..582abb93623 100644 --- a/sys/arch/aviion/aviion/machdep.c +++ b/sys/arch/aviion/aviion/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.3 2006/05/20 12:04:51 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.4 2006/05/20 22:40:43 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -864,7 +864,14 @@ aviion_bootstrap() uvmexp.pagesize = PAGE_SIZE; uvm_setpagesize(); - first_addr = round_page((vaddr_t)&end); /* XXX temp until symbols */ +#if defined(DDB) || NKSYMS > 0 + if (esym != 0) + first_addr = esym; + else +#endif + first_addr = (vaddr_t)&end; + first_addr = round_page(first_addr); + last_addr = platform->memsize(); physmem = btoc(last_addr); diff --git a/sys/arch/aviion/stand/libsa/exec_aout.c b/sys/arch/aviion/stand/libsa/exec_aout.c index a2f6495d9a2..300bf900284 100644 --- a/sys/arch/aviion/stand/libsa/exec_aout.c +++ b/sys/arch/aviion/stand/libsa/exec_aout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_aout.c,v 1.1 2006/05/16 22:48:18 miod Exp $ */ +/* $OpenBSD: exec_aout.c,v 1.2 2006/05/20 22:40:46 miod Exp $ */ /*- * Copyright (c) 1982, 1986, 1990, 1993 @@ -39,7 +39,7 @@ #include "stand.h" #include "libsa.h" -#define SYM_MAGIC 0x6274ef2d +#define SYM_MAGIC 0x6274ef2e /*ARGSUSED*/ void @@ -160,7 +160,7 @@ exec_aout(char *file, const char *args, int bootdev, int bootunit, int bootpart) printf("=0x%lx\n", cp - loadaddr); close(io); - (*entry)(args, bootdev, bootunit, bootpart, SYM_MAGIC); + (*entry)(args, bootdev, bootunit, bootpart, SYM_MAGIC, cp); printf("exec: kernel returned!\n"); return; -- cgit v1.2.3