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 :-)
This commit is contained in:
Peter Wemm 1998-09-29 09:11:49 +00:00
parent 0c71101cb7
commit a7de32b2aa

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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> #include <sys/param.h>
@ -102,7 +102,7 @@ aout_exec(struct loaded_module *mp)
argv[2] = 0; /* old cyloffset */ argv[2] = 0; /* old cyloffset */
argv[3] = 0; /* old esym */ argv[3] = 0; /* old esym */
argv[4] = 0; /* "new" bootinfo magic */ 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 */ /* find the last module in the chain */
for (xp = mp; xp->m_next != NULL; xp = xp->m_next) 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; bi.bi_envp = addr;
addr = bi_copyenv(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 to a page boundary */
pad = (u_int)addr & PAGE_MASK; pad = (u_int)addr & PAGE_MASK;
if (pad != 0) { if (pad != 0) {
@ -130,6 +137,11 @@ aout_exec(struct loaded_module *mp)
/* all done copying stuff in, save end of loaded object space */ /* all done copying stuff in, save end of loaded object space */
bi.bi_kernend = addr; 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; entry = ehdr->a_entry & 0xffffff;
#ifdef DEBUG #ifdef DEBUG