From 7893e8faf13abf70ec0a01891c9c5fba6eed3975 Mon Sep 17 00:00:00 2001 From: neil Date: Sun, 17 Dec 2006 02:38:43 +0000 Subject: [PATCH] Exec didn't supply new boot parameters to bootloader.resource if the old parameters were still in memory. This is a fix for the previous attempt to fix this bug. The previous attempt broke soft rebooting. Also, the move of the multiboot header to bootloader.resource (a few months ago) has been tidied up, with associated comments moved and updated etc. git-svn-id: https://svn.aros.org:8080/svn/aros/trunk/AROS@25088 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- arch/i386-pc/bootloader/bootloader_init.c | 14 +++- arch/i386-pc/exec/exec_init.c | 125 ++++++++++++------------------ 2 files changed, 58 insertions(+), 81 deletions(-) diff --git a/arch/i386-pc/bootloader/bootloader_init.c b/arch/i386-pc/bootloader/bootloader_init.c index 27f175bfe..0d389c337 100644 --- a/arch/i386-pc/bootloader/bootloader_init.c +++ b/arch/i386-pc/bootloader/bootloader_init.c @@ -23,6 +23,15 @@ #include +/* + * What you see here is a Multiboot-compatible header. We don't need a + * sophisticated information package from the multiboot loader. + * + * AROS defines only the first three fields as it is now in ELF executable + * format. All other things like load address or entry point are already + * in the kernel image. + */ + #define MB_MAGIC 0x1BADB002 /* Magic value */ #define MB_FLAGS 0x00000003 /* Need 4KB alignment for modules */ @@ -45,7 +54,7 @@ static int GM_UNIQUENAME(Init)(LIBBASETYPEPTR BootLoaderBase) NEWLIST(&(BootLoaderBase->Args)); NEWLIST(&(BootLoaderBase->DriveInfo)); - /* Right. Now we extract the data currently placed in 0x1000 */ + /* Right. Now we extract the data currently placed in 0x1000 by exec */ if (mb->magic == MBRAM_VALID) { /* Yay. There is data here */ @@ -154,9 +163,6 @@ static int GM_UNIQUENAME(Init)(LIBBASETYPEPTR BootLoaderBase) } BootLoaderBase->Flags |= MB_FLAGS_DRIVES; } - - /* Ensure info is updated on next boot */ - mb->magic = 0; } return TRUE; } diff --git a/arch/i386-pc/exec/exec_init.c b/arch/i386-pc/exec/exec_init.c index 6019e38a8..53d2a0b52 100644 --- a/arch/i386-pc/exec/exec_init.c +++ b/arch/i386-pc/exec/exec_init.c @@ -2,7 +2,7 @@ Copyright © 1995-2001, The AROS Development Team. All rights reserved. $Id$ - Desc: Kernel header and early bootup section + Desc: Early bootup section Lang: english */ @@ -193,32 +193,6 @@ asm( ".globl aros_intern\n\t" * are off, CPU is working in Supervisor level (CPL0). This state can be emu- * lated by ColdReboot() routine as it may freely use Supervisor() * - * What you see here is Multibot-compatible header. We don't need sophisticated - * information package from multiboot loader - * - * AROS defines only first three fields as it is now in ELF executable format - * with all other things like load address or entry point are already in kernel - * image - */ - -#if 0 -#define MB_MAGIC 0x1BADB002 /* Magic value */ -#define MB_FLAGS 0x00000003 /* Need 4KB alignment for modules */ - -const struct -{ - ULONG magic; - ULONG flags; - ULONG chksum; -} multiboot_header __text = -{ - MB_MAGIC, - MB_FLAGS, - -(MB_MAGIC+MB_FLAGS) -}; -#endif - -/* * kernel_startup can be executed only from CPL0 without vmm. Interrupts should * be disabled. * @@ -279,7 +253,7 @@ asm("\nexec_init: \n\t" "cld \n\t" /* At the startup it's very important */ "cli \n\t" /* to lock all interrupts. Both on the */ - "movb $-1,%al \n\t" /* CPU side and hardwre side. We don't */ + "movb $-1,%al \n\t" /* CPU side and hardware side. We don't */ "outb %al,$0x21 \n\t" /* have proper structures in RAM yet. */ "outb %al,$0xa1 \n\n\t" @@ -453,55 +427,52 @@ void exec_cinit(unsigned long magic, unsigned long addr) * safe, and also since we will use some of it in here. */ arosmb = (struct arosmb *)0x1000; - if (arosmb->magic != MBRAM_VALID) + if (magic == 0x2badb002) { - if (magic == 0x2badb002) - { - rkprintf("Copying multiboot information into storage\n"); - arosmb->magic = MBRAM_VALID; - arosmb->flags = 0L; - mbinfo = (struct multiboot *)addr; - if (mbinfo->flags & MB_FLAGS_MEM) - { - arosmb->flags |= MB_FLAGS_MEM; - arosmb->mem_lower = mbinfo->mem_lower; - arosmb->mem_upper = mbinfo->mem_upper; - } - if (mbinfo->flags & MB_FLAGS_LDRNAME) - { - arosmb->flags |= MB_FLAGS_LDRNAME; - snprintf(arosmb->ldrname,29,"%s",mbinfo->loader_name); - } - if (mbinfo->flags & MB_FLAGS_CMDLINE) - { - arosmb->flags |= MB_FLAGS_CMDLINE; - snprintf(arosmb->cmdline,199,"%s",mbinfo->cmdline); - } - if (mbinfo->flags & MB_FLAGS_MMAP) - { - arosmb->flags |= MB_FLAGS_MMAP; - arosmb->mmap_addr = (struct mb_mmap *)((ULONG)(0x1000 + sizeof(struct arosmb))); - arosmb->mmap_len = mbinfo->mmap_length; - memcpy((void *)arosmb->mmap_addr,(void *)mbinfo->mmap_addr,mbinfo->mmap_length); - } - if (mbinfo->flags & MB_FLAGS_DRIVES) - { - if (mbinfo->drives_length > 0) - { - arosmb->flags |= MB_FLAGS_DRIVES; - arosmb->drives_addr = ((ULONG)(arosmb->mmap_addr + arosmb->mmap_len)); - arosmb->drives_len = mbinfo->drives_length; - memcpy((void *)arosmb->drives_addr,(void *)mbinfo->drives_addr,mbinfo->drives_length); - } - } - if (mbinfo->flags & MB_FLAGS_GFX) - { - arosmb->flags |= MB_FLAGS_GFX; - arosmb->vbe_mode = mbinfo->vbe_mode; - memcpy((void *)&arosmb->vmi,(void *)mbinfo->vbe_mode_info,sizeof(struct vbe_mode)); - memcpy((void *)&arosmb->vci,(void *)mbinfo->vbe_control_info,sizeof(struct vbe_controller)); + rkprintf("Copying multiboot information into storage\n"); + arosmb->magic = MBRAM_VALID; + arosmb->flags = 0L; + mbinfo = (struct multiboot *)addr; + if (mbinfo->flags & MB_FLAGS_MEM) + { + arosmb->flags |= MB_FLAGS_MEM; + arosmb->mem_lower = mbinfo->mem_lower; + arosmb->mem_upper = mbinfo->mem_upper; + } + if (mbinfo->flags & MB_FLAGS_LDRNAME) + { + arosmb->flags |= MB_FLAGS_LDRNAME; + snprintf(arosmb->ldrname,29,"%s",mbinfo->loader_name); + } + if (mbinfo->flags & MB_FLAGS_CMDLINE) + { + arosmb->flags |= MB_FLAGS_CMDLINE; + snprintf(arosmb->cmdline,199,"%s",mbinfo->cmdline); + } + if (mbinfo->flags & MB_FLAGS_MMAP) + { + arosmb->flags |= MB_FLAGS_MMAP; + arosmb->mmap_addr = (struct mb_mmap *)((ULONG)(0x1000 + sizeof(struct arosmb))); + arosmb->mmap_len = mbinfo->mmap_length; + memcpy((void *)arosmb->mmap_addr,(void *)mbinfo->mmap_addr,mbinfo->mmap_length); + } + if (mbinfo->flags & MB_FLAGS_DRIVES) + { + if (mbinfo->drives_length > 0) + { + arosmb->flags |= MB_FLAGS_DRIVES; + arosmb->drives_addr = ((ULONG)(arosmb->mmap_addr + arosmb->mmap_len)); + arosmb->drives_len = mbinfo->drives_length; + memcpy((void *)arosmb->drives_addr,(void *)mbinfo->drives_addr,mbinfo->drives_length); } - } + } + if (mbinfo->flags & MB_FLAGS_GFX) + { + arosmb->flags |= MB_FLAGS_GFX; + arosmb->vbe_mode = mbinfo->vbe_mode; + memcpy((void *)&arosmb->vmi,(void *)mbinfo->vbe_mode_info,sizeof(struct vbe_mode)); + memcpy((void *)&arosmb->vci,(void *)mbinfo->vbe_control_info,sizeof(struct vbe_controller)); + } } rkprintf("Done\n"); @@ -513,8 +484,8 @@ void exec_cinit(unsigned long magic, unsigned long addr) * Well, if we all in clearing moode, then it's the best occasion to clear * some areas in AROS private 4KB ram area. Hmmm. If there would occur any * interrupt at this moment, AROS would be really dead as it is going to - * destroy it's private stuff (which is really needed to make CPU operate - * propertly) + * destroy its private stuff (which is really needed to make CPU operate + * properly) */ bzero((void *)8, 4096-8); -- 2.11.4.GIT