| version 1.37, 2006/02/03 11:08:24 |
version 1.38, 2006/04/12 13:48:52 |
|
|
| #include <machine/segments.h> |
#include <machine/segments.h> |
| #include <machine/specialreg.h> |
#include <machine/specialreg.h> |
| #include <machine/trap.h> |
#include <machine/trap.h> |
| #include <machine/bootinfo.h> |
|
| |
|
| #if NLAPIC > 0 |
#if NLAPIC > 0 |
| #include <machine/i82489reg.h> |
#include <machine/i82489reg.h> |
|
|
| .data |
.data |
| |
|
| .globl _C_LABEL(cpu) |
.globl _C_LABEL(cpu) |
| .globl _C_LABEL(esym),_C_LABEL(boothowto) |
.globl _C_LABEL(esym) |
| .globl _C_LABEL(bootinfo),_C_LABEL(atdevbase) |
.globl _C_LABEL(atdevbase) |
| #ifdef COMPAT_OLDBOOT |
|
| .globl _C_LABEL(bootdev) |
|
| #endif |
|
| .globl _C_LABEL(proc0paddr),_C_LABEL(PDPpaddr) |
.globl _C_LABEL(proc0paddr),_C_LABEL(PDPpaddr) |
| .globl _C_LABEL(biosbasemem),_C_LABEL(biosextmem) |
|
| .globl _C_LABEL(gdt) |
.globl _C_LABEL(gdt) |
| #ifdef I586_CPU |
#ifdef I586_CPU |
| .globl _C_LABEL(idt) |
.globl _C_LABEL(idt) |
| Line 197 _C_LABEL(lapic_tpr): |
|
| Line 192 _C_LABEL(lapic_tpr): |
|
| |
|
| _C_LABEL(cpu): .long 0 # are we 386, 386sx, or 486, |
_C_LABEL(cpu): .long 0 # are we 386, 386sx, or 486, |
| # or Pentium, or.. |
# or Pentium, or.. |
| _C_LABEL(esym): .long 0 # ptr to end of syms |
|
| _C_LABEL(atdevbase): .long 0 # location of start of iomem in virtual |
_C_LABEL(atdevbase): .long 0 # location of start of iomem in virtual |
| _C_LABEL(proc0paddr): .long 0 |
_C_LABEL(proc0paddr): .long 0 |
| _C_LABEL(PDPpaddr): .long 0 # paddr of PDP, for libkvm |
_C_LABEL(PDPpaddr): .long 0 # paddr of PDP, for libkvm |
| #ifndef REALBASEMEM |
|
| _C_LABEL(biosbasemem): .long 0 # base memory reported by BIOS |
|
| #else |
|
| _C_LABEL(biosbasemem): .long REALBASEMEM |
|
| #endif |
|
| #ifndef REALEXTMEM |
|
| _C_LABEL(biosextmem): .long 0 # extended memory reported by BIOS |
|
| #else |
|
| _C_LABEL(biosextmem): .long REALEXTMEM |
|
| #endif |
|
| |
|
| .space 512 |
.space 512 |
| tmpstk: |
tmpstk: |
| Line 256 _C_LABEL(Multiboot_Header): |
|
| Line 240 _C_LABEL(Multiboot_Header): |
|
| pushl %ebx # Address of Multiboot information |
pushl %ebx # Address of Multiboot information |
| call _C_LABEL(multiboot_pre_reloc) |
call _C_LABEL(multiboot_pre_reloc) |
| addl $4,%esp |
addl $4,%esp |
| jmp 3f |
jmp 2f |
| #endif |
#endif |
| |
|
| 1: |
1: |
| /* |
/* |
| * Load parameters from stack |
* At this point, we know that a NetBSD-specific boot loader |
| * (howto, [bootdev], bootinfo, esym, basemem, extmem). |
* booted this kernel. The stack carries the following parameters: |
| |
* (boothowto, [bootdev], bootinfo, esym, biosbasemem, biosextmem), |
| |
* 4 bytes each. |
| */ |
*/ |
| movl 4(%esp),%eax |
addl $4,%esp # Discard return address to boot loader |
| movl %eax,RELOC(boothowto) |
call _C_LABEL(native_loader) |
| #ifdef COMPAT_OLDBOOT |
addl $24,%esp |
| movl 8(%esp),%eax |
|
| movl %eax,RELOC(bootdev) |
|
| #endif |
|
| movl 12(%esp),%eax |
|
| |
|
| testl %eax, %eax |
|
| jz 1f |
|
| movl (%eax), %ebx /* number of entries */ |
|
| movl $RELOC(bootinfo), %edi |
|
| movl %ebx, (%edi) |
|
| addl $4, %edi |
|
| 2: |
2: |
| testl %ebx, %ebx |
|
| jz 1f |
|
| addl $4, %eax |
|
| movl (%eax), %ecx /* address of entry */ |
|
| pushl %eax |
|
| pushl (%ecx) /* len */ |
|
| pushl %ecx |
|
| pushl %edi |
|
| addl (%ecx), %edi /* update dest pointer */ |
|
| cmpl $_RELOC(_C_LABEL(bootinfo) + BOOTINFO_MAXSIZE), %edi |
|
| jg 2f |
|
| call _C_LABEL(memcpy) |
|
| addl $12, %esp |
|
| popl %eax |
|
| subl $1, %ebx |
|
| jmp 2b |
|
| 2: /* cleanup for overflow case */ |
|
| addl $16, %esp |
|
| movl $RELOC(bootinfo), %edi |
|
| subl %ebx, (%edi) /* correct number of entries */ |
|
| 1: |
|
| |
|
| movl 16(%esp),%eax |
|
| testl %eax,%eax |
|
| jz 1f |
|
| addl $KERNBASE,%eax |
|
| 1: movl %eax,RELOC(esym) |
|
| |
|
| movl RELOC(biosextmem),%eax |
|
| testl %eax,%eax |
|
| jnz 1f |
|
| movl 20(%esp),%eax |
|
| movl %eax,RELOC(biosextmem) |
|
| 1: |
|
| movl RELOC(biosbasemem),%eax |
|
| testl %eax,%eax |
|
| jnz 1f |
|
| movl 24(%esp),%eax |
|
| movl %eax,RELOC(biosbasemem) |
|
| 1: |
|
| |
|
| 3: |
|
| /* First, reset the PSL. */ |
/* First, reset the PSL. */ |
| pushl $PSL_MBO |
pushl $PSL_MBO |
| popfl |
popfl |