summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-09-29 09:11:49 +0000
committerpeter <peter@FreeBSD.org>1998-09-29 09:11:49 +0000
commitfc873fcda41ef862b9fe18861f39573f01bb5436 (patch)
treebbd7bb8dbd082984d63ea54783d9dc4c036bbaa6
parentdc111a9a45b6729445db9b8caa530ca6c1406d62 (diff)
downloadFreeBSD-src-fc873fcda41ef862b9fe18861f39573f01bb5436.zip
FreeBSD-src-fc873fcda41ef862b9fe18861f39573f01bb5436.tar.gz
The bootinfo struct was getting clobbered or not passed through correctly.
Presumably VTOP doesn't work for static objects. The easiest way to get it working was to reserve some space after the environment strings and copy the bootinfo struct there. Also, set RB_BOOTINFO, it's needed. I got the code to load and run an unmolested kernel OK for the first time with this system a few minutes ago - at last!. I did have to stop it looking at the floppy though as BTX was trapping a mode 14 fault when it look for /boot/boot.conf when no disk was in the drive. (I'm booting from a scsi disk (bios disk 0x80)). Now to teach it about ELF and modules :-)
-rw-r--r--sys/boot/i386/libi386/aout_freebsd.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/boot/i386/libi386/aout_freebsd.c b/sys/boot/i386/libi386/aout_freebsd.c
index 1c709a7..5b191e8 100644
--- a/sys/boot/i386/libi386/aout_freebsd.c
+++ b/sys/boot/i386/libi386/aout_freebsd.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: aout_freebsd.c,v 1.4 1998/09/17 23:52:07 msmith Exp $
+ * $Id: aout_freebsd.c,v 1.5 1998/09/28 22:01:19 peter Exp $
*/
#include <sys/param.h>
@@ -102,7 +102,7 @@ aout_exec(struct loaded_module *mp)
argv[2] = 0; /* old cyloffset */
argv[3] = 0; /* old esym */
argv[4] = 0; /* "new" bootinfo magic */
- argv[5] = (u_int32_t)VTOP(&bi);
+ argv[5] = 0; /* physical addr of bootinfo */
/* find the last module in the chain */
for (xp = mp; xp->m_next != NULL; xp = xp->m_next)
@@ -118,6 +118,13 @@ aout_exec(struct loaded_module *mp)
bi.bi_envp = addr;
addr = bi_copyenv(addr);
+ /* pad to a 4-byte boundary */
+ addr = (addr + 0x3) & ~0x3;
+
+ /* leave space for bootinfo */
+ argv[5] = (u_int32_t)addr;
+ addr += sizeof(struct bootinfo);
+
/* pad to a page boundary */
pad = (u_int)addr & PAGE_MASK;
if (pad != 0) {
@@ -130,6 +137,11 @@ aout_exec(struct loaded_module *mp)
/* all done copying stuff in, save end of loaded object space */
bi.bi_kernend = addr;
+
+ /* and insert bootinfo struct into reserved spot */
+ i386_copyin(&bi, (vm_offset_t)argv[5], sizeof(bi));
+ argv[0] |= RB_BOOTINFO; /* it's there now */
+
entry = ehdr->a_entry & 0xffffff;
#ifdef DEBUG
OpenPOWER on IntegriCloud