locore.s (3258) | locore.s (3284) |
---|---|
1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: @(#)locore.s 7.3 (Berkeley) 5/13/91 | 1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: @(#)locore.s 7.3 (Berkeley) 5/13/91 |
37 * $Id: locore.s,v 1.29 1994/09/26 16:56:22 pst Exp $ | 37 * $Id: locore.s,v 1.30 1994/10/01 02:56:01 davidg Exp $ |
38 */ 39 40/* 41 * locore.s: FreeBSD machine support for the Intel 386 42 * originally from: locore.s, by William F. Jolitz 43 * 44 * Substantially rewritten by David Greenman, Rod Grimes, 45 * Bruce Evans, Wolfgang Solfrank, and many others. --- 74 unchanged lines hidden (view full) --- 120 121 .globl _KERNend 122_KERNend: .long 0 /* phys addr end of kernel (just after bss) */ 123 124 .globl _IdlePTD,_KPTphys 125_IdlePTD: .long 0 /* phys addr of kernel PTD */ 126_KPTphys: .long 0 /* phys addr of kernel page tables */ 127 | 38 */ 39 40/* 41 * locore.s: FreeBSD machine support for the Intel 386 42 * originally from: locore.s, by William F. Jolitz 43 * 44 * Substantially rewritten by David Greenman, Rod Grimes, 45 * Bruce Evans, Wolfgang Solfrank, and many others. --- 74 unchanged lines hidden (view full) --- 120 121 .globl _KERNend 122_KERNend: .long 0 /* phys addr end of kernel (just after bss) */ 123 124 .globl _IdlePTD,_KPTphys 125_IdlePTD: .long 0 /* phys addr of kernel PTD */ 126_KPTphys: .long 0 /* phys addr of kernel page tables */ 127 |
128 .globl _cyloffset 129_cyloffset: .long 0 /* cylinder offset from boot blocks */ 130 | |
131 .globl _proc0paddr 132_proc0paddr: .long 0 /* address of proc 0 address space */ 133 134#ifdef BDE_DEBUGGER 135 .globl _bdb_exists /* flag to indicate BDE debugger is available */ 136_bdb_exists: .long 0 137#endif 138#ifdef APM --- 17 unchanged lines hidden (view full) --- 156 157/* 158 * btext: beginning of text section. 159 * Also the entry point (jumped to directly from the boot blocks). 160 */ 161NON_GPROF_ENTRY(btext) 162 movw $0x1234,0x472 /* warm boot */ 163 jmp 1f | 128 .globl _proc0paddr 129_proc0paddr: .long 0 /* address of proc 0 address space */ 130 131#ifdef BDE_DEBUGGER 132 .globl _bdb_exists /* flag to indicate BDE debugger is available */ 133_bdb_exists: .long 0 134#endif 135#ifdef APM --- 17 unchanged lines hidden (view full) --- 153 154/* 155 * btext: beginning of text section. 156 * Also the entry point (jumped to directly from the boot blocks). 157 */ 158NON_GPROF_ENTRY(btext) 159 movw $0x1234,0x472 /* warm boot */ 160 jmp 1f |
161 /* 162 * XXX now that we load at 1MB is this still really used? 163 */ |
|
164 .org 0x500 /* space for BIOS variables */ 165 | 164 .org 0x500 /* space for BIOS variables */ 165 |
166 1: | 1661: |
167 /* Don't trust what the BIOS gives for eflags. */ 168 pushl $PSL_MBO 169 popfl 170 171 /* | 167 /* Don't trust what the BIOS gives for eflags. */ 168 pushl $PSL_MBO 169 popfl 170 171 /* |
172 * pass parameters on stack (howto, bootdev, unit, cyloffset, esym) 173 * note: (%esp) is return address of boot 174 * ( if we want to hold onto /boot, it's physical %esp up to _end) | 172 * This code is called in different ways depending on what loaded 173 * and started the kernel. This is used to detect how we get the 174 * arguments from the other code and what we do with them. 175 * 176 * Old disk boot blocks: 177 * (*btext)(howto, bootdev, cyloffset, esym); 178 * [return address == 0, and can NOT be returned to] 179 * [cyloffset was not supported by the FreeBSD boot code 180 * and always passed in as 0] 181 * [esym is also known as total in the boot code, and 182 * was never properly supported by the FreeBSD boot code] 183 * 184 * Old diskless netboot code: 185 * (*btext)(0,0,0,0,&nfsdiskless,0,0,0); 186 * [return address != 0, and can NOT be returned to] 187 * If we are being booted by this code it will NOT work, 188 * so we are just going to halt if we find this case. 189 * 190 * New uniform boot code: 191 * (*btext)(howto, bootdev, 0, 0, 0, &bootinfo) 192 * [return address != 0, and can be returned to] 193 * 194 * There may seem to be a lot of wasted arguments in here, but 195 * that is so the newer boot code can still load very old kernels. |
175 */ | 196 */ |
197 198 /* 199 * The old style disk boot blocks fake a frame on the stack and 200 * did an lret to get here. The frame on the stack has a return 201 * address of 0. 202 */ 203 cmpl $0,0x00(%esp) 204 je 2f /* olddiskboot: */ 205 206 /* 207 * We have some form of return address, so this is either the 208 * old diskless netboot code, or the new uniform code. That can 209 * be detected by looking at the 5th argument, it if is 0 we 210 * we are being booted by the new unifrom boot code. 211 */ 212 cmpl $0,0x14(%esp) 213 je 1f /* newboot: */ 214 215 /* 216 * Seems we have been loaded by the old diskless boot code, we 217 * don't stand a chance of running as the diskless structure 218 * changed considerably between the two, so just halt. 219 */ 220 hlt 221 222 /* 223 * We have been loaded by the new uniform boot code, this kernel 224 * is not yet ready to handle that, so for now fix up the stack 225 * like a real subroutine and then return to the boot loader with 226 * a status of 1 to indicate this error. 227 */ 2281: /* newboot: */ 229 pushl %ebp 230 movl %esp,%ebp 231 movl $1,%eax 232 leave 233 ret 234 235 /* 236 * The old style disk boot. 237 * (*btext)(howto, bootdev, cyloffset, esym); 238 * cyloffset is no longer copied 239 * XXX Is esym still used for the end of the kernel some place??? 240 * for now make sure we keep a correct value in it until I 241 * can deterimine that. 242 */ 2432: /* olddiskboot: */ |
|
176 movl 4(%esp),%eax 177 movl %eax,_boothowto-KERNBASE 178 movl 8(%esp),%eax 179 movl %eax,_bootdev-KERNBASE | 244 movl 4(%esp),%eax 245 movl %eax,_boothowto-KERNBASE 246 movl 8(%esp),%eax 247 movl %eax,_bootdev-KERNBASE |
180 movl 12(%esp),%eax 181 movl %eax,_cyloffset-KERNBASE | |
182 movl 16(%esp),%eax 183 addl $KERNBASE,%eax 184 movl %eax,_esym-KERNBASE 185 186 /* get the BIOS video mode pointer */ 187 movl $0x4a8, %ecx 188 movl (%ecx), %eax 189 movl %eax, %ecx --- 5 unchanged lines hidden (view full) --- 195 movl %eax, %ecx 196 shrl $12, %ecx 197 andl $0xffff0000, %ecx 198 andl $0x0000ffff, %eax 199 orl %ecx, %eax 200 addl $KERNBASE, %eax 201 movl %eax, _video_mode_ptr-KERNBASE 202 | 248 movl 16(%esp),%eax 249 addl $KERNBASE,%eax 250 movl %eax,_esym-KERNBASE 251 252 /* get the BIOS video mode pointer */ 253 movl $0x4a8, %ecx 254 movl (%ecx), %eax 255 movl %eax, %ecx --- 5 unchanged lines hidden (view full) --- 261 movl %eax, %ecx 262 shrl $12, %ecx 263 andl $0xffff0000, %ecx 264 andl $0x0000ffff, %eax 265 orl %ecx, %eax 266 addl $KERNBASE, %eax 267 movl %eax, _video_mode_ptr-KERNBASE 268 |
203#ifdef DISKLESS /* Copy diskless structure */ 204 movl _nfs_diskless_size-KERNBASE,%ecx 205 movl 20(%esp),%esi 206 movl $(_nfs_diskless-KERNBASE),%edi 207 cld 208 rep 209 movsb 210#endif | |
211#ifdef APM 212 /* 213 * Setup APM BIOS: 214 * 215 * APM BIOS initialization should be done from real mode or V86 mode. 216 * 217 * (by HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>) 218 */ --- 490 unchanged lines hidden --- | 269#ifdef APM 270 /* 271 * Setup APM BIOS: 272 * 273 * APM BIOS initialization should be done from real mode or V86 mode. 274 * 275 * (by HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>) 276 */ --- 490 unchanged lines hidden --- |