summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-08-20 09:26:48 +0000
committerRoland McGrath <roland@gnu.org>2001-08-20 09:26:48 +0000
commitbf2db2b1a143ed4e38ddeb64570805131bbeee4d (patch)
tree60d6f8632fdf7a3dfcce7893180786af94ae96c1
parentbd4568df4e4ebfcd333a36c44afd58a8717a8722 (diff)
2001-08-18 Roland McGrath <roland@frob.com>
* i386/i386at/model_dep.c (boot_info): Define a struct, not a pointer. (c_boot_entry): Copy the contents into it rather than setting the ptr. (c_boot_entry, init_alloc_aligned, pmap_valid_page, mem_size_init): Update uses. (init_alloc_aligned): Don't need to skip the boot_info memory. * kern/bootstrap.c (boot_info): Update decl. (bootstrap_create): Update uses.
-rw-r--r--i386/i386at/model_dep.c50
-rw-r--r--kern/bootstrap.c10
2 files changed, 27 insertions, 33 deletions
diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
index f730c5b..1f7596c 100644
--- a/i386/i386at/model_dep.c
+++ b/i386/i386at/model_dep.c
@@ -65,7 +65,8 @@ vm_offset_t phys_last_addr;
/* Virtual address of physical memory, for the kvtophys/phystokv macros. */
vm_offset_t phys_mem_va;
-struct multiboot_info *boot_info;
+/* A copy of the multiboot info structure passed by the boot loader. */
+struct multiboot_info boot_info;
/* Command line supplied to kernel. */
char *kernel_cmdline = "";
@@ -203,9 +204,9 @@ mem_size_init()
XX make it a constant. */
phys_first_addr = 0;
- phys_last_addr = 0x100000 + (boot_info->mem_upper * 0x400);
+ phys_last_addr = 0x100000 + (boot_info.mem_upper * 0x400);
avail_remaining
- = phys_last_addr - (0x100000 - (boot_info->mem_lower * 0x400)
+ = phys_last_addr - (0x100000 - (boot_info.mem_lower * 0x400)
- 0x1000);
printf("AT386 boot: physical memory from 0x%x to 0x%x\n",
@@ -295,7 +296,7 @@ i386at_init()
void c_boot_entry(vm_offset_t bi)
{
/* Stash the boot_image_info pointer. */
- boot_info = (struct multiboot_info*)phystokv(bi);
+ boot_info = *(struct multiboot_info*)phystokv(bi);
/* XXX we currently assume phys_mem_va is always 0 here -
if it isn't, we must tweak the pointers in the boot_info. */
@@ -307,8 +308,8 @@ void c_boot_entry(vm_offset_t bi)
printf("\n");
/* Find the kernel command line, if there is one. */
- if (boot_info->flags & MULTIBOOT_CMDLINE)
- kernel_cmdline = (char*)phystokv(boot_info->cmdline);
+ if (boot_info.flags & MULTIBOOT_CMDLINE)
+ kernel_cmdline = (char*)phystokv(boot_info.cmdline);
#if MACH_KDB
/*
@@ -316,14 +317,14 @@ void c_boot_entry(vm_offset_t bi)
* We need to do this before i386at_init()
* so that the symbol table's memory won't be stomped on.
*/
- if ((boot_info->flags & MULTIBOOT_AOUT_SYMS)
- && boot_info->syms.a.addr)
+ if ((boot_info.flags & MULTIBOOT_AOUT_SYMS)
+ && boot_info.syms.a.addr)
{
vm_size_t symtab_size, strtab_size;
- kern_sym_start = (vm_offset_t)phystokv(boot_info->syms.a.addr);
- symtab_size = (vm_offset_t)phystokv(boot_info->syms.a.tabsize);
- strtab_size = (vm_offset_t)phystokv(boot_info->syms.a.strsize);
+ kern_sym_start = (vm_offset_t)phystokv(boot_info.syms.a.addr);
+ symtab_size = (vm_offset_t)phystokv(boot_info.syms.a.tabsize);
+ strtab_size = (vm_offset_t)phystokv(boot_info.syms.a.strsize);
kern_sym_end = kern_sym_start + 4 + symtab_size + strtab_size;
printf("kernel symbol table at %08x-%08x (%d,%d)\n",
@@ -451,18 +452,16 @@ init_alloc_aligned(vm_size_t size, vm_offset_t *addrp)
int i;
/* Memory regions to skip. */
- vm_offset_t boot_info_start_pa = kvtophys(boot_info);
- vm_offset_t boot_info_end_pa = boot_info_start_pa + sizeof(*boot_info);
- vm_offset_t cmdline_start_pa = boot_info->flags & MULTIBOOT_CMDLINE
- ? boot_info->cmdline : 0;
+ vm_offset_t cmdline_start_pa = boot_info.flags & MULTIBOOT_CMDLINE
+ ? boot_info.cmdline : 0;
vm_offset_t cmdline_end_pa = cmdline_start_pa
? cmdline_start_pa+strlen((char*)phystokv(cmdline_start_pa))+1
: 0;
- vm_offset_t mods_start_pa = boot_info->flags & MULTIBOOT_MODS
- ? boot_info->mods_addr : 0;
+ vm_offset_t mods_start_pa = boot_info.flags & MULTIBOOT_MODS
+ ? boot_info.mods_addr : 0;
vm_offset_t mods_end_pa = mods_start_pa
? mods_start_pa
- + boot_info->mods_count * sizeof(struct multiboot_module)
+ + boot_info.mods_count * sizeof(struct multiboot_module)
: 0;
retry:
@@ -482,7 +481,7 @@ init_alloc_aligned(vm_size_t size, vm_offset_t *addrp)
avail_next += size;
/* Skip past the I/O and ROM area. */
- if ((avail_next > (boot_info->mem_lower * 0x400)) && (addr < 0x100000))
+ if ((avail_next > (boot_info.mem_lower * 0x400)) && (addr < 0x100000))
{
avail_next = 0x100000;
goto retry;
@@ -501,11 +500,6 @@ init_alloc_aligned(vm_size_t size, vm_offset_t *addrp)
}
/* Skip any areas occupied by valuable boot_info data. */
- if ((avail_next > boot_info_start_pa) && (addr < boot_info_end_pa))
- {
- avail_next = boot_info_end_pa;
- goto retry;
- }
if ((avail_next > cmdline_start_pa) && (addr < cmdline_end_pa))
{
avail_next = cmdline_end_pa;
@@ -521,11 +515,11 @@ init_alloc_aligned(vm_size_t size, vm_offset_t *addrp)
avail_next = kern_sym_end;
goto retry;
}
- if (boot_info->flags & MULTIBOOT_MODS)
+ if (boot_info.flags & MULTIBOOT_MODS)
{
struct multiboot_module *m = (struct multiboot_module *)
- phystokv(boot_info->mods_addr);
- for (i = 0; i < boot_info->mods_count; i++)
+ phystokv(boot_info.mods_addr);
+ for (i = 0; i < boot_info.mods_count; i++)
{
if ((avail_next > m[i].mod_start)
&& (addr < m[i].mod_end))
@@ -566,7 +560,7 @@ boolean_t pmap_valid_page(x)
{
/* XXX is this OK? What does it matter for? */
return (((phys_first_addr <= x) && (x < phys_last_addr)) &&
- !(((boot_info->mem_lower * 1024) <= x) && (x < 1024*1024)));
+ !(((boot_info.mem_lower * 1024) <= x) && (x < 1024*1024)));
}
#ifndef NBBY
diff --git a/kern/bootstrap.c b/kern/bootstrap.c
index 159276b..39a039d 100644
--- a/kern/bootstrap.c
+++ b/kern/bootstrap.c
@@ -57,7 +57,7 @@
static mach_port_t boot_device_port; /* local name */
static mach_port_t boot_host_port; /* local name */
-extern struct multiboot_info *boot_info;
+extern struct multiboot_info boot_info;
extern char *kernel_cmdline;
static void user_bootstrap(); /* forward */
@@ -87,12 +87,12 @@ void bootstrap_create()
{
struct multiboot_module *bmod;
- if (!(boot_info->flags & MULTIBOOT_MODS)
- || (boot_info->mods_count == 0))
+ if (!(boot_info.flags & MULTIBOOT_MODS)
+ || (boot_info.mods_count == 0))
panic("No bootstrap code loaded with the kernel!");
- if (boot_info->mods_count > 1)
+ if (boot_info.mods_count > 1)
printf("Warning: only one boot module currently used by Mach\n");
- bmod = (struct multiboot_module *)phystokv(boot_info->mods_addr);
+ bmod = (struct multiboot_module *)phystokv(boot_info.mods_addr);
bootstrap_exec((void*)phystokv(bmod->mod_start));
/* XXX at this point, we could free all the memory used