locore.s revision 38063
14Srgrimes/*- 24Srgrimes * Copyright (c) 1990 The Regents of the University of California. 34Srgrimes * All rights reserved. 44Srgrimes * 54Srgrimes * This code is derived from software contributed to Berkeley by 64Srgrimes * William Jolitz. 74Srgrimes * 84Srgrimes * Redistribution and use in source and binary forms, with or without 94Srgrimes * modification, are permitted provided that the following conditions 104Srgrimes * are met: 114Srgrimes * 1. Redistributions of source code must retain the above copyright 124Srgrimes * notice, this list of conditions and the following disclaimer. 134Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 144Srgrimes * notice, this list of conditions and the following disclaimer in the 154Srgrimes * documentation and/or other materials provided with the distribution. 164Srgrimes * 3. All advertising materials mentioning features or use of this software 174Srgrimes * must display the following acknowledgement: 184Srgrimes * This product includes software developed by the University of 194Srgrimes * California, Berkeley and its contributors. 204Srgrimes * 4. Neither the name of the University nor the names of its contributors 214Srgrimes * may be used to endorse or promote products derived from this software 224Srgrimes * without specific prior written permission. 234Srgrimes * 244Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 254Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 264Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 274Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 284Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 294Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 304Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 314Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 324Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 334Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 344Srgrimes * SUCH DAMAGE. 354Srgrimes * 36556Srgrimes * from: @(#)locore.s 7.3 (Berkeley) 5/13/91 3738063Smsmith * $Id: locore.s,v 1.111 1998/07/27 16:45:01 jlemon Exp $ 3815392Sphk * 39757Sdg * originally from: locore.s, by William F. Jolitz 40757Sdg * 41757Sdg * Substantially rewritten by David Greenman, Rod Grimes, 4215392Sphk * Bruce Evans, Wolfgang Solfrank, Poul-Henning Kamp 4315392Sphk * and many others. 444Srgrimes */ 454Srgrimes 4614835Sbde#include "apm.h" 4732358Seivind#include "opt_bootp.h" 4813228Swollman#include "opt_ddb.h" 4937272Sjmg#include "opt_nfsroot.h" 5018702Sjkh#include "opt_userconfig.h" 5130265Speter#include "opt_vm86.h" 5214835Sbde 5314835Sbde#include <sys/syscall.h> 545908Sbde#include <sys/reboot.h> 554Srgrimes 5614835Sbde#include <machine/asmacros.h> 5714835Sbde#include <machine/cputypes.h> 5814835Sbde#include <machine/psl.h> 5915543Sphk#include <machine/pmap.h> 6014835Sbde#include <machine/specialreg.h> 6114835Sbde 6214835Sbde#include "assym.s" 6314835Sbde 644Srgrimes/* 65757Sdg * XXX 66757Sdg * 674Srgrimes * Note: This version greatly munged to avoid various assembler errors 684Srgrimes * that may be fixed in newer versions of gas. Perhaps newer versions 694Srgrimes * will have more pleasant appearance. 704Srgrimes */ 714Srgrimes 72200Sdg/* 734Srgrimes * PTmap is recursive pagemap at top of virtual address space. 744Srgrimes * Within PTmap, the page directory can be found (third indirection). 754Srgrimes */ 763861Sbde .globl _PTmap,_PTD,_PTDpde 7715543Sphk .set _PTmap,(PTDPTDI << PDRSHIFT) 7815543Sphk .set _PTD,_PTmap + (PTDPTDI * PAGE_SIZE) 79757Sdg .set _PTDpde,_PTD + (PTDPTDI * PDESIZE) 80592Srgrimes 813861Sbde/* 824Srgrimes * APTmap, APTD is the alternate recursive pagemap. 834Srgrimes * It's used when modifying another process's page tables. 844Srgrimes */ 85592Srgrimes .globl _APTmap,_APTD,_APTDpde 86592Srgrimes .set _APTmap,APTDPTDI << PDRSHIFT 8715543Sphk .set _APTD,_APTmap + (APTDPTDI * PAGE_SIZE) 88757Sdg .set _APTDpde,_PTD + (APTDPTDI * PDESIZE) 894Srgrimes 904Srgrimes/* 91556Srgrimes * Globals 92556Srgrimes */ 93556Srgrimes .data 9414835Sbde ALIGN_DATA /* just to be sure */ 95134Sdg 9625083Sjdp .globl HIDENAME(tmpstk) 9713729Sdg .space 0x2000 /* space for tmpstk - temporary stack */ 9825083SjdpHIDENAME(tmpstk): 993842Sdg 1003861Sbde .globl _boothowto,_bootdev 101134Sdg 10215565Sphk .globl _cpu,_cpu_vendor,_cpu_id,_bootinfo 1036308Sphk .globl _cpu_high, _cpu_feature 1042783Ssos 105757Sdg_cpu: .long 0 /* are we 386, 386sx, or 486 */ 1062216Sbde_cpu_id: .long 0 /* stepping ID */ 1076308Sphk_cpu_high: .long 0 /* highest arg to CPUID */ 1086308Sphk_cpu_feature: .long 0 /* features */ 1092216Sbde_cpu_vendor: .space 20 /* CPU origin code */ 1105908Sbde_bootinfo: .space BOOTINFO_SIZE /* bootinfo that we can handle */ 1114Srgrimes 112757Sdg_KERNend: .long 0 /* phys addr end of kernel (just after bss) */ 11315428Sphkphysfree: .long 0 /* phys addr of next free page */ 114757Sdg 11526812Speter#ifdef SMP 11625164Spetercpu0pp: .long 0 /* phys addr cpu0 private pg */ 11725164Spetercpu0pt: .long 0 /* phys addr cpu0 private pt */ 11825164Speter 11925164Speter .globl _cpu0prvpage,_cpu0prvpt 12025164Speter_cpu0prvpage: .long 0 /* relocated version */ 12125164Speter_cpu0prvpt: .long 0 /* relocated version */ 12226812Speter#endif /* SMP */ 12325164Speter 1243861Sbde .globl _IdlePTD 125757Sdg_IdlePTD: .long 0 /* phys addr of kernel PTD */ 1263861Sbde 12726812Speter#ifdef SMP 12826812Speter .globl _KPTphys 12926812Speter#endif 130757Sdg_KPTphys: .long 0 /* phys addr of kernel page tables */ 1314Srgrimes 132757Sdg .globl _proc0paddr 133757Sdg_proc0paddr: .long 0 /* address of proc 0 address space */ 13424693Speterp0upa: .long 0 /* phys addr of proc0's UPAGES */ 135134Sdg 13634840Sjlemon#ifdef VM86 13737889Sjlemonvm86phystk: .long 0 /* PA of vm86/bios stack */ 13837889Sjlemon 13934840Sjlemon .globl _vm86paddr, _vm86pa 14034840Sjlemon_vm86paddr: .long 0 /* address of vm86 region */ 14134840Sjlemon_vm86pa: .long 0 /* phys addr of vm86 region */ 14234840Sjlemon#endif 14334840Sjlemon 14415428Sphk#ifdef BDE_DEBUGGER 14515428Sphk .globl _bdb_exists /* flag to indicate BDE debugger is present */ 14615428Sphk_bdb_exists: .long 0 14715428Sphk#endif 148718Swollman 14915428Sphk 15015392Sphk/********************************************************************** 15115392Sphk * 15215392Sphk * Some handy macros 15315392Sphk * 154556Srgrimes */ 155134Sdg 15615392Sphk#define R(foo) ((foo)-KERNBASE) 15715392Sphk 15815392Sphk#define ALLOCPAGES(foo) \ 15915392Sphk movl R(physfree), %esi ; \ 16015543Sphk movl $((foo)*PAGE_SIZE), %eax ; \ 16115392Sphk addl %esi, %eax ; \ 16215392Sphk movl %eax, R(physfree) ; \ 16315392Sphk movl %esi, %edi ; \ 16415543Sphk movl $((foo)*PAGE_SIZE),%ecx ; \ 16515392Sphk xorl %eax,%eax ; \ 16615428Sphk cld ; \ 16715428Sphk rep ; \ 16815428Sphk stosb 16915392Sphk 170134Sdg/* 17115392Sphk * fillkpt 17215565Sphk * eax = page frame address 17315565Sphk * ebx = index into page table 17415392Sphk * ecx = how many pages to map 17515565Sphk * base = base address of page dir/table 17615565Sphk * prot = protection bits 177134Sdg */ 17815565Sphk#define fillkpt(base, prot) \ 17919621Sdyson shll $2,%ebx ; \ 18019621Sdyson addl base,%ebx ; \ 18119621Sdyson orl $PG_V,%eax ; \ 18219621Sdyson orl prot,%eax ; \ 18315565Sphk1: movl %eax,(%ebx) ; \ 18415565Sphk addl $PAGE_SIZE,%eax ; /* increment physical address */ \ 18515565Sphk addl $4,%ebx ; /* next pte */ \ 18615428Sphk loop 1b 18715392Sphk 18815565Sphk/* 18915565Sphk * fillkptphys(prot) 19015565Sphk * eax = physical address 19115565Sphk * ecx = how many pages to map 19215565Sphk * prot = protection bits 19315565Sphk */ 19415565Sphk#define fillkptphys(prot) \ 19515565Sphk movl %eax, %ebx ; \ 19615565Sphk shrl $PAGE_SHIFT, %ebx ; \ 19715565Sphk fillkpt(R(_KPTphys), prot) 19815565Sphk 19915392Sphk .text 20015392Sphk/********************************************************************** 20115392Sphk * 20215392Sphk * This is where the bootblocks start us, set the ball rolling... 20315392Sphk * 20415392Sphk */ 2051321SdgNON_GPROF_ENTRY(btext) 2064Srgrimes 20724112Skato#ifdef PC98 20824112Skato jmp 1f 20924112Skato .globl _pc98_system_parameter 21024112Skato .org 0x400 21124112Skato_pc98_system_parameter: 21224112Skato .space 0x240 /* BIOS parameter block */ 21324112Skato1: 21424112Skato /* save SYSTEM PARAMETER for resume (NS/T or other) */ 21524112Skato movl $0xa1000,%esi 21624112Skato movl $0x100000,%edi 21724112Skato movl $0x0630,%ecx 21824112Skato cld 21924112Skato rep 22024112Skato movsb 22124112Skato#else /* IBM-PC */ 22215428Sphk#ifdef BDE_DEBUGGER 22315428Sphk#ifdef BIOS_STEALS_3K 22415428Sphk cmpl $0x0375c339,0x95504 22515428Sphk#else 22615428Sphk cmpl $0x0375c339,0x96104 /* XXX - debugger signature */ 22715428Sphk#endif 22815428Sphk jne 1f 22915428Sphk movb $1,R(_bdb_exists) 23015428Sphk1: 23115428Sphk#endif 23215428Sphk 23315392Sphk/* Tell the bios to warmboot next time */ 23415392Sphk movw $0x1234,0x472 23524112Skato#endif /* PC98 */ 23615392Sphk 23715428Sphk/* Set up a real frame in case the double return in newboot is executed. */ 2383384Srgrimes pushl %ebp 2393384Srgrimes movl %esp, %ebp 2403384Srgrimes 24115392Sphk/* Don't trust what the BIOS gives for eflags. */ 2425603Sbde pushl $PSL_KERNEL 2432486Sdg popfl 24415428Sphk 24515428Sphk/* 24615428Sphk * Don't trust what the BIOS gives for %fs and %gs. Trust the bootstrap 24715428Sphk * to set %cs, %ds, %es and %ss. 24815428Sphk */ 24915428Sphk mov %ds, %ax 2504217Sphk mov %ax, %fs 2514217Sphk mov %ax, %gs 2524217Sphk 25315392Sphk call recover_bootinfo 25415392Sphk 25515428Sphk/* Get onto a stack that we can trust. */ 25615428Sphk/* 25715428Sphk * XXX this step is delayed in case recover_bootinfo needs to return via 25815428Sphk * the old stack, but it need not be, since recover_bootinfo actually 25915428Sphk * returns via the old frame. 26015428Sphk */ 26125083Sjdp movl $R(HIDENAME(tmpstk)),%esp 26215392Sphk 26324112Skato#ifdef PC98 26424112Skato testb $0x02,0x100620 /* pc98_machine_type & M_EPSON_PC98 */ 26524112Skato jz 3f 26624112Skato cmpb $0x0b,0x100624 /* epson_machine_id <= 0x0b */ 26724112Skato ja 3f 26824112Skato 26924112Skato /* count up memory */ 27024112Skato movl $0x100000,%eax /* next, talley remaining memory */ 27124112Skato movl $0xFFF-0x100,%ecx 27224112Skato1: movl 0(%eax),%ebx /* save location to check */ 27324112Skato movl $0xa55a5aa5,0(%eax) /* write test pattern */ 27424112Skato cmpl $0xa55a5aa5,0(%eax) /* does not check yet for rollover */ 27524112Skato jne 2f 27624112Skato movl %ebx,0(%eax) /* restore memory */ 27724112Skato addl $PAGE_SIZE,%eax 27824112Skato loop 1b 27924112Skato2: subl $0x100000,%eax 28024112Skato shrl $17,%eax 28124112Skato movb %al,0x100401 28224112Skato3: 28324112Skato#endif 28424112Skato 28515392Sphk call identify_cpu 28615392Sphk 28715392Sphk/* clear bss */ 28815428Sphk/* 28917120Sbde * XXX this should be done a little earlier. 29015428Sphk * 29117120Sbde * XXX we don't check that there is memory for our bss and page tables 29217120Sbde * before using it. 29315428Sphk * 29415428Sphk * XXX the boot program somewhat bogusly clears the bss. We still have 29515428Sphk * to do it in case we were unzipped by kzipboot. Then the boot program 29615428Sphk * only clears kzipboot's bss. 29715428Sphk * 29815428Sphk * XXX the gdt and idt are still somewhere in the boot program. We 29915428Sphk * depend on the convention that the boot program is below 1MB and we 30015428Sphk * are above 1MB to keep the gdt and idt away from the bss and page 30117120Sbde * tables. The idt is only used if BDE_DEBUGGER is enabled. 30215428Sphk */ 30315392Sphk movl $R(_end),%ecx 30415392Sphk movl $R(_edata),%edi 30515392Sphk subl %edi,%ecx 30615392Sphk xorl %eax,%eax 30715428Sphk cld 30815428Sphk rep 30915428Sphk stosb 31015392Sphk 31115392Sphk#if NAPM > 0 31236596Smsmith#ifndef VM86 31315428Sphk/* 31415428Sphk * XXX it's not clear that APM can live in the current environonment. 31515428Sphk * Only pc-relative addressing works. 31615428Sphk */ 31715428Sphk call _apm_setup 31815428Sphk#endif 31936596Smsmith#endif 32015392Sphk 32115392Sphk call create_pagetables 32215392Sphk 32327993Sdyson#ifdef VM86 32427993Sdyson/* 32527993Sdyson * If the CPU has support for VME, turn it on. 32627993Sdyson */ 32727993Sdyson testl $CPUID_VME, R(_cpu_feature) 32827993Sdyson jz 1f 32927993Sdyson movl %cr4, %eax 33027993Sdyson orl $CR4_VME, %eax 33127993Sdyson movl %eax, %cr4 33227993Sdyson1: 33327993Sdyson#endif /* VM86 */ 33427993Sdyson 33515428Sphk#ifdef BDE_DEBUGGER 33615428Sphk/* 33715428Sphk * Adjust as much as possible for paging before enabling paging so that the 33815428Sphk * adjustments can be traced. 33915428Sphk */ 34015428Sphk call bdb_prepare_paging 34115428Sphk#endif 34215428Sphk 34315392Sphk/* Now enable paging */ 34415392Sphk movl R(_IdlePTD), %eax 34515392Sphk movl %eax,%cr3 /* load ptd addr into mmu */ 34615392Sphk movl %cr0,%eax /* get control word */ 34715392Sphk orl $CR0_PE|CR0_PG,%eax /* enable paging */ 34815392Sphk movl %eax,%cr0 /* and let's page NOW! */ 34915392Sphk 35015428Sphk#ifdef BDE_DEBUGGER 35115428Sphk/* 35215428Sphk * Complete the adjustments for paging so that we can keep tracing through 35317120Sbde * initi386() after the low (physical) addresses for the gdt and idt become 35415428Sphk * invalid. 35515428Sphk */ 35615428Sphk call bdb_commit_paging 35715428Sphk#endif 35815428Sphk 35915428Sphk pushl $begin /* jump to high virtualized address */ 36015392Sphk ret 36115392Sphk 36215392Sphk/* now running relocated at KERNBASE where the system is linked to run */ 36315392Sphkbegin: 36415392Sphk /* set up bootstrap stack */ 36524691Speter movl _proc0paddr,%esp /* location of in-kernel pages */ 36624691Speter addl $UPAGES*PAGE_SIZE,%esp /* bootstrap stack end location */ 36715392Sphk xorl %eax,%eax /* mark end of frames */ 36815392Sphk movl %eax,%ebp 36915392Sphk movl _proc0paddr,%eax 37015392Sphk movl _IdlePTD, %esi 37115392Sphk movl %esi,PCB_CR3(%eax) 37235072Speter movl $_proc0,_curproc 37315392Sphk 37415392Sphk movl physfree, %esi 37515392Sphk pushl %esi /* value of first for init386(first) */ 37615392Sphk call _init386 /* wire 386 chip for unix operation */ 37715392Sphk popl %esi 37815392Sphk 37915392Sphk .globl __ucodesel,__udatasel 38015392Sphk 38115392Sphk pushl $0 /* unused */ 38215392Sphk pushl __udatasel /* ss */ 38315392Sphk pushl $0 /* esp - filled in by execve() */ 38415392Sphk pushl $PSL_USER /* eflags (IOPL 0, int enab) */ 38515392Sphk pushl __ucodesel /* cs */ 38615392Sphk pushl $0 /* eip - filled in by execve() */ 38715392Sphk subl $(12*4),%esp /* space for rest of registers */ 38815392Sphk 38915392Sphk pushl %esp /* call main with frame pointer */ 39015392Sphk call _main /* autoconfiguration, mountroot etc */ 39115392Sphk 39224691Speter hlt /* never returns to here */ 39315392Sphk 39424691Speter/* 39524691Speter * When starting init, call this to configure the process for user 39624691Speter * mode. This will be inherited by other processes. 39724691Speter */ 39824691SpeterNON_GPROF_ENTRY(prepare_usermode) 39915392Sphk /* 40024112Skato * Now we've run main() and determined what cpu-type we are, we can 40115392Sphk * enable write protection and alignment checking on i486 cpus and 40215392Sphk * above. 40315392Sphk */ 40415392Sphk#if defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU) 40515392Sphk cmpl $CPUCLASS_386,_cpu_class 40615392Sphk je 1f 40715392Sphk movl %cr0,%eax /* get control word */ 40815392Sphk orl $CR0_WP|CR0_AM,%eax /* enable i486 features */ 40915392Sphk movl %eax,%cr0 /* and do it */ 41015428Sphk1: 41115392Sphk#endif 41215392Sphk /* 41315392Sphk * on return from main(), we are process 1 41415392Sphk * set up address space and stack so that we can 'return' to user mode 41515392Sphk */ 41615392Sphk movl __ucodesel,%eax 41715392Sphk movl __udatasel,%ecx 41815392Sphk 41924691Speter#if 0 42015392Sphk movl %cx,%ds 42124691Speter#endif 42215392Sphk movl %cx,%es 42315392Sphk movl %ax,%fs /* double map cs to fs */ 42415392Sphk movl %cx,%gs /* and ds to gs */ 42524691Speter ret /* goto user! */ 42615392Sphk 42724691Speter 42815392Sphk#define LCALL(x,y) .byte 0x9a ; .long y ; .word x 42915392Sphk 43015392Sphk/* 43115392Sphk * Signal trampoline, copied to top of user stack 43215392Sphk */ 43315392SphkNON_GPROF_ENTRY(sigcode) 43415392Sphk call SIGF_HANDLER(%esp) 43515392Sphk lea SIGF_SC(%esp),%eax /* scp (the call may have clobbered the */ 43615392Sphk /* copy at 8(%esp)) */ 43715392Sphk pushl %eax 43815392Sphk pushl %eax /* junk to fake return address */ 43915392Sphk movl $SYS_sigreturn,%eax /* sigreturn() */ 44015392Sphk LCALL(0x7,0) /* enter kernel with args on stack */ 44115392Sphk hlt /* never gets here */ 44225083Sjdp ALIGN_TEXT 44315392Sphk_esigcode: 44415392Sphk 44515392Sphk .data 44615392Sphk .globl _szsigcode 44715392Sphk_szsigcode: 44815392Sphk .long _esigcode-_sigcode 44915428Sphk .text 45015392Sphk 45115392Sphk/********************************************************************** 45215392Sphk * 45315392Sphk * Recover the bootinfo passed to us from the boot program 45415392Sphk * 45515392Sphk */ 45615392Sphkrecover_bootinfo: 45715392Sphk /* 4583284Srgrimes * This code is called in different ways depending on what loaded 4593284Srgrimes * and started the kernel. This is used to detect how we get the 4603284Srgrimes * arguments from the other code and what we do with them. 4613284Srgrimes * 4623284Srgrimes * Old disk boot blocks: 4633284Srgrimes * (*btext)(howto, bootdev, cyloffset, esym); 4643284Srgrimes * [return address == 0, and can NOT be returned to] 4653284Srgrimes * [cyloffset was not supported by the FreeBSD boot code 4663284Srgrimes * and always passed in as 0] 4673284Srgrimes * [esym is also known as total in the boot code, and 4683284Srgrimes * was never properly supported by the FreeBSD boot code] 4693284Srgrimes * 4703284Srgrimes * Old diskless netboot code: 4713284Srgrimes * (*btext)(0,0,0,0,&nfsdiskless,0,0,0); 4723284Srgrimes * [return address != 0, and can NOT be returned to] 4733284Srgrimes * If we are being booted by this code it will NOT work, 4743284Srgrimes * so we are just going to halt if we find this case. 4753284Srgrimes * 4763284Srgrimes * New uniform boot code: 4773284Srgrimes * (*btext)(howto, bootdev, 0, 0, 0, &bootinfo) 4783284Srgrimes * [return address != 0, and can be returned to] 4793284Srgrimes * 4803284Srgrimes * There may seem to be a lot of wasted arguments in here, but 4813384Srgrimes * that is so the newer boot code can still load very old kernels 4823384Srgrimes * and old boot code can load new kernels. 4834Srgrimes */ 4843284Srgrimes 4853284Srgrimes /* 4863284Srgrimes * The old style disk boot blocks fake a frame on the stack and 4873284Srgrimes * did an lret to get here. The frame on the stack has a return 4883284Srgrimes * address of 0. 4893284Srgrimes */ 4903384Srgrimes cmpl $0,4(%ebp) 49115392Sphk je olddiskboot 4923284Srgrimes 4933284Srgrimes /* 4943284Srgrimes * We have some form of return address, so this is either the 4953284Srgrimes * old diskless netboot code, or the new uniform code. That can 49615428Sphk * be detected by looking at the 5th argument, if it is 0 49715428Sphk * we are being booted by the new uniform boot code. 4983284Srgrimes */ 4993384Srgrimes cmpl $0,24(%ebp) 50015392Sphk je newboot 5013284Srgrimes 5023284Srgrimes /* 5033284Srgrimes * Seems we have been loaded by the old diskless boot code, we 5043284Srgrimes * don't stand a chance of running as the diskless structure 5053284Srgrimes * changed considerably between the two, so just halt. 5063284Srgrimes */ 5073284Srgrimes hlt 5083284Srgrimes 5093284Srgrimes /* 5103384Srgrimes * We have been loaded by the new uniform boot code. 51115428Sphk * Let's check the bootinfo version, and if we do not understand 5123384Srgrimes * it we return to the loader with a status of 1 to indicate this error 5133284Srgrimes */ 51415392Sphknewboot: 5153384Srgrimes movl 28(%ebp),%ebx /* &bootinfo.version */ 5165908Sbde movl BI_VERSION(%ebx),%eax 5173384Srgrimes cmpl $1,%eax /* We only understand version 1 */ 5183384Srgrimes je 1f 5193384Srgrimes movl $1,%eax /* Return status */ 5203384Srgrimes leave 52115428Sphk /* 52215428Sphk * XXX this returns to our caller's caller (as is required) since 52315428Sphk * we didn't set up a frame and our caller did. 52415428Sphk */ 5253384Srgrimes ret 5263284Srgrimes 5273384Srgrimes1: 5283284Srgrimes /* 5293384Srgrimes * If we have a kernelname copy it in 5303384Srgrimes */ 5315908Sbde movl BI_KERNELNAME(%ebx),%esi 5323384Srgrimes cmpl $0,%esi 5339344Sdg je 2f /* No kernelname */ 5349344Sdg movl $MAXPATHLEN,%ecx /* Brute force!!! */ 53515926Sphk movl $R(_kernelname),%edi 5369344Sdg cmpb $'/',(%esi) /* Make sure it starts with a slash */ 5379344Sdg je 1f 5389344Sdg movb $'/',(%edi) 5399344Sdg incl %edi 5409344Sdg decl %ecx 5419344Sdg1: 5423384Srgrimes cld 5433384Srgrimes rep 5443384Srgrimes movsb 5453384Srgrimes 5469344Sdg2: 54715428Sphk /* 5485908Sbde * Determine the size of the boot loader's copy of the bootinfo 5495908Sbde * struct. This is impossible to do properly because old versions 5505908Sbde * of the struct don't contain a size field and there are 2 old 5515908Sbde * versions with the same version number. 5524600Sphk */ 5535908Sbde movl $BI_ENDCOMMON,%ecx /* prepare for sizeless version */ 5545908Sbde testl $RB_BOOTINFO,8(%ebp) /* bi_size (and bootinfo) valid? */ 5555908Sbde je got_bi_size /* no, sizeless version */ 5565908Sbde movl BI_SIZE(%ebx),%ecx 5575908Sbdegot_bi_size: 5585908Sbde 55915428Sphk /* 5605908Sbde * Copy the common part of the bootinfo struct 5615908Sbde */ 5624600Sphk movl %ebx,%esi 56315926Sphk movl $R(_bootinfo),%edi 5645908Sbde cmpl $BOOTINFO_SIZE,%ecx 5655908Sbde jbe got_common_bi_size 5664600Sphk movl $BOOTINFO_SIZE,%ecx 5675908Sbdegot_common_bi_size: 5684600Sphk cld 5694600Sphk rep 5704600Sphk movsb 5714600Sphk 57238063Smsmith#ifdef NFS_ROOT 57325837Stegge#ifndef BOOTP_NFSV3 5743384Srgrimes /* 5753384Srgrimes * If we have a nfs_diskless structure copy it in 5763384Srgrimes */ 5775908Sbde movl BI_NFS_DISKLESS(%ebx),%esi 5783384Srgrimes cmpl $0,%esi 57915428Sphk je olddiskboot 58015926Sphk movl $R(_nfs_diskless),%edi 5813384Srgrimes movl $NFSDISKLESS_SIZE,%ecx 5823384Srgrimes cld 5833384Srgrimes rep 5843384Srgrimes movsb 58515926Sphk movl $R(_nfs_diskless_valid),%edi 5863795Sphk movl $1,(%edi) 5873406Sdg#endif 58825837Stegge#endif 5893384Srgrimes 5903384Srgrimes /* 5913284Srgrimes * The old style disk boot. 5923284Srgrimes * (*btext)(howto, bootdev, cyloffset, esym); 5933384Srgrimes * Note that the newer boot code just falls into here to pick 5943384Srgrimes * up howto and bootdev, cyloffset and esym are no longer used 5953284Srgrimes */ 59615392Sphkolddiskboot: 5973384Srgrimes movl 8(%ebp),%eax 59815926Sphk movl %eax,R(_boothowto) 5993384Srgrimes movl 12(%ebp),%eax 60015926Sphk movl %eax,R(_bootdev) 6012783Ssos 60218702Sjkh#if defined(USERCONFIG_BOOT) && defined(USERCONFIG) 60318702Sjkh movl $0x10200, %esi 60419772Sjkh movl $R(_userconfig_from_boot),%edi 60518702Sjkh movl $512,%ecx 60618702Sjkh cld 60718702Sjkh rep 60818702Sjkh movsb 60918702Sjkh#endif /* USERCONFIG_BOOT */ 61018702Sjkh 61115392Sphk ret 6123258Sdg 6131321Sdg 61415392Sphk/********************************************************************** 61515392Sphk * 61615392Sphk * Identify the CPU and initialize anything special about it 61715392Sphk * 61815392Sphk */ 61915392Sphkidentify_cpu: 62015392Sphk 6211998Swollman /* Try to toggle alignment check flag; does not exist on 386. */ 6221998Swollman pushfl 6231998Swollman popl %eax 6241998Swollman movl %eax,%ecx 6251998Swollman orl $PSL_AC,%eax 6261998Swollman pushl %eax 6271998Swollman popfl 6281998Swollman pushfl 6291998Swollman popl %eax 6301998Swollman xorl %ecx,%eax 6311998Swollman andl $PSL_AC,%eax 6321998Swollman pushl %ecx 6331998Swollman popfl 6341998Swollman 6351998Swollman testl %eax,%eax 63624112Skato jnz try486 63724112Skato 63824112Skato /* NexGen CPU does not have aligment check flag. */ 63924112Skato pushfl 64024112Skato movl $0x5555, %eax 64124112Skato xorl %edx, %edx 64224112Skato movl $2, %ecx 64324112Skato clc 64424112Skato divl %ecx 64524112Skato jz trynexgen 64624112Skato popfl 64715926Sphk movl $CPU_386,R(_cpu) 64813081Sdg jmp 3f 6491998Swollman 65024112Skatotrynexgen: 65127424Skato popfl 65224112Skato movl $CPU_NX586,R(_cpu) 65324112Skato movl $0x4778654e,R(_cpu_vendor) # store vendor string 65424112Skato movl $0x72446e65,R(_cpu_vendor+4) 65524112Skato movl $0x6e657669,R(_cpu_vendor+8) 65624112Skato movl $0,R(_cpu_vendor+12) 65724112Skato jmp 3f 65824112Skato 65924112Skatotry486: /* Try to toggle identification flag; does not exist on early 486s. */ 6601998Swollman pushfl 6611998Swollman popl %eax 6621998Swollman movl %eax,%ecx 6631998Swollman xorl $PSL_ID,%eax 6641998Swollman pushl %eax 6651998Swollman popfl 6661998Swollman pushfl 6671998Swollman popl %eax 6681998Swollman xorl %ecx,%eax 6691998Swollman andl $PSL_ID,%eax 6701998Swollman pushl %ecx 6711998Swollman popfl 6721998Swollman 6731998Swollman testl %eax,%eax 67424112Skato jnz trycpuid 67515926Sphk movl $CPU_486,R(_cpu) 6762495Spst 67724112Skato /* 67824112Skato * Check Cyrix CPU 67924112Skato * Cyrix CPUs do not change the undefined flags following 68024112Skato * execution of the divide instruction which divides 5 by 2. 68124112Skato * 68224112Skato * Note: CPUID is enabled on M2, so it passes another way. 68324112Skato */ 68424112Skato pushfl 68524112Skato movl $0x5555, %eax 68624112Skato xorl %edx, %edx 68724112Skato movl $2, %ecx 68824112Skato clc 68924112Skato divl %ecx 69024112Skato jnc trycyrix 69124112Skato popfl 69224112Skato jmp 3f /* You may use Intel CPU. */ 6932495Spst 69424112Skatotrycyrix: 69524112Skato popfl 69624112Skato /* 69724112Skato * IBM Bluelighting CPU also doesn't change the undefined flags. 69824112Skato * Because IBM doesn't disclose the information for Bluelighting 69924112Skato * CPU, we couldn't distinguish it from Cyrix's (including IBM 70024112Skato * brand of Cyrix CPUs). 70124112Skato */ 70215926Sphk movl $0x69727943,R(_cpu_vendor) # store vendor string 70324112Skato movl $0x736e4978,R(_cpu_vendor+4) 70424112Skato movl $0x64616574,R(_cpu_vendor+8) 70513014Sdg jmp 3f 7061998Swollman 70724112Skatotrycpuid: /* Use the `cpuid' instruction. */ 7081998Swollman xorl %eax,%eax 7096308Sphk .byte 0x0f,0xa2 # cpuid 0 71015926Sphk movl %eax,R(_cpu_high) # highest capability 71115926Sphk movl %ebx,R(_cpu_vendor) # store vendor string 71215926Sphk movl %edx,R(_cpu_vendor+4) 71315926Sphk movl %ecx,R(_cpu_vendor+8) 71415926Sphk movb $0,R(_cpu_vendor+12) 7151998Swollman 7161998Swollman movl $1,%eax 7176308Sphk .byte 0x0f,0xa2 # cpuid 1 71815926Sphk movl %eax,R(_cpu_id) # store cpu_id 71915926Sphk movl %edx,R(_cpu_feature) # store cpu_feature 7206308Sphk rorl $8,%eax # extract family type 7211998Swollman andl $15,%eax 7221998Swollman cmpl $5,%eax 7231998Swollman jae 1f 7241998Swollman 7251998Swollman /* less than Pentium; must be 486 */ 72615926Sphk movl $CPU_486,R(_cpu) 72713000Sdg jmp 3f 72813000Sdg1: 72913000Sdg /* a Pentium? */ 73013000Sdg cmpl $5,%eax 73113000Sdg jne 2f 73215926Sphk movl $CPU_586,R(_cpu) 73313000Sdg jmp 3f 734556Srgrimes2: 73513000Sdg /* Greater than Pentium...call it a Pentium Pro */ 73615926Sphk movl $CPU_686,R(_cpu) 73713000Sdg3: 73815392Sphk ret 739556Srgrimes 7404Srgrimes 74115392Sphk/********************************************************************** 742570Srgrimes * 74315428Sphk * Create the first page directory and its page tables. 74415392Sphk * 745570Srgrimes */ 746570Srgrimes 74715392Sphkcreate_pagetables: 74815392Sphk 74919621Sdyson testl $CPUID_PGE, R(_cpu_feature) 75019621Sdyson jz 1f 75119621Sdyson movl %cr4, %eax 75219621Sdyson orl $CR4_PGE, %eax 75319621Sdyson movl %eax, %cr4 75419621Sdyson1: 75519621Sdyson 75615428Sphk/* Find end of kernel image (rounded up to a page boundary). */ 75715392Sphk movl $R(_end),%esi 7584Srgrimes 75915392Sphk/* include symbols in "kernel image" if they are loaded and useful */ 7605908Sbde#ifdef DDB 76115392Sphk movl R(_bootinfo+BI_ESYMTAB),%edi 7625908Sbde testl %edi,%edi 76315428Sphk je over_symalloc 7645908Sbde movl %edi,%esi 7655908Sbde movl $KERNBASE,%edi 76615392Sphk addl %edi,R(_bootinfo+BI_SYMTAB) 76715392Sphk addl %edi,R(_bootinfo+BI_ESYMTAB) 76815428Sphkover_symalloc: 7695908Sbde#endif 7705908Sbde 77115565Sphk addl $PAGE_MASK,%esi 77215565Sphk andl $~PAGE_MASK,%esi 77315392Sphk movl %esi,R(_KERNend) /* save end of kernel */ 77415428Sphk movl %esi,R(physfree) /* next free page is at end of kernel */ 775608Srgrimes 77615392Sphk/* Allocate Kernel Page Tables */ 77715392Sphk ALLOCPAGES(NKPT) 77815392Sphk movl %esi,R(_KPTphys) 779757Sdg 78015392Sphk/* Allocate Page Table Directory */ 78115392Sphk ALLOCPAGES(1) 78215392Sphk movl %esi,R(_IdlePTD) 7834Srgrimes 78415392Sphk/* Allocate UPAGES */ 78515392Sphk ALLOCPAGES(UPAGES) 78617120Sbde movl %esi,R(p0upa) 78715392Sphk addl $KERNBASE, %esi 78815392Sphk movl %esi, R(_proc0paddr) 7894Srgrimes 79034840Sjlemon#ifdef VM86 79137889Sjlemon ALLOCPAGES(1) /* vm86/bios stack */ 79237889Sjlemon movl %esi,R(vm86phystk) 79337889Sjlemon 79437889Sjlemon ALLOCPAGES(3) /* pgtable + ext + IOPAGES */ 79534840Sjlemon movl %esi,R(_vm86pa) 79634840Sjlemon addl $KERNBASE, %esi 79734840Sjlemon movl %esi, R(_vm86paddr) 79834840Sjlemon#endif /* VM86 */ 79934840Sjlemon 80026812Speter#ifdef SMP 80125164Speter/* Allocate cpu0's private data page */ 80225164Speter ALLOCPAGES(1) 80325164Speter movl %esi,R(cpu0pp) 80425164Speter addl $KERNBASE, %esi 80525164Speter movl %esi, R(_cpu0prvpage) /* relocated to KVM space */ 80625164Speter 80725164Speter/* Allocate cpu0's private page table for mapping priv page, apic, etc */ 80825164Speter ALLOCPAGES(1) 80925164Speter movl %esi,R(cpu0pt) 81025164Speter addl $KERNBASE, %esi 81125164Speter movl %esi, R(_cpu0prvpt) /* relocated to KVM space */ 81226812Speter#endif /* SMP */ 81325164Speter 81415392Sphk/* Map read-only from zero to the end of the kernel text section */ 81515565Sphk xorl %eax, %eax 81615428Sphk#ifdef BDE_DEBUGGER 81715428Sphk/* If the debugger is present, actually map everything read-write. */ 81815428Sphk cmpl $0,R(_bdb_exists) 81915428Sphk jne map_read_write 82015428Sphk#endif 82119621Sdyson xorl %edx,%edx 82227484Sdyson 82327484Sdyson#if !defined(SMP) 82419621Sdyson testl $CPUID_PGE, R(_cpu_feature) 82519621Sdyson jz 2f 82619621Sdyson orl $PG_G,%edx 82727484Sdyson#endif 82819621Sdyson 82919621Sdyson2: movl $R(_etext),%ecx 83015565Sphk addl $PAGE_MASK,%ecx 83115565Sphk shrl $PAGE_SHIFT,%ecx 83219621Sdyson fillkptphys(%edx) 833757Sdg 83415392Sphk/* Map read-write, data, bss and symbols */ 83515565Sphk movl $R(_etext),%eax 83615694Sphk addl $PAGE_MASK, %eax 83715694Sphk andl $~PAGE_MASK, %eax 83815428Sphkmap_read_write: 83919621Sdyson movl $PG_RW,%edx 84027484Sdyson#if !defined(SMP) 84119621Sdyson testl $CPUID_PGE, R(_cpu_feature) 84219621Sdyson jz 1f 84319621Sdyson orl $PG_G,%edx 84427484Sdyson#endif 84519621Sdyson 84619621Sdyson1: movl R(_KERNend),%ecx 847757Sdg subl %eax,%ecx 84815543Sphk shrl $PAGE_SHIFT,%ecx 84919621Sdyson fillkptphys(%edx) 850757Sdg 85115428Sphk/* Map page directory. */ 85215392Sphk movl R(_IdlePTD), %eax 85315392Sphk movl $1, %ecx 85419621Sdyson fillkptphys($PG_RW) 855757Sdg 85617120Sbde/* Map proc0's UPAGES in the physical way ... */ 85717120Sbde movl R(p0upa), %eax 85815392Sphk movl $UPAGES, %ecx 85919621Sdyson fillkptphys($PG_RW) 8604Srgrimes 86115565Sphk/* Map ISA hole */ 86215565Sphk movl $ISA_HOLE_START, %eax 86315565Sphk movl $ISA_HOLE_LENGTH>>PAGE_SHIFT, %ecx 86422130Sdg fillkptphys($PG_RW) 86515565Sphk 86634840Sjlemon#ifdef VM86 86734840Sjlemon/* Map space for the vm86 region */ 86837889Sjlemon movl R(vm86phystk), %eax 86934840Sjlemon movl $4, %ecx 87034840Sjlemon fillkptphys($PG_RW) 87134840Sjlemon 87234840Sjlemon/* Map page 0 into the vm86 page table */ 87334840Sjlemon movl $0, %eax 87434840Sjlemon movl $0, %ebx 87534840Sjlemon movl $1, %ecx 87634840Sjlemon fillkpt(R(_vm86pa), $PG_RW|PG_U) 87734840Sjlemon 87834840Sjlemon/* ...likewise for the ISA hole */ 87934840Sjlemon movl $ISA_HOLE_START, %eax 88034840Sjlemon movl $ISA_HOLE_START>>PAGE_SHIFT, %ebx 88134840Sjlemon movl $ISA_HOLE_LENGTH>>PAGE_SHIFT, %ecx 88234840Sjlemon fillkpt(R(_vm86pa), $PG_RW|PG_U) 88334840Sjlemon#endif /* VM86 */ 88434840Sjlemon 88526812Speter#ifdef SMP 88626812Speter/* Map cpu0's private page into global kmem (4K @ cpu0prvpage) */ 88725164Speter movl R(cpu0pp), %eax 88825164Speter movl $1, %ecx 88925164Speter fillkptphys($PG_RW) 89025164Speter 89126812Speter/* Map cpu0's private page table into global kmem FWIW */ 89225164Speter movl R(cpu0pt), %eax 89325164Speter movl $1, %ecx 89425164Speter fillkptphys($PG_RW) 89525164Speter 89626812Speter/* Map the private page into the private page table into private space */ 89725164Speter movl R(cpu0pp), %eax 89825164Speter movl $0, %ebx /* pte offset = 0 */ 89925164Speter movl $1, %ecx /* one private page coming right up */ 90025164Speter fillkpt(R(cpu0pt), $PG_RW) 90125164Speter 90226812Speter/* Map the page table page into private space */ 90326812Speter movl R(cpu0pt), %eax 90425164Speter movl $1, %ebx /* pte offset = 1 */ 90526812Speter movl $1, %ecx /* one private pt coming right up */ 90626812Speter fillkpt(R(cpu0pt), $PG_RW) 90725164Speter 90826812Speter/* ... and put the page table table in the pde. */ 90925164Speter movl R(cpu0pt), %eax 91025164Speter movl $MPPTDI, %ebx 91125164Speter movl $1, %ecx 91225164Speter fillkpt(R(_IdlePTD), $PG_RW) 91334840Sjlemon 91434840Sjlemon/* Fakeup VA for the local apic to allow early traps. */ 91534840Sjlemon ALLOCPAGES(1) 91634840Sjlemon movl %esi, %eax 91734840Sjlemon movl $2, %ebx /* pte offset = 2 */ 91834840Sjlemon movl $1, %ecx /* one private pt coming right up */ 91934840Sjlemon fillkpt(R(cpu0pt), $PG_RW) 92034840Sjlemon 92134840Sjlemon/* Initialize mp lock to allow early traps */ 92234840Sjlemon movl $1, R(_mp_lock) 92334840Sjlemon 92435072Speter/* Initialize my_idlePTD to IdlePTD */ 92534840Sjlemon movl R(cpu0pp), %eax 92634840Sjlemon movl R(_IdlePTD), %ecx 92735072Speter movl %ecx,GD_MY_IDLEPTD(%eax) 92834840Sjlemon 92926812Speter#endif /* SMP */ 93025164Speter 93115392Sphk/* install a pde for temporary double map of bottom of VA */ 93215392Sphk movl R(_KPTphys), %eax 93315565Sphk xorl %ebx, %ebx 93415565Sphk movl $1, %ecx 93519621Sdyson fillkpt(R(_IdlePTD), $PG_RW) 9364Srgrimes 93715392Sphk/* install pde's for pt's */ 93815392Sphk movl R(_KPTphys), %eax 93915565Sphk movl $KPTDI, %ebx 94015565Sphk movl $NKPT, %ecx 94119621Sdyson fillkpt(R(_IdlePTD), $PG_RW) 9424Srgrimes 94315392Sphk/* install a pde recursively mapping page directory as a page table */ 94415565Sphk movl R(_IdlePTD), %eax 94515565Sphk movl $PTDPTDI, %ebx 94615565Sphk movl $1,%ecx 94719621Sdyson fillkpt(R(_IdlePTD), $PG_RW) 9484Srgrimes 9494Srgrimes ret 95015428Sphk 95115428Sphk#ifdef BDE_DEBUGGER 95215428Sphkbdb_prepare_paging: 95315428Sphk cmpl $0,R(_bdb_exists) 95415428Sphk je bdb_prepare_paging_exit 95515428Sphk 95615428Sphk subl $6,%esp 95715428Sphk 95815428Sphk /* 95915428Sphk * Copy and convert debugger entries from the bootstrap gdt and idt 96015428Sphk * to the kernel gdt and idt. Everything is still in low memory. 96115428Sphk * Tracing continues to work after paging is enabled because the 96215428Sphk * low memory addresses remain valid until everything is relocated. 96315428Sphk * However, tracing through the setidt() that initializes the trace 96415428Sphk * trap will crash. 96515428Sphk */ 96615428Sphk sgdt (%esp) 96715428Sphk movl 2(%esp),%esi /* base address of bootstrap gdt */ 96815428Sphk movl $R(_gdt),%edi 96915428Sphk movl %edi,2(%esp) /* prepare to load kernel gdt */ 97015428Sphk movl $8*18/4,%ecx 97115428Sphk cld 97215428Sphk rep /* copy gdt */ 97315428Sphk movsl 97415428Sphk movl $R(_gdt),-8+2(%edi) /* adjust gdt self-ptr */ 97515428Sphk movb $0x92,-8+5(%edi) 97615428Sphk lgdt (%esp) 97715428Sphk 97815428Sphk sidt (%esp) 97915428Sphk movl 2(%esp),%esi /* base address of current idt */ 98015428Sphk movl 8+4(%esi),%eax /* convert dbg descriptor to ... */ 98115428Sphk movw 8(%esi),%ax 98215428Sphk movl %eax,R(bdb_dbg_ljmp+1) /* ... immediate offset ... */ 98315428Sphk movl 8+2(%esi),%eax 98415428Sphk movw %ax,R(bdb_dbg_ljmp+5) /* ... and selector for ljmp */ 98515428Sphk movl 24+4(%esi),%eax /* same for bpt descriptor */ 98615428Sphk movw 24(%esi),%ax 98715428Sphk movl %eax,R(bdb_bpt_ljmp+1) 98815428Sphk movl 24+2(%esi),%eax 98915428Sphk movw %ax,R(bdb_bpt_ljmp+5) 99015428Sphk movl $R(_idt),%edi 99115428Sphk movl %edi,2(%esp) /* prepare to load kernel idt */ 99215428Sphk movl $8*4/4,%ecx 99315428Sphk cld 99415428Sphk rep /* copy idt */ 99515428Sphk movsl 99615428Sphk lidt (%esp) 99715428Sphk 99815428Sphk addl $6,%esp 99915428Sphk 100015428Sphkbdb_prepare_paging_exit: 100115428Sphk ret 100215428Sphk 100315428Sphk/* Relocate debugger gdt entries and gdt and idt pointers. */ 100415428Sphkbdb_commit_paging: 100515428Sphk cmpl $0,_bdb_exists 100615428Sphk je bdb_commit_paging_exit 100715428Sphk 100815428Sphk movl $_gdt+8*9,%eax /* adjust slots 9-17 */ 100915428Sphk movl $9,%ecx 101015428Sphkreloc_gdt: 101115428Sphk movb $KERNBASE>>24,7(%eax) /* top byte of base addresses, was 0, */ 101215428Sphk addl $8,%eax /* now KERNBASE>>24 */ 101315428Sphk loop reloc_gdt 101415428Sphk 101515428Sphk subl $6,%esp 101615428Sphk sgdt (%esp) 101715428Sphk addl $KERNBASE,2(%esp) 101815428Sphk lgdt (%esp) 101915428Sphk sidt (%esp) 102015428Sphk addl $KERNBASE,2(%esp) 102115428Sphk lidt (%esp) 102215428Sphk addl $6,%esp 102315428Sphk 102415428Sphk int $3 102515428Sphk 102615428Sphkbdb_commit_paging_exit: 102715428Sphk ret 102815428Sphk 102915428Sphk#endif /* BDE_DEBUGGER */ 1030