mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
All:
removed patch kit headers and sccsids, add $Id$. This is a general clean up and reallignment with NetBSD-current where possible. genassym.c: removed extranious include of reg.h removed old FP_* defines that have been ifdefed out since the patch kit removed PCB_SIGC that is not referenced anywhere add trapframe and sigframe defines add KERNBASE define for use in locore.s locore.s: include npx.h and use NNPX for turning on and off FPU include machine/cputypes.h for the types of cpu (used in cpu_identify) change SYSPDREND to be one higher, this is really the base of the next area, and will be changing again next time I revise the file Reverse the NOP defines, you now get slow NOP's by default, this may be what is casuing us trouble with some systems. If you want the NOPS to be null you now need to have options DUMMY_NOPS. Now get esym from the boot blocks which don't pass it yet, and it is not used, but this will be changing. Move the bit_colors stuff to be in with the rest of Bruces SHOW_A_LOT things for debugging. Added NetBSD's CPU type probe code, we now know what type of CPU we are running on. Adjust kernel pde calcuation to correct for change in SYSPDREND, no longer need the +1. machdep.c include npx.h and use NNPX for turning on and off FPU include isa.h, map.h(new file), exec.h in preperation for changes that are still in process. Add some of the code for MACHINE_NONCONTIG that will alow us to better map around the BIOS memory area. Now print the version, cpu id, real memory and availiable memory during boot. Correct the calculation of bufpages, the code was mixing pages and bytes, it now does the right things. Removed Bill's hack for limiting the erronous calculation. add the identifycpu print out code from NetBSD. remove the definition of the sigframe struct, it belongs in frame.h put in printf's about syncing disks on a halt/reboot. Change the halted message to be a little easier reading. Clean up of the dump messages, makes the source and the output much more readable. Change 0,0 in several places to have spaces after the commas.
This commit is contained in:
parent
bb9b7f49b4
commit
3409a2f663
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=556
@ -33,21 +33,9 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)genassym.c 5.11 (Berkeley) 5/10/91
|
||||
*
|
||||
* PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
|
||||
* -------------------- ----- ----------------------
|
||||
* CURRENT PATCH LEVEL: 1 00154
|
||||
* -------------------- ----- ----------------------
|
||||
*
|
||||
* 24 Apr 93 Bruce Evans/Dave Rivers Npx-0.5 support
|
||||
*
|
||||
* from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
|
||||
* $Id$
|
||||
*/
|
||||
static char rcsid[] = "$Header: /usr/bill/working/sys/i386/i386/RCS/genassym.c,v 1.2 92/01/21 14:22:02 william Exp $";
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)genassym.c 5.11 (Berkeley) 5/10/91";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "sys/param.h"
|
||||
#include "sys/buf.h"
|
||||
@ -60,7 +48,6 @@ static char sccsid[] = "@(#)genassym.c 5.11 (Berkeley) 5/10/91";
|
||||
#include "machine/cpu.h"
|
||||
#include "machine/trap.h"
|
||||
#include "machine/psl.h"
|
||||
#include "machine/reg.h"
|
||||
#include "sys/syscall.h"
|
||||
#include "vm/vm_param.h"
|
||||
#include "vm/vm_map.h"
|
||||
@ -77,6 +64,8 @@ main()
|
||||
vm_map_t map = (vm_map_t)0;
|
||||
pmap_t pmap = (pmap_t)0;
|
||||
struct pcb *pcb = (struct pcb *)0;
|
||||
struct trapframe *tf = (struct trapframe *)0;
|
||||
struct sigframe *sigf = (struct sigframe *)0;
|
||||
register unsigned i;
|
||||
|
||||
printf("#define\tI386_CR3PAT %d\n", I386_CR3PAT);
|
||||
@ -115,6 +104,7 @@ main()
|
||||
printf("#define\tSHMMAXPGS %d\n", SHMMAXPGS);
|
||||
#endif
|
||||
printf("#define\tUSRSTACK %d\n", USRSTACK);
|
||||
printf("#define\tKERNBASE %d\n", KERNBASE);
|
||||
printf("#define\tMSGBUFPTECNT %d\n", btoc(sizeof (struct msgbuf)));
|
||||
printf("#define\tNMBCLUSTERS %d\n", NMBCLUSTERS);
|
||||
printf("#define\tMCLBYTES %d\n", MCLBYTES);
|
||||
@ -143,6 +133,7 @@ main()
|
||||
printf("#define\tPCB_FS %d\n", &pcb->pcb_tss.tss_fs);
|
||||
printf("#define\tPCB_GS %d\n", &pcb->pcb_tss.tss_gs);
|
||||
printf("#define\tPCB_LDT %d\n", &pcb->pcb_tss.tss_ldt);
|
||||
printf("#define\tPCB_USERLDT %d\n", &pcb->pcb_ldt);
|
||||
printf("#define\tPCB_IOOPT %d\n", &pcb->pcb_tss.tss_ioopt);
|
||||
printf("#define\tNKMEMCLUSTERS %d\n", NKMEMCLUSTERS);
|
||||
printf("#define\tU_PROF %d\n", &up->u_stats.p_prof);
|
||||
@ -154,18 +145,36 @@ main()
|
||||
printf("#define\tRU_MINFLT %d\n", &rup->ru_minflt);
|
||||
printf("#define\tPCB_FLAGS %d\n", &pcb->pcb_flags);
|
||||
printf("#define\tPCB_SAVEFPU %d\n", &pcb->pcb_savefpu);
|
||||
#ifdef notused
|
||||
printf("#define\tFP_WASUSED %d\n", FP_WASUSED);
|
||||
printf("#define\tFP_NEEDSSAVE %d\n", FP_NEEDSSAVE);
|
||||
printf("#define\tFP_NEEDSRESTORE %d\n", FP_NEEDSRESTORE);
|
||||
#endif
|
||||
printf("#define\tFP_USESEMC %d\n", FP_USESEMC);
|
||||
printf("#define\tPCB_SAVEEMC %d\n", &pcb->pcb_saveemc);
|
||||
printf("#define\tPCB_CMAP2 %d\n", &pcb->pcb_cmap2);
|
||||
printf("#define\tPCB_SIGC %d\n", pcb->pcb_sigc);
|
||||
printf("#define\tPCB_IML %d\n", &pcb->pcb_iml);
|
||||
printf("#define\tPCB_ONFAULT %d\n", &pcb->pcb_onfault);
|
||||
|
||||
printf("#define\tTF_ES %d\n", &tf->tf_es);
|
||||
printf("#define\tTF_DS %d\n", &tf->tf_ds);
|
||||
printf("#define\tTF_EDI %d\n", &tf->tf_edi);
|
||||
printf("#define\tTF_ESI %d\n", &tf->tf_esi);
|
||||
printf("#define\tTF_EBP %d\n", &tf->tf_ebp);
|
||||
printf("#define\tTF_ISP %d\n", &tf->tf_isp);
|
||||
printf("#define\tTF_EBX %d\n", &tf->tf_ebx);
|
||||
printf("#define\tTF_EDX %d\n", &tf->tf_edx);
|
||||
printf("#define\tTF_ECX %d\n", &tf->tf_ecx);
|
||||
printf("#define\tTF_EAX %d\n", &tf->tf_eax);
|
||||
printf("#define\tTF_TRAPNO %d\n", &tf->tf_trapno);
|
||||
printf("#define\tTF_ERR %d\n", &tf->tf_err);
|
||||
printf("#define\tTF_EIP %d\n", &tf->tf_eip);
|
||||
printf("#define\tTF_CS %d\n", &tf->tf_cs);
|
||||
printf("#define\tTF_EFLAGS %d\n", &tf->tf_eflags);
|
||||
printf("#define\tTF_ESP %d\n", &tf->tf_esp);
|
||||
printf("#define\tTF_SS %d\n", &tf->tf_ss);
|
||||
|
||||
printf("#define\tSIGF_SIGNUM %d\n", &sigf->sf_signum);
|
||||
printf("#define\tSIGF_CODE %d\n", &sigf->sf_code);
|
||||
printf("#define\tSIGF_SCP %d\n", &sigf->sf_scp);
|
||||
printf("#define\tSIGF_HANDLER %d\n", &sigf->sf_handler);
|
||||
printf("#define\tSIGF_SC %d\n", &sigf->sf_sc);
|
||||
|
||||
printf("#define\tB_READ %d\n", B_READ);
|
||||
printf("#define\tENOENT %d\n", ENOENT);
|
||||
printf("#define\tEFAULT %d\n", EFAULT);
|
||||
|
@ -33,19 +33,8 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
*
|
||||
* PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
|
||||
* -------------------- ----- ----------------------
|
||||
* CURRENT PATCH LEVEL: 5 00158
|
||||
* -------------------- ----- ----------------------
|
||||
*
|
||||
* 06 Aug 92 Pace Willisson Allow VGA memory to be mapped
|
||||
* 28 Nov 92 Frank MacLachlan Aligned addresses and data
|
||||
* on 32bit boundaries.
|
||||
* 25 Mar 93 Kevin Lahey Add syscall counter for vmstat
|
||||
* 20 Apr 93 Bruce Evans New npx-0.5 code
|
||||
* 25 Apr 93 Bruce Evans Support new interrupt code (intr-0.1)
|
||||
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
@ -55,6 +44,8 @@
|
||||
* Written by William F. Jolitz, 386BSD Project
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
|
||||
#include "assym.s"
|
||||
#include "machine/psl.h"
|
||||
#include "machine/pte.h"
|
||||
@ -65,6 +56,7 @@
|
||||
|
||||
#include "machine/specialreg.h"
|
||||
#include "i386/isa/debug.h"
|
||||
#include "machine/cputypes.h"
|
||||
|
||||
#define KDSEL 0x10
|
||||
#define SEL_RPL_MASK 0x0003
|
||||
@ -80,12 +72,9 @@
|
||||
.set SYSTEM,0xFE000000 # virtual address of system start
|
||||
/*note: gas copys sign bit (e.g. arithmetic >>), can't do SYSTEM>>22! */
|
||||
.set SYSPDROFF,0x3F8 # Page dir index of System Base
|
||||
.set SYSPDREND,0x3FA # Page dir index of System End
|
||||
.set SYSPDREND,0x3FB # Page dir index of System End
|
||||
|
||||
|
||||
/*
|
||||
* Macros
|
||||
*/
|
||||
#define ALIGN_DATA .align 2
|
||||
#define ALIGN_TEXT .align 2,0x90 /* 4-byte boundaries, NOP-filled */
|
||||
#define SUPERALIGN_TEXT .align 4,0x90 /* 16-byte boundaries better for 486 */
|
||||
@ -122,12 +111,12 @@
|
||||
|
||||
/* NB: NOP now preserves registers so NOPs can be inserted anywhere */
|
||||
/* XXX: NOP and FASTER_NOP are misleadingly named */
|
||||
#ifdef BROKEN_HARDWARE_AND_OR_SOFTWARE /* XXX - rarely necessary */
|
||||
#define FASTER_NOP pushl %eax ; inb $0x84,%al ; popl %eax
|
||||
#define NOP pushl %eax ; inb $0x84,%al ; inb $0x84,%al ; popl %eax
|
||||
#else
|
||||
#ifdef DUMMY_NOPS /* this will break some older machines */
|
||||
#define FASTER_NOP
|
||||
#define NOP
|
||||
#else
|
||||
#define FASTER_NOP pushl %eax ; inb $0x84,%al ; popl %eax
|
||||
#define NOP pushl %eax ; inb $0x84,%al ; inb $0x84,%al ; popl %eax
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -156,17 +145,19 @@
|
||||
* per-process address space (at the beginning), immediatly above
|
||||
* the user process stack.
|
||||
*/
|
||||
.globl _kstack
|
||||
.set _kstack, USRSTACK
|
||||
.globl _kstack
|
||||
.set PPDROFF,0x3F6
|
||||
.set PPTEOFF,0x400-UPAGES # 0x3FE
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Globals */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Globals
|
||||
*/
|
||||
.data
|
||||
.globl _esym
|
||||
_esym: .long 0 # ptr to end of syms
|
||||
|
||||
.globl _boothowto, _bootdev, _curpcb
|
||||
.globl __ucodesel,__udatasel
|
||||
|
||||
@ -174,7 +165,6 @@
|
||||
_cpu: .long 0 # are we 386, 386sx, or 486
|
||||
_cold: .long 1 # cold till we are not
|
||||
_atdevbase: .long 0 # location of start of iomem in virtual
|
||||
# .nonglobl _atdevphys (should be register or something)
|
||||
_atdevphys: .long 0 # location of device mapping ptes (phys)
|
||||
|
||||
.globl _IdlePTD, _KPTphys
|
||||
@ -185,19 +175,14 @@ _KPTphys: .long 0
|
||||
_cyloffset: .long 0
|
||||
_proc0paddr: .long 0
|
||||
|
||||
#ifdef SHOW_A_LOT
|
||||
bit_colors:
|
||||
.byte GREEN,RED,0,0
|
||||
#endif
|
||||
|
||||
.space 512
|
||||
tmpstk:
|
||||
|
||||
|
||||
/*
|
||||
* System Initialization
|
||||
*/
|
||||
.text
|
||||
/*****************************************************************************/
|
||||
/* System Initialisation */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* btext: beginning of text section.
|
||||
@ -209,7 +194,7 @@ ENTRY(btext)
|
||||
.space 0x500 # skip over warm boot shit
|
||||
|
||||
/*
|
||||
* pass parameters on stack (howto, bootdev, unit, cyloffset)
|
||||
* pass parameters on stack (howto, bootdev, unit, cyloffset, esym)
|
||||
* note: (%esp) is return address of boot
|
||||
* ( if we want to hold onto /boot, it's physical %esp up to _end)
|
||||
*/
|
||||
@ -220,6 +205,31 @@ ENTRY(btext)
|
||||
movl %eax,_bootdev-SYSTEM
|
||||
movl 12(%esp),%eax
|
||||
movl %eax, _cyloffset-SYSTEM
|
||||
movl 16(%esp),%eax
|
||||
addl $ SYSTEM,%eax
|
||||
movl %eax, _esym-SYSTEM
|
||||
|
||||
/* find out our CPU type. */
|
||||
pushfl
|
||||
popl %eax
|
||||
movl %eax,%ecx
|
||||
xorl $0x40000,%eax
|
||||
pushl %eax
|
||||
popfl
|
||||
pushfl
|
||||
popl %eax
|
||||
xorl %ecx,%eax
|
||||
shrl $18,%eax
|
||||
andl $1,%eax
|
||||
push %ecx
|
||||
popfl
|
||||
|
||||
cmpl $0,%eax
|
||||
jne 1f
|
||||
movl $CPU_386,_cpu-SYSTEM
|
||||
jmp 2f
|
||||
1: movl $CPU_486,_cpu-SYSTEM
|
||||
2:
|
||||
|
||||
/*
|
||||
* Finished with old stack; load new %esp now instead of later so
|
||||
@ -344,8 +354,8 @@ ENTRY(btext)
|
||||
movl %eax,(%esi) # which is where temp maps!
|
||||
|
||||
/* kernel pde's */
|
||||
movl $(SYSPDREND-SYSPDROFF+1), %ecx # for this many pde s,
|
||||
lea (SYSPDROFF*4)(%esi), %ebx # offset of pde for kernel
|
||||
movl $(SYSPDREND-SYSPDROFF), %ecx # for this many pde s,
|
||||
lea (SYSPDROFF*4)(%esi), %ebx # offset of pde for kernel
|
||||
fillkpt
|
||||
|
||||
/* install a pde recursively mapping page directory as a page table! */
|
||||
@ -884,6 +894,12 @@ show_bits:
|
||||
SHOW_BIT(15)
|
||||
popl %eax
|
||||
ret
|
||||
|
||||
.data
|
||||
bit_colors:
|
||||
.byte GREEN,RED,0,0
|
||||
.text
|
||||
|
||||
#endif /* SHOW_A_LOT */
|
||||
|
||||
|
||||
|
@ -33,19 +33,8 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
*
|
||||
* PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
|
||||
* -------------------- ----- ----------------------
|
||||
* CURRENT PATCH LEVEL: 5 00158
|
||||
* -------------------- ----- ----------------------
|
||||
*
|
||||
* 06 Aug 92 Pace Willisson Allow VGA memory to be mapped
|
||||
* 28 Nov 92 Frank MacLachlan Aligned addresses and data
|
||||
* on 32bit boundaries.
|
||||
* 25 Mar 93 Kevin Lahey Add syscall counter for vmstat
|
||||
* 20 Apr 93 Bruce Evans New npx-0.5 code
|
||||
* 25 Apr 93 Bruce Evans Support new interrupt code (intr-0.1)
|
||||
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
@ -55,6 +44,8 @@
|
||||
* Written by William F. Jolitz, 386BSD Project
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
|
||||
#include "assym.s"
|
||||
#include "machine/psl.h"
|
||||
#include "machine/pte.h"
|
||||
@ -65,6 +56,7 @@
|
||||
|
||||
#include "machine/specialreg.h"
|
||||
#include "i386/isa/debug.h"
|
||||
#include "machine/cputypes.h"
|
||||
|
||||
#define KDSEL 0x10
|
||||
#define SEL_RPL_MASK 0x0003
|
||||
@ -80,12 +72,9 @@
|
||||
.set SYSTEM,0xFE000000 # virtual address of system start
|
||||
/*note: gas copys sign bit (e.g. arithmetic >>), can't do SYSTEM>>22! */
|
||||
.set SYSPDROFF,0x3F8 # Page dir index of System Base
|
||||
.set SYSPDREND,0x3FA # Page dir index of System End
|
||||
.set SYSPDREND,0x3FB # Page dir index of System End
|
||||
|
||||
|
||||
/*
|
||||
* Macros
|
||||
*/
|
||||
#define ALIGN_DATA .align 2
|
||||
#define ALIGN_TEXT .align 2,0x90 /* 4-byte boundaries, NOP-filled */
|
||||
#define SUPERALIGN_TEXT .align 4,0x90 /* 16-byte boundaries better for 486 */
|
||||
@ -122,12 +111,12 @@
|
||||
|
||||
/* NB: NOP now preserves registers so NOPs can be inserted anywhere */
|
||||
/* XXX: NOP and FASTER_NOP are misleadingly named */
|
||||
#ifdef BROKEN_HARDWARE_AND_OR_SOFTWARE /* XXX - rarely necessary */
|
||||
#define FASTER_NOP pushl %eax ; inb $0x84,%al ; popl %eax
|
||||
#define NOP pushl %eax ; inb $0x84,%al ; inb $0x84,%al ; popl %eax
|
||||
#else
|
||||
#ifdef DUMMY_NOPS /* this will break some older machines */
|
||||
#define FASTER_NOP
|
||||
#define NOP
|
||||
#else
|
||||
#define FASTER_NOP pushl %eax ; inb $0x84,%al ; popl %eax
|
||||
#define NOP pushl %eax ; inb $0x84,%al ; inb $0x84,%al ; popl %eax
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -156,17 +145,19 @@
|
||||
* per-process address space (at the beginning), immediatly above
|
||||
* the user process stack.
|
||||
*/
|
||||
.globl _kstack
|
||||
.set _kstack, USRSTACK
|
||||
.globl _kstack
|
||||
.set PPDROFF,0x3F6
|
||||
.set PPTEOFF,0x400-UPAGES # 0x3FE
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Globals */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Globals
|
||||
*/
|
||||
.data
|
||||
.globl _esym
|
||||
_esym: .long 0 # ptr to end of syms
|
||||
|
||||
.globl _boothowto, _bootdev, _curpcb
|
||||
.globl __ucodesel,__udatasel
|
||||
|
||||
@ -174,7 +165,6 @@
|
||||
_cpu: .long 0 # are we 386, 386sx, or 486
|
||||
_cold: .long 1 # cold till we are not
|
||||
_atdevbase: .long 0 # location of start of iomem in virtual
|
||||
# .nonglobl _atdevphys (should be register or something)
|
||||
_atdevphys: .long 0 # location of device mapping ptes (phys)
|
||||
|
||||
.globl _IdlePTD, _KPTphys
|
||||
@ -185,19 +175,14 @@ _KPTphys: .long 0
|
||||
_cyloffset: .long 0
|
||||
_proc0paddr: .long 0
|
||||
|
||||
#ifdef SHOW_A_LOT
|
||||
bit_colors:
|
||||
.byte GREEN,RED,0,0
|
||||
#endif
|
||||
|
||||
.space 512
|
||||
tmpstk:
|
||||
|
||||
|
||||
/*
|
||||
* System Initialization
|
||||
*/
|
||||
.text
|
||||
/*****************************************************************************/
|
||||
/* System Initialisation */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* btext: beginning of text section.
|
||||
@ -209,7 +194,7 @@ ENTRY(btext)
|
||||
.space 0x500 # skip over warm boot shit
|
||||
|
||||
/*
|
||||
* pass parameters on stack (howto, bootdev, unit, cyloffset)
|
||||
* pass parameters on stack (howto, bootdev, unit, cyloffset, esym)
|
||||
* note: (%esp) is return address of boot
|
||||
* ( if we want to hold onto /boot, it's physical %esp up to _end)
|
||||
*/
|
||||
@ -220,6 +205,31 @@ ENTRY(btext)
|
||||
movl %eax,_bootdev-SYSTEM
|
||||
movl 12(%esp),%eax
|
||||
movl %eax, _cyloffset-SYSTEM
|
||||
movl 16(%esp),%eax
|
||||
addl $ SYSTEM,%eax
|
||||
movl %eax, _esym-SYSTEM
|
||||
|
||||
/* find out our CPU type. */
|
||||
pushfl
|
||||
popl %eax
|
||||
movl %eax,%ecx
|
||||
xorl $0x40000,%eax
|
||||
pushl %eax
|
||||
popfl
|
||||
pushfl
|
||||
popl %eax
|
||||
xorl %ecx,%eax
|
||||
shrl $18,%eax
|
||||
andl $1,%eax
|
||||
push %ecx
|
||||
popfl
|
||||
|
||||
cmpl $0,%eax
|
||||
jne 1f
|
||||
movl $CPU_386,_cpu-SYSTEM
|
||||
jmp 2f
|
||||
1: movl $CPU_486,_cpu-SYSTEM
|
||||
2:
|
||||
|
||||
/*
|
||||
* Finished with old stack; load new %esp now instead of later so
|
||||
@ -344,8 +354,8 @@ ENTRY(btext)
|
||||
movl %eax,(%esi) # which is where temp maps!
|
||||
|
||||
/* kernel pde's */
|
||||
movl $(SYSPDREND-SYSPDROFF+1), %ecx # for this many pde s,
|
||||
lea (SYSPDROFF*4)(%esi), %ebx # offset of pde for kernel
|
||||
movl $(SYSPDREND-SYSPDROFF), %ecx # for this many pde s,
|
||||
lea (SYSPDROFF*4)(%esi), %ebx # offset of pde for kernel
|
||||
fillkpt
|
||||
|
||||
/* install a pde recursively mapping page directory as a page table! */
|
||||
@ -884,6 +894,12 @@ show_bits:
|
||||
SHOW_BIT(15)
|
||||
popl %eax
|
||||
ret
|
||||
|
||||
.data
|
||||
bit_colors:
|
||||
.byte GREEN,RED,0,0
|
||||
.text
|
||||
|
||||
#endif /* SHOW_A_LOT */
|
||||
|
||||
|
||||
|
@ -35,17 +35,21 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id$
|
||||
* $Id: machdep.c,v 1.8 1993/10/08 10:47:13 rgrimes Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
#include "isa.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include "param.h"
|
||||
#include "systm.h"
|
||||
#include "signalvar.h"
|
||||
#include "kernel.h"
|
||||
#include "map.h"
|
||||
#include "proc.h"
|
||||
#include "user.h"
|
||||
#include "exec.h" /* for PS_STRINGS */
|
||||
#include "buf.h"
|
||||
#include "reboot.h"
|
||||
#include "conf.h"
|
||||
@ -56,21 +60,35 @@
|
||||
#include "msgbuf.h"
|
||||
#include "net/netisr.h"
|
||||
|
||||
#ifdef SYSVSHM
|
||||
#include "sys/shm.h"
|
||||
#endif
|
||||
|
||||
#include "vm/vm.h"
|
||||
#include "vm/vm_kern.h"
|
||||
#include "vm/vm_page.h"
|
||||
|
||||
#include "sys/exec.h"
|
||||
#include "sys/vnode.h"
|
||||
|
||||
#ifndef MACHINE_NONCONTIG
|
||||
extern vm_offset_t avail_end;
|
||||
#else
|
||||
extern vm_offset_t avail_start, avail_end;
|
||||
static vm_offset_t hole_start, hole_end;
|
||||
static vm_offset_t avail_next;
|
||||
static unsigned int avail_remaining;
|
||||
#endif /* MACHINE_NONCONTIG */
|
||||
|
||||
#include "machine/cpu.h"
|
||||
#include "machine/reg.h"
|
||||
#include "machine/psl.h"
|
||||
#include "machine/specialreg.h"
|
||||
#include "machine/sysarch.h"
|
||||
|
||||
#include "i386/isa/isa.h"
|
||||
#include "i386/isa/rtc.h"
|
||||
|
||||
#ifdef SYSVSHM
|
||||
#include "sys/shm.h"
|
||||
#endif /* SYSVSHM */
|
||||
|
||||
#define EXPECT_BASEMEM 640 /* The expected base memory*/
|
||||
#define INFORM_WAIT 1 /* Set to pause berfore crash in weird cases*/
|
||||
@ -89,9 +107,10 @@ int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
int msgbufmapped; /* set when safe to use msgbuf */
|
||||
extern int freebufspace;
|
||||
|
||||
int _udatasel, _ucodesel;
|
||||
|
||||
/*
|
||||
* Machine-dependent startup code
|
||||
*/
|
||||
@ -106,6 +125,11 @@ int biosmem;
|
||||
|
||||
extern cyloffset;
|
||||
|
||||
int cpu_class;
|
||||
|
||||
void dumpsys __P((void));
|
||||
|
||||
void
|
||||
cpu_startup()
|
||||
{
|
||||
register int unixsize;
|
||||
@ -125,18 +149,21 @@ cpu_startup()
|
||||
|
||||
/* avail_end was pre-decremented in pmap_bootstrap to compensate */
|
||||
for (i = 0; i < btoc(sizeof (struct msgbuf)); i++)
|
||||
#ifndef MACHINE_NONCONTIG
|
||||
pmap_enter(pmap_kernel(), msgbufp, avail_end + i * NBPG,
|
||||
VM_PROT_ALL, TRUE);
|
||||
#else
|
||||
pmap_enter(pmap_kernel(), (caddr_t)msgbufp + i * NBPG,
|
||||
avail_end + i * NBPG, VM_PROT_ALL, TRUE);
|
||||
#endif
|
||||
msgbufmapped = 1;
|
||||
|
||||
#ifdef KDB
|
||||
kdb_init(); /* startup kernel debugger */
|
||||
#endif
|
||||
/*
|
||||
* Good {morning,afternoon,evening,night}.
|
||||
*/
|
||||
/*printf(version);
|
||||
printf("real mem = %d\n", ctob(physmem));*/
|
||||
printf(version);
|
||||
identifycpu();
|
||||
printf("real mem = %d\n", ctob(physmem));
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures.
|
||||
@ -161,7 +188,11 @@ cpu_startup()
|
||||
(name) = (type *)v; v = (caddr_t)((name)+(num))
|
||||
#define valloclim(name, type, num, lim) \
|
||||
(name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
|
||||
/* valloc(cfree, struct cblock, nclist); no clists any more!!! - cgd */
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef NetBSD
|
||||
valloc(swapmap, struct map, nswapmap = maxproc * 2);
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
@ -172,14 +203,10 @@ cpu_startup()
|
||||
* We allocate 1/2 as many swap buffer headers as file i/o buffers.
|
||||
*/
|
||||
if (bufpages == 0)
|
||||
if (physmem < (2 * 1024 * 1024))
|
||||
bufpages = physmem / 10 / CLSIZE;
|
||||
else
|
||||
bufpages = ((2 * 1024 * 1024 + physmem) / 20) / CLSIZE;
|
||||
/*
|
||||
* 15 Aug 92 William Jolitz bufpages fix for too large
|
||||
*/
|
||||
bufpages = min( NKMEMCLUSTERS*2/5, bufpages);
|
||||
if (physmem < btoc(2 * 1024 * 1024))
|
||||
bufpages = physmem / 10 / CLSIZE;
|
||||
else
|
||||
bufpages = (btoc(2 * 1024 * 1024) + physmem) / 20 / CLSIZE;
|
||||
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages / 2;
|
||||
@ -210,11 +237,20 @@ cpu_startup()
|
||||
*/
|
||||
if ((vm_size_t)(v - firstaddr) != size)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
* Allocate a submap for buffer space allocations.
|
||||
*/
|
||||
buffer_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
bufpages*NBPG, TRUE);
|
||||
/*
|
||||
* Allocate a submap for exec arguments. This map effectively
|
||||
* limits the number of processes exec'ing at any time.
|
||||
*/
|
||||
/* exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
* 16*NCARGS, TRUE);
|
||||
* NOT CURRENTLY USED -- cgd
|
||||
*/
|
||||
/*
|
||||
* Allocate a submap for physio
|
||||
*/
|
||||
@ -237,7 +273,9 @@ cpu_startup()
|
||||
for (i = 1; i < ncallout; i++)
|
||||
callout[i-1].c_next = &callout[i];
|
||||
|
||||
/*printf("avail mem = %d\n", ptoa(vm_page_free_count));*/
|
||||
printf("avail mem = %d\n", ptoa(vm_page_free_count));
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
|
||||
/*
|
||||
* Set up CPU-specific registers, cache, etc.
|
||||
@ -255,6 +293,67 @@ cpu_startup()
|
||||
configure();
|
||||
}
|
||||
|
||||
|
||||
struct cpu_nameclass i386_cpus[] = {
|
||||
{ "Intel 80286", CPUCLASS_286 }, /* CPU_286 */
|
||||
{ "i386SX", CPUCLASS_386 }, /* CPU_386SX */
|
||||
{ "i386DX", CPUCLASS_386 }, /* CPU_386 */
|
||||
{ "i486SX", CPUCLASS_486 }, /* CPU_486SX */
|
||||
{ "i486DX", CPUCLASS_486 }, /* CPU_486 */
|
||||
{ "i586", CPUCLASS_586 }, /* CPU_586 */
|
||||
};
|
||||
|
||||
identifycpu() /* translated from hp300 -- cgd */
|
||||
{
|
||||
printf("CPU: ");
|
||||
if (cpu >= 0 && cpu < (sizeof i386_cpus/sizeof(struct cpu_nameclass))) {
|
||||
printf("%s", i386_cpus[cpu].cpu_name);
|
||||
cpu_class = i386_cpus[cpu].cpu_class;
|
||||
} else {
|
||||
printf("unknown cpu type %d\n", cpu);
|
||||
panic("startup: bad cpu id");
|
||||
}
|
||||
printf(" (");
|
||||
switch(cpu_class) {
|
||||
case CPUCLASS_286:
|
||||
printf("286");
|
||||
break;
|
||||
case CPUCLASS_386:
|
||||
printf("386");
|
||||
break;
|
||||
case CPUCLASS_486:
|
||||
printf("486");
|
||||
break;
|
||||
case CPUCLASS_586:
|
||||
printf("586");
|
||||
break;
|
||||
default:
|
||||
printf("unknown"); /* will panic below... */
|
||||
}
|
||||
printf("-class CPU)");
|
||||
printf("\n"); /* cpu speed would be nice, but how? */
|
||||
|
||||
/*
|
||||
* Now that we have told the user what they have,
|
||||
* let them know if that machine type isn't configured.
|
||||
*/
|
||||
switch (cpu_class) {
|
||||
case CPUCLASS_286: /* a 286 should not make it this far, anyway */
|
||||
#if !defined(I386_CPU)
|
||||
case CPUCLASS_386:
|
||||
#endif
|
||||
#if !defined(I486_CPU)
|
||||
case CPUCLASS_486:
|
||||
#endif
|
||||
#if !defined(I586_CPU)
|
||||
case CPUCLASS_586:
|
||||
#endif
|
||||
panic("CPU class not configured");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PGINPROF
|
||||
/*
|
||||
* Return the difference (in microseconds)
|
||||
@ -273,17 +372,6 @@ vmtime(otime, olbolt, oicr)
|
||||
}
|
||||
#endif
|
||||
|
||||
struct sigframe {
|
||||
int sf_signum;
|
||||
int sf_code;
|
||||
struct sigcontext *sf_scp;
|
||||
sig_t sf_handler;
|
||||
int sf_eax;
|
||||
int sf_edx;
|
||||
int sf_ecx;
|
||||
struct sigcontext sf_sc;
|
||||
} ;
|
||||
|
||||
extern int kstack[];
|
||||
|
||||
/*
|
||||
@ -398,7 +486,6 @@ sendsig(catcher, sig, mask, code)
|
||||
* psl to gain improper priviledges or to cause
|
||||
* a machine fault.
|
||||
*/
|
||||
|
||||
struct sigreturn_args {
|
||||
struct sigcontext *sigcntxp;
|
||||
};
|
||||
@ -412,7 +499,6 @@ sigreturn(p, uap, retval)
|
||||
register struct sigframe *fp;
|
||||
register int *regs = p->p_regs;
|
||||
|
||||
|
||||
/*
|
||||
* (XXX old comment) regs[sESP] points to the return address.
|
||||
* The user scp pointer is above that.
|
||||
@ -448,16 +534,25 @@ sigreturn(p, uap, retval)
|
||||
return(EJUSTRETURN);
|
||||
}
|
||||
|
||||
/*
|
||||
* a simple function to make the system panic (and dump a vmcore)
|
||||
* in a predictable fashion
|
||||
*/
|
||||
void diediedie()
|
||||
{
|
||||
panic("because you said to!");
|
||||
}
|
||||
|
||||
int waittime = -1;
|
||||
struct pcb dumppcb;
|
||||
|
||||
void
|
||||
boot(arghowto)
|
||||
int arghowto;
|
||||
{
|
||||
register long dummy; /* r12 is reserved */
|
||||
register int howto; /* r11 == how to boot */
|
||||
register int devtype; /* r10 == major of root dev */
|
||||
extern char *panicstr;
|
||||
extern int cold;
|
||||
int nomsg = 1;
|
||||
|
||||
@ -472,12 +567,20 @@ boot(arghowto)
|
||||
|
||||
waittime = 0;
|
||||
(void) splnet();
|
||||
printf("syncing disks... ");
|
||||
/*
|
||||
* Release inodes held by texts before update.
|
||||
*/
|
||||
if (panicstr == 0)
|
||||
vnode_pager_umount(NULL);
|
||||
sync((struct sigcontext *)0);
|
||||
/*
|
||||
* Unmount filesystems
|
||||
*/
|
||||
#if 0
|
||||
if (panicstr == 0)
|
||||
vfs_unmountall();
|
||||
#endif
|
||||
|
||||
for (iter = 0; iter < 20; iter++) {
|
||||
nbusy = 0;
|
||||
@ -490,19 +593,22 @@ boot(arghowto)
|
||||
printf("updating disks before rebooting... ");
|
||||
nomsg = 0;
|
||||
}
|
||||
/* printf("%d ", nbusy); */
|
||||
printf("%d ", nbusy);
|
||||
DELAY(40000 * iter);
|
||||
}
|
||||
if (nbusy)
|
||||
printf(" failed!\n");
|
||||
else if (nomsg == 0)
|
||||
printf("succeded.\n");
|
||||
printf("giving up\n");
|
||||
else
|
||||
printf("done\n");
|
||||
DELAY(10000); /* wait for printf to finish */
|
||||
}
|
||||
splhigh();
|
||||
devtype = major(rootdev);
|
||||
if (howto&RB_HALT) {
|
||||
pg("\nThe operating system has halted. Please press any key to reboot.\n\n");
|
||||
printf("\n");
|
||||
printf("The operating system has halted.\n");
|
||||
printf("Please press any key to reboot.\n\n");
|
||||
cngetc();
|
||||
} else {
|
||||
if (howto & RB_DUMP) {
|
||||
savectx(&dumppcb, 0);
|
||||
@ -520,13 +626,14 @@ boot(arghowto)
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
u_int dumpmag = 0x8fca0101; /* magic number for savecore */
|
||||
int dumpsize = 0; /* also for savecore */
|
||||
unsigned dumpmag = 0x8fca0101; /* magic number for savecore */
|
||||
int dumpsize = 0; /* also for savecore */
|
||||
/*
|
||||
* Doadump comes here after turning off memory management and
|
||||
* getting on the dump stack, either when called above, or by
|
||||
* the auto-restart code.
|
||||
*/
|
||||
void
|
||||
dumpsys()
|
||||
{
|
||||
|
||||
@ -534,37 +641,37 @@ dumpsys()
|
||||
return;
|
||||
if ((minor(dumpdev)&07) != 1)
|
||||
return;
|
||||
printf("\nThe operating system is saving a copy of RAM memory to device %x, offset %d\n\
|
||||
(hit any key to abort): [ amount left to save (MB) ] ", dumpdev, dumplo);
|
||||
dumpsize = physmem;
|
||||
printf("\ndumping to dev %x, offset %d\n", dumpdev, dumplo);
|
||||
printf("dump ");
|
||||
switch ((*bdevsw[major(dumpdev)].d_dump)(dumpdev)) {
|
||||
|
||||
case ENXIO:
|
||||
printf("-- device bad\n");
|
||||
printf("device bad\n");
|
||||
break;
|
||||
|
||||
case EFAULT:
|
||||
printf("-- device not ready\n");
|
||||
printf("device not ready\n");
|
||||
break;
|
||||
|
||||
case EINVAL:
|
||||
printf("-- area improper\n");
|
||||
printf("area improper\n");
|
||||
break;
|
||||
|
||||
case EIO:
|
||||
printf("-- i/o error\n");
|
||||
printf("i/o error\n");
|
||||
break;
|
||||
|
||||
case EINTR:
|
||||
printf("-- aborted from console\n");
|
||||
printf("aborted from console\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
printf(" succeeded\n");
|
||||
printf("succeeded\n");
|
||||
break;
|
||||
}
|
||||
printf("system rebooting.\n\n");
|
||||
DELAY(10000);
|
||||
printf("\n\n");
|
||||
DELAY(1000);
|
||||
}
|
||||
|
||||
#ifdef HZ
|
||||
@ -624,6 +731,7 @@ initcpu()
|
||||
/*
|
||||
* Clear registers on exec
|
||||
*/
|
||||
void
|
||||
setregs(p, entry)
|
||||
struct proc *p;
|
||||
u_long entry;
|
||||
@ -634,7 +742,7 @@ setregs(p, entry)
|
||||
|
||||
p->p_addr->u_pcb.pcb_flags = 0; /* no fp at all */
|
||||
load_cr0(rcr0() | CR0_TS); /* start emulating */
|
||||
#ifdef NPX
|
||||
#if NNPX > 0
|
||||
npxinit(__INITIAL_NPXCW__);
|
||||
#endif
|
||||
}
|
||||
@ -648,7 +756,6 @@ setregs(p, entry)
|
||||
*/
|
||||
#define DESCRIPTOR_SIZE 8
|
||||
|
||||
|
||||
#define GNULL_SEL 0 /* Null Descriptor */
|
||||
#define GCODE_SEL 1 /* Kernel Code Descriptor */
|
||||
#define GDATA_SEL 2 /* Kernel Data Descriptor */
|
||||
@ -678,15 +785,15 @@ struct i386tss tss, panic_tss;
|
||||
|
||||
extern struct user *proc0paddr;
|
||||
|
||||
/* software prototypes -- in more palitable form */
|
||||
/* software prototypes -- in more palatable form */
|
||||
struct soft_segment_descriptor gdt_segs[] = {
|
||||
/* Null Descriptor */
|
||||
{ 0x0, /* segment base address */
|
||||
0x0, /* length - all address space */
|
||||
0x0, /* length */
|
||||
0, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
0, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* Code Descriptor for kernel */
|
||||
@ -695,7 +802,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
SDT_MEMERA, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
1, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* Data Descriptor for kernel */
|
||||
@ -704,7 +811,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
SDT_MEMRWA, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
1, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* LDT Descriptor */
|
||||
@ -713,7 +820,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
SDT_SYSLDT, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
0, /* unused - default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* Null Descriptor - Placeholder */
|
||||
@ -722,7 +829,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
0, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
0, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* Panic Tss Descriptor */
|
||||
@ -731,7 +838,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
SDT_SYS386TSS, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
0, /* unused - default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* Proc 0 Tss Descriptor */
|
||||
@ -740,7 +847,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
SDT_SYS386TSS, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
0, /* unused - default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ }};
|
||||
|
||||
@ -751,7 +858,7 @@ struct soft_segment_descriptor ldt_segs[] = {
|
||||
0, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
0, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* Null Descriptor - overwritten by call gate */
|
||||
@ -760,7 +867,7 @@ struct soft_segment_descriptor ldt_segs[] = {
|
||||
0, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
0, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* Null Descriptor - overwritten by call gate */
|
||||
@ -769,7 +876,7 @@ struct soft_segment_descriptor ldt_segs[] = {
|
||||
0, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
0, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* Code Descriptor for user */
|
||||
@ -778,7 +885,7 @@ struct soft_segment_descriptor ldt_segs[] = {
|
||||
SDT_MEMERA, /* segment type */
|
||||
SEL_UPL, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
1, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* Data Descriptor for user */
|
||||
@ -787,7 +894,7 @@ struct soft_segment_descriptor ldt_segs[] = {
|
||||
SDT_MEMRWA, /* segment type */
|
||||
SEL_UPL, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
1, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ } };
|
||||
|
||||
@ -815,7 +922,7 @@ extern IDTVEC(div), IDTVEC(dbg), IDTVEC(nmi), IDTVEC(bpt), IDTVEC(ofl),
|
||||
IDTVEC(rsvd13), IDTVEC(rsvd14), IDTVEC(rsvd14), IDTVEC(syscall);
|
||||
|
||||
int lcr0(), lcr3(), rcr0(), rcr2();
|
||||
int _udatasel, _ucodesel, _gsel_tss;
|
||||
int _gsel_tss;
|
||||
|
||||
init386(first)
|
||||
{
|
||||
@ -979,15 +1086,17 @@ init386(first)
|
||||
* If they get working well enough to recompile, they can unset
|
||||
* the flag; otherwise, it's a toy and they have to lump it.
|
||||
*/
|
||||
getchar(); /* kernel getchar in /sys/i386/isa/pccons.c*/
|
||||
cngetc();
|
||||
#endif /* !INFORM_WAIT*/
|
||||
}
|
||||
/*
|
||||
* End of CMOS bux fix
|
||||
*/
|
||||
|
||||
/* call pmap initialization to make new kernel address space */
|
||||
#ifndef MACHINCE_NONCONTIG
|
||||
pmap_bootstrap (first, 0);
|
||||
#else
|
||||
pmap_bootstrap ((vm_offset_t)atdevbase + IOM_SIZE);
|
||||
|
||||
#endif /* MACHINE_NONCONTIG */
|
||||
/* now running on new page tables, configured,and u/iom is accessible */
|
||||
|
||||
/* make a initial tss so microp can get interrupt stack on syscall! */
|
||||
@ -1034,13 +1143,16 @@ clearseg(n) {
|
||||
*(int *)CMAP2 = PG_V | PG_KW | ctob(n);
|
||||
load_cr3(rcr3());
|
||||
bzero(CADDR2,NBPG);
|
||||
#ifndef MACHINE_NONCONTIG
|
||||
*(int *) CADDR2 = 0;
|
||||
#endif /* MACHINE_NONCONTIG */
|
||||
}
|
||||
|
||||
/*
|
||||
* copy a page of physical memory
|
||||
* specified in relocation units (NBPG bytes)
|
||||
*/
|
||||
void
|
||||
copyseg(frm, n) {
|
||||
|
||||
*(int *)CMAP2 = PG_V | PG_KW | ctob(n);
|
||||
@ -1052,6 +1164,7 @@ copyseg(frm, n) {
|
||||
* copy a page of physical memory
|
||||
* specified in relocation units (NBPG bytes)
|
||||
*/
|
||||
void
|
||||
physcopyseg(frm, to) {
|
||||
|
||||
*(int *)CMAP1 = PG_V | PG_KW | ctob(frm);
|
||||
@ -1064,6 +1177,7 @@ physcopyseg(frm, to) {
|
||||
schednetisr(NETISR_AST);
|
||||
}*/
|
||||
|
||||
void
|
||||
setsoftclock() {
|
||||
schednetisr(NETISR_SCLK);
|
||||
}
|
||||
|
@ -33,21 +33,9 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)genassym.c 5.11 (Berkeley) 5/10/91
|
||||
*
|
||||
* PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
|
||||
* -------------------- ----- ----------------------
|
||||
* CURRENT PATCH LEVEL: 1 00154
|
||||
* -------------------- ----- ----------------------
|
||||
*
|
||||
* 24 Apr 93 Bruce Evans/Dave Rivers Npx-0.5 support
|
||||
*
|
||||
* from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
|
||||
* $Id$
|
||||
*/
|
||||
static char rcsid[] = "$Header: /usr/bill/working/sys/i386/i386/RCS/genassym.c,v 1.2 92/01/21 14:22:02 william Exp $";
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)genassym.c 5.11 (Berkeley) 5/10/91";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "sys/param.h"
|
||||
#include "sys/buf.h"
|
||||
@ -60,7 +48,6 @@ static char sccsid[] = "@(#)genassym.c 5.11 (Berkeley) 5/10/91";
|
||||
#include "machine/cpu.h"
|
||||
#include "machine/trap.h"
|
||||
#include "machine/psl.h"
|
||||
#include "machine/reg.h"
|
||||
#include "sys/syscall.h"
|
||||
#include "vm/vm_param.h"
|
||||
#include "vm/vm_map.h"
|
||||
@ -77,6 +64,8 @@ main()
|
||||
vm_map_t map = (vm_map_t)0;
|
||||
pmap_t pmap = (pmap_t)0;
|
||||
struct pcb *pcb = (struct pcb *)0;
|
||||
struct trapframe *tf = (struct trapframe *)0;
|
||||
struct sigframe *sigf = (struct sigframe *)0;
|
||||
register unsigned i;
|
||||
|
||||
printf("#define\tI386_CR3PAT %d\n", I386_CR3PAT);
|
||||
@ -115,6 +104,7 @@ main()
|
||||
printf("#define\tSHMMAXPGS %d\n", SHMMAXPGS);
|
||||
#endif
|
||||
printf("#define\tUSRSTACK %d\n", USRSTACK);
|
||||
printf("#define\tKERNBASE %d\n", KERNBASE);
|
||||
printf("#define\tMSGBUFPTECNT %d\n", btoc(sizeof (struct msgbuf)));
|
||||
printf("#define\tNMBCLUSTERS %d\n", NMBCLUSTERS);
|
||||
printf("#define\tMCLBYTES %d\n", MCLBYTES);
|
||||
@ -143,6 +133,7 @@ main()
|
||||
printf("#define\tPCB_FS %d\n", &pcb->pcb_tss.tss_fs);
|
||||
printf("#define\tPCB_GS %d\n", &pcb->pcb_tss.tss_gs);
|
||||
printf("#define\tPCB_LDT %d\n", &pcb->pcb_tss.tss_ldt);
|
||||
printf("#define\tPCB_USERLDT %d\n", &pcb->pcb_ldt);
|
||||
printf("#define\tPCB_IOOPT %d\n", &pcb->pcb_tss.tss_ioopt);
|
||||
printf("#define\tNKMEMCLUSTERS %d\n", NKMEMCLUSTERS);
|
||||
printf("#define\tU_PROF %d\n", &up->u_stats.p_prof);
|
||||
@ -154,18 +145,36 @@ main()
|
||||
printf("#define\tRU_MINFLT %d\n", &rup->ru_minflt);
|
||||
printf("#define\tPCB_FLAGS %d\n", &pcb->pcb_flags);
|
||||
printf("#define\tPCB_SAVEFPU %d\n", &pcb->pcb_savefpu);
|
||||
#ifdef notused
|
||||
printf("#define\tFP_WASUSED %d\n", FP_WASUSED);
|
||||
printf("#define\tFP_NEEDSSAVE %d\n", FP_NEEDSSAVE);
|
||||
printf("#define\tFP_NEEDSRESTORE %d\n", FP_NEEDSRESTORE);
|
||||
#endif
|
||||
printf("#define\tFP_USESEMC %d\n", FP_USESEMC);
|
||||
printf("#define\tPCB_SAVEEMC %d\n", &pcb->pcb_saveemc);
|
||||
printf("#define\tPCB_CMAP2 %d\n", &pcb->pcb_cmap2);
|
||||
printf("#define\tPCB_SIGC %d\n", pcb->pcb_sigc);
|
||||
printf("#define\tPCB_IML %d\n", &pcb->pcb_iml);
|
||||
printf("#define\tPCB_ONFAULT %d\n", &pcb->pcb_onfault);
|
||||
|
||||
printf("#define\tTF_ES %d\n", &tf->tf_es);
|
||||
printf("#define\tTF_DS %d\n", &tf->tf_ds);
|
||||
printf("#define\tTF_EDI %d\n", &tf->tf_edi);
|
||||
printf("#define\tTF_ESI %d\n", &tf->tf_esi);
|
||||
printf("#define\tTF_EBP %d\n", &tf->tf_ebp);
|
||||
printf("#define\tTF_ISP %d\n", &tf->tf_isp);
|
||||
printf("#define\tTF_EBX %d\n", &tf->tf_ebx);
|
||||
printf("#define\tTF_EDX %d\n", &tf->tf_edx);
|
||||
printf("#define\tTF_ECX %d\n", &tf->tf_ecx);
|
||||
printf("#define\tTF_EAX %d\n", &tf->tf_eax);
|
||||
printf("#define\tTF_TRAPNO %d\n", &tf->tf_trapno);
|
||||
printf("#define\tTF_ERR %d\n", &tf->tf_err);
|
||||
printf("#define\tTF_EIP %d\n", &tf->tf_eip);
|
||||
printf("#define\tTF_CS %d\n", &tf->tf_cs);
|
||||
printf("#define\tTF_EFLAGS %d\n", &tf->tf_eflags);
|
||||
printf("#define\tTF_ESP %d\n", &tf->tf_esp);
|
||||
printf("#define\tTF_SS %d\n", &tf->tf_ss);
|
||||
|
||||
printf("#define\tSIGF_SIGNUM %d\n", &sigf->sf_signum);
|
||||
printf("#define\tSIGF_CODE %d\n", &sigf->sf_code);
|
||||
printf("#define\tSIGF_SCP %d\n", &sigf->sf_scp);
|
||||
printf("#define\tSIGF_HANDLER %d\n", &sigf->sf_handler);
|
||||
printf("#define\tSIGF_SC %d\n", &sigf->sf_sc);
|
||||
|
||||
printf("#define\tB_READ %d\n", B_READ);
|
||||
printf("#define\tENOENT %d\n", ENOENT);
|
||||
printf("#define\tEFAULT %d\n", EFAULT);
|
||||
|
@ -33,19 +33,8 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
*
|
||||
* PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
|
||||
* -------------------- ----- ----------------------
|
||||
* CURRENT PATCH LEVEL: 5 00158
|
||||
* -------------------- ----- ----------------------
|
||||
*
|
||||
* 06 Aug 92 Pace Willisson Allow VGA memory to be mapped
|
||||
* 28 Nov 92 Frank MacLachlan Aligned addresses and data
|
||||
* on 32bit boundaries.
|
||||
* 25 Mar 93 Kevin Lahey Add syscall counter for vmstat
|
||||
* 20 Apr 93 Bruce Evans New npx-0.5 code
|
||||
* 25 Apr 93 Bruce Evans Support new interrupt code (intr-0.1)
|
||||
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
@ -55,6 +44,8 @@
|
||||
* Written by William F. Jolitz, 386BSD Project
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
|
||||
#include "assym.s"
|
||||
#include "machine/psl.h"
|
||||
#include "machine/pte.h"
|
||||
@ -65,6 +56,7 @@
|
||||
|
||||
#include "machine/specialreg.h"
|
||||
#include "i386/isa/debug.h"
|
||||
#include "machine/cputypes.h"
|
||||
|
||||
#define KDSEL 0x10
|
||||
#define SEL_RPL_MASK 0x0003
|
||||
@ -80,12 +72,9 @@
|
||||
.set SYSTEM,0xFE000000 # virtual address of system start
|
||||
/*note: gas copys sign bit (e.g. arithmetic >>), can't do SYSTEM>>22! */
|
||||
.set SYSPDROFF,0x3F8 # Page dir index of System Base
|
||||
.set SYSPDREND,0x3FA # Page dir index of System End
|
||||
.set SYSPDREND,0x3FB # Page dir index of System End
|
||||
|
||||
|
||||
/*
|
||||
* Macros
|
||||
*/
|
||||
#define ALIGN_DATA .align 2
|
||||
#define ALIGN_TEXT .align 2,0x90 /* 4-byte boundaries, NOP-filled */
|
||||
#define SUPERALIGN_TEXT .align 4,0x90 /* 16-byte boundaries better for 486 */
|
||||
@ -122,12 +111,12 @@
|
||||
|
||||
/* NB: NOP now preserves registers so NOPs can be inserted anywhere */
|
||||
/* XXX: NOP and FASTER_NOP are misleadingly named */
|
||||
#ifdef BROKEN_HARDWARE_AND_OR_SOFTWARE /* XXX - rarely necessary */
|
||||
#define FASTER_NOP pushl %eax ; inb $0x84,%al ; popl %eax
|
||||
#define NOP pushl %eax ; inb $0x84,%al ; inb $0x84,%al ; popl %eax
|
||||
#else
|
||||
#ifdef DUMMY_NOPS /* this will break some older machines */
|
||||
#define FASTER_NOP
|
||||
#define NOP
|
||||
#else
|
||||
#define FASTER_NOP pushl %eax ; inb $0x84,%al ; popl %eax
|
||||
#define NOP pushl %eax ; inb $0x84,%al ; inb $0x84,%al ; popl %eax
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -156,17 +145,19 @@
|
||||
* per-process address space (at the beginning), immediatly above
|
||||
* the user process stack.
|
||||
*/
|
||||
.globl _kstack
|
||||
.set _kstack, USRSTACK
|
||||
.globl _kstack
|
||||
.set PPDROFF,0x3F6
|
||||
.set PPTEOFF,0x400-UPAGES # 0x3FE
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Globals */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Globals
|
||||
*/
|
||||
.data
|
||||
.globl _esym
|
||||
_esym: .long 0 # ptr to end of syms
|
||||
|
||||
.globl _boothowto, _bootdev, _curpcb
|
||||
.globl __ucodesel,__udatasel
|
||||
|
||||
@ -174,7 +165,6 @@
|
||||
_cpu: .long 0 # are we 386, 386sx, or 486
|
||||
_cold: .long 1 # cold till we are not
|
||||
_atdevbase: .long 0 # location of start of iomem in virtual
|
||||
# .nonglobl _atdevphys (should be register or something)
|
||||
_atdevphys: .long 0 # location of device mapping ptes (phys)
|
||||
|
||||
.globl _IdlePTD, _KPTphys
|
||||
@ -185,19 +175,14 @@ _KPTphys: .long 0
|
||||
_cyloffset: .long 0
|
||||
_proc0paddr: .long 0
|
||||
|
||||
#ifdef SHOW_A_LOT
|
||||
bit_colors:
|
||||
.byte GREEN,RED,0,0
|
||||
#endif
|
||||
|
||||
.space 512
|
||||
tmpstk:
|
||||
|
||||
|
||||
/*
|
||||
* System Initialization
|
||||
*/
|
||||
.text
|
||||
/*****************************************************************************/
|
||||
/* System Initialisation */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* btext: beginning of text section.
|
||||
@ -209,7 +194,7 @@ ENTRY(btext)
|
||||
.space 0x500 # skip over warm boot shit
|
||||
|
||||
/*
|
||||
* pass parameters on stack (howto, bootdev, unit, cyloffset)
|
||||
* pass parameters on stack (howto, bootdev, unit, cyloffset, esym)
|
||||
* note: (%esp) is return address of boot
|
||||
* ( if we want to hold onto /boot, it's physical %esp up to _end)
|
||||
*/
|
||||
@ -220,6 +205,31 @@ ENTRY(btext)
|
||||
movl %eax,_bootdev-SYSTEM
|
||||
movl 12(%esp),%eax
|
||||
movl %eax, _cyloffset-SYSTEM
|
||||
movl 16(%esp),%eax
|
||||
addl $ SYSTEM,%eax
|
||||
movl %eax, _esym-SYSTEM
|
||||
|
||||
/* find out our CPU type. */
|
||||
pushfl
|
||||
popl %eax
|
||||
movl %eax,%ecx
|
||||
xorl $0x40000,%eax
|
||||
pushl %eax
|
||||
popfl
|
||||
pushfl
|
||||
popl %eax
|
||||
xorl %ecx,%eax
|
||||
shrl $18,%eax
|
||||
andl $1,%eax
|
||||
push %ecx
|
||||
popfl
|
||||
|
||||
cmpl $0,%eax
|
||||
jne 1f
|
||||
movl $CPU_386,_cpu-SYSTEM
|
||||
jmp 2f
|
||||
1: movl $CPU_486,_cpu-SYSTEM
|
||||
2:
|
||||
|
||||
/*
|
||||
* Finished with old stack; load new %esp now instead of later so
|
||||
@ -344,8 +354,8 @@ ENTRY(btext)
|
||||
movl %eax,(%esi) # which is where temp maps!
|
||||
|
||||
/* kernel pde's */
|
||||
movl $(SYSPDREND-SYSPDROFF+1), %ecx # for this many pde s,
|
||||
lea (SYSPDROFF*4)(%esi), %ebx # offset of pde for kernel
|
||||
movl $(SYSPDREND-SYSPDROFF), %ecx # for this many pde s,
|
||||
lea (SYSPDROFF*4)(%esi), %ebx # offset of pde for kernel
|
||||
fillkpt
|
||||
|
||||
/* install a pde recursively mapping page directory as a page table! */
|
||||
@ -884,6 +894,12 @@ show_bits:
|
||||
SHOW_BIT(15)
|
||||
popl %eax
|
||||
ret
|
||||
|
||||
.data
|
||||
bit_colors:
|
||||
.byte GREEN,RED,0,0
|
||||
.text
|
||||
|
||||
#endif /* SHOW_A_LOT */
|
||||
|
||||
|
||||
|
@ -35,17 +35,21 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id$
|
||||
* $Id: machdep.c,v 1.8 1993/10/08 10:47:13 rgrimes Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
#include "isa.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include "param.h"
|
||||
#include "systm.h"
|
||||
#include "signalvar.h"
|
||||
#include "kernel.h"
|
||||
#include "map.h"
|
||||
#include "proc.h"
|
||||
#include "user.h"
|
||||
#include "exec.h" /* for PS_STRINGS */
|
||||
#include "buf.h"
|
||||
#include "reboot.h"
|
||||
#include "conf.h"
|
||||
@ -56,21 +60,35 @@
|
||||
#include "msgbuf.h"
|
||||
#include "net/netisr.h"
|
||||
|
||||
#ifdef SYSVSHM
|
||||
#include "sys/shm.h"
|
||||
#endif
|
||||
|
||||
#include "vm/vm.h"
|
||||
#include "vm/vm_kern.h"
|
||||
#include "vm/vm_page.h"
|
||||
|
||||
#include "sys/exec.h"
|
||||
#include "sys/vnode.h"
|
||||
|
||||
#ifndef MACHINE_NONCONTIG
|
||||
extern vm_offset_t avail_end;
|
||||
#else
|
||||
extern vm_offset_t avail_start, avail_end;
|
||||
static vm_offset_t hole_start, hole_end;
|
||||
static vm_offset_t avail_next;
|
||||
static unsigned int avail_remaining;
|
||||
#endif /* MACHINE_NONCONTIG */
|
||||
|
||||
#include "machine/cpu.h"
|
||||
#include "machine/reg.h"
|
||||
#include "machine/psl.h"
|
||||
#include "machine/specialreg.h"
|
||||
#include "machine/sysarch.h"
|
||||
|
||||
#include "i386/isa/isa.h"
|
||||
#include "i386/isa/rtc.h"
|
||||
|
||||
#ifdef SYSVSHM
|
||||
#include "sys/shm.h"
|
||||
#endif /* SYSVSHM */
|
||||
|
||||
#define EXPECT_BASEMEM 640 /* The expected base memory*/
|
||||
#define INFORM_WAIT 1 /* Set to pause berfore crash in weird cases*/
|
||||
@ -89,9 +107,10 @@ int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
int msgbufmapped; /* set when safe to use msgbuf */
|
||||
extern int freebufspace;
|
||||
|
||||
int _udatasel, _ucodesel;
|
||||
|
||||
/*
|
||||
* Machine-dependent startup code
|
||||
*/
|
||||
@ -106,6 +125,11 @@ int biosmem;
|
||||
|
||||
extern cyloffset;
|
||||
|
||||
int cpu_class;
|
||||
|
||||
void dumpsys __P((void));
|
||||
|
||||
void
|
||||
cpu_startup()
|
||||
{
|
||||
register int unixsize;
|
||||
@ -125,18 +149,21 @@ cpu_startup()
|
||||
|
||||
/* avail_end was pre-decremented in pmap_bootstrap to compensate */
|
||||
for (i = 0; i < btoc(sizeof (struct msgbuf)); i++)
|
||||
#ifndef MACHINE_NONCONTIG
|
||||
pmap_enter(pmap_kernel(), msgbufp, avail_end + i * NBPG,
|
||||
VM_PROT_ALL, TRUE);
|
||||
#else
|
||||
pmap_enter(pmap_kernel(), (caddr_t)msgbufp + i * NBPG,
|
||||
avail_end + i * NBPG, VM_PROT_ALL, TRUE);
|
||||
#endif
|
||||
msgbufmapped = 1;
|
||||
|
||||
#ifdef KDB
|
||||
kdb_init(); /* startup kernel debugger */
|
||||
#endif
|
||||
/*
|
||||
* Good {morning,afternoon,evening,night}.
|
||||
*/
|
||||
/*printf(version);
|
||||
printf("real mem = %d\n", ctob(physmem));*/
|
||||
printf(version);
|
||||
identifycpu();
|
||||
printf("real mem = %d\n", ctob(physmem));
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures.
|
||||
@ -161,7 +188,11 @@ cpu_startup()
|
||||
(name) = (type *)v; v = (caddr_t)((name)+(num))
|
||||
#define valloclim(name, type, num, lim) \
|
||||
(name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
|
||||
/* valloc(cfree, struct cblock, nclist); no clists any more!!! - cgd */
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef NetBSD
|
||||
valloc(swapmap, struct map, nswapmap = maxproc * 2);
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
@ -172,14 +203,10 @@ cpu_startup()
|
||||
* We allocate 1/2 as many swap buffer headers as file i/o buffers.
|
||||
*/
|
||||
if (bufpages == 0)
|
||||
if (physmem < (2 * 1024 * 1024))
|
||||
bufpages = physmem / 10 / CLSIZE;
|
||||
else
|
||||
bufpages = ((2 * 1024 * 1024 + physmem) / 20) / CLSIZE;
|
||||
/*
|
||||
* 15 Aug 92 William Jolitz bufpages fix for too large
|
||||
*/
|
||||
bufpages = min( NKMEMCLUSTERS*2/5, bufpages);
|
||||
if (physmem < btoc(2 * 1024 * 1024))
|
||||
bufpages = physmem / 10 / CLSIZE;
|
||||
else
|
||||
bufpages = (btoc(2 * 1024 * 1024) + physmem) / 20 / CLSIZE;
|
||||
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages / 2;
|
||||
@ -210,11 +237,20 @@ cpu_startup()
|
||||
*/
|
||||
if ((vm_size_t)(v - firstaddr) != size)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
* Allocate a submap for buffer space allocations.
|
||||
*/
|
||||
buffer_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
bufpages*NBPG, TRUE);
|
||||
/*
|
||||
* Allocate a submap for exec arguments. This map effectively
|
||||
* limits the number of processes exec'ing at any time.
|
||||
*/
|
||||
/* exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
* 16*NCARGS, TRUE);
|
||||
* NOT CURRENTLY USED -- cgd
|
||||
*/
|
||||
/*
|
||||
* Allocate a submap for physio
|
||||
*/
|
||||
@ -237,7 +273,9 @@ cpu_startup()
|
||||
for (i = 1; i < ncallout; i++)
|
||||
callout[i-1].c_next = &callout[i];
|
||||
|
||||
/*printf("avail mem = %d\n", ptoa(vm_page_free_count));*/
|
||||
printf("avail mem = %d\n", ptoa(vm_page_free_count));
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
|
||||
/*
|
||||
* Set up CPU-specific registers, cache, etc.
|
||||
@ -255,6 +293,67 @@ cpu_startup()
|
||||
configure();
|
||||
}
|
||||
|
||||
|
||||
struct cpu_nameclass i386_cpus[] = {
|
||||
{ "Intel 80286", CPUCLASS_286 }, /* CPU_286 */
|
||||
{ "i386SX", CPUCLASS_386 }, /* CPU_386SX */
|
||||
{ "i386DX", CPUCLASS_386 }, /* CPU_386 */
|
||||
{ "i486SX", CPUCLASS_486 }, /* CPU_486SX */
|
||||
{ "i486DX", CPUCLASS_486 }, /* CPU_486 */
|
||||
{ "i586", CPUCLASS_586 }, /* CPU_586 */
|
||||
};
|
||||
|
||||
identifycpu() /* translated from hp300 -- cgd */
|
||||
{
|
||||
printf("CPU: ");
|
||||
if (cpu >= 0 && cpu < (sizeof i386_cpus/sizeof(struct cpu_nameclass))) {
|
||||
printf("%s", i386_cpus[cpu].cpu_name);
|
||||
cpu_class = i386_cpus[cpu].cpu_class;
|
||||
} else {
|
||||
printf("unknown cpu type %d\n", cpu);
|
||||
panic("startup: bad cpu id");
|
||||
}
|
||||
printf(" (");
|
||||
switch(cpu_class) {
|
||||
case CPUCLASS_286:
|
||||
printf("286");
|
||||
break;
|
||||
case CPUCLASS_386:
|
||||
printf("386");
|
||||
break;
|
||||
case CPUCLASS_486:
|
||||
printf("486");
|
||||
break;
|
||||
case CPUCLASS_586:
|
||||
printf("586");
|
||||
break;
|
||||
default:
|
||||
printf("unknown"); /* will panic below... */
|
||||
}
|
||||
printf("-class CPU)");
|
||||
printf("\n"); /* cpu speed would be nice, but how? */
|
||||
|
||||
/*
|
||||
* Now that we have told the user what they have,
|
||||
* let them know if that machine type isn't configured.
|
||||
*/
|
||||
switch (cpu_class) {
|
||||
case CPUCLASS_286: /* a 286 should not make it this far, anyway */
|
||||
#if !defined(I386_CPU)
|
||||
case CPUCLASS_386:
|
||||
#endif
|
||||
#if !defined(I486_CPU)
|
||||
case CPUCLASS_486:
|
||||
#endif
|
||||
#if !defined(I586_CPU)
|
||||
case CPUCLASS_586:
|
||||
#endif
|
||||
panic("CPU class not configured");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PGINPROF
|
||||
/*
|
||||
* Return the difference (in microseconds)
|
||||
@ -273,17 +372,6 @@ vmtime(otime, olbolt, oicr)
|
||||
}
|
||||
#endif
|
||||
|
||||
struct sigframe {
|
||||
int sf_signum;
|
||||
int sf_code;
|
||||
struct sigcontext *sf_scp;
|
||||
sig_t sf_handler;
|
||||
int sf_eax;
|
||||
int sf_edx;
|
||||
int sf_ecx;
|
||||
struct sigcontext sf_sc;
|
||||
} ;
|
||||
|
||||
extern int kstack[];
|
||||
|
||||
/*
|
||||
@ -398,7 +486,6 @@ sendsig(catcher, sig, mask, code)
|
||||
* psl to gain improper priviledges or to cause
|
||||
* a machine fault.
|
||||
*/
|
||||
|
||||
struct sigreturn_args {
|
||||
struct sigcontext *sigcntxp;
|
||||
};
|
||||
@ -412,7 +499,6 @@ sigreturn(p, uap, retval)
|
||||
register struct sigframe *fp;
|
||||
register int *regs = p->p_regs;
|
||||
|
||||
|
||||
/*
|
||||
* (XXX old comment) regs[sESP] points to the return address.
|
||||
* The user scp pointer is above that.
|
||||
@ -448,16 +534,25 @@ sigreturn(p, uap, retval)
|
||||
return(EJUSTRETURN);
|
||||
}
|
||||
|
||||
/*
|
||||
* a simple function to make the system panic (and dump a vmcore)
|
||||
* in a predictable fashion
|
||||
*/
|
||||
void diediedie()
|
||||
{
|
||||
panic("because you said to!");
|
||||
}
|
||||
|
||||
int waittime = -1;
|
||||
struct pcb dumppcb;
|
||||
|
||||
void
|
||||
boot(arghowto)
|
||||
int arghowto;
|
||||
{
|
||||
register long dummy; /* r12 is reserved */
|
||||
register int howto; /* r11 == how to boot */
|
||||
register int devtype; /* r10 == major of root dev */
|
||||
extern char *panicstr;
|
||||
extern int cold;
|
||||
int nomsg = 1;
|
||||
|
||||
@ -472,12 +567,20 @@ boot(arghowto)
|
||||
|
||||
waittime = 0;
|
||||
(void) splnet();
|
||||
printf("syncing disks... ");
|
||||
/*
|
||||
* Release inodes held by texts before update.
|
||||
*/
|
||||
if (panicstr == 0)
|
||||
vnode_pager_umount(NULL);
|
||||
sync((struct sigcontext *)0);
|
||||
/*
|
||||
* Unmount filesystems
|
||||
*/
|
||||
#if 0
|
||||
if (panicstr == 0)
|
||||
vfs_unmountall();
|
||||
#endif
|
||||
|
||||
for (iter = 0; iter < 20; iter++) {
|
||||
nbusy = 0;
|
||||
@ -490,19 +593,22 @@ boot(arghowto)
|
||||
printf("updating disks before rebooting... ");
|
||||
nomsg = 0;
|
||||
}
|
||||
/* printf("%d ", nbusy); */
|
||||
printf("%d ", nbusy);
|
||||
DELAY(40000 * iter);
|
||||
}
|
||||
if (nbusy)
|
||||
printf(" failed!\n");
|
||||
else if (nomsg == 0)
|
||||
printf("succeded.\n");
|
||||
printf("giving up\n");
|
||||
else
|
||||
printf("done\n");
|
||||
DELAY(10000); /* wait for printf to finish */
|
||||
}
|
||||
splhigh();
|
||||
devtype = major(rootdev);
|
||||
if (howto&RB_HALT) {
|
||||
pg("\nThe operating system has halted. Please press any key to reboot.\n\n");
|
||||
printf("\n");
|
||||
printf("The operating system has halted.\n");
|
||||
printf("Please press any key to reboot.\n\n");
|
||||
cngetc();
|
||||
} else {
|
||||
if (howto & RB_DUMP) {
|
||||
savectx(&dumppcb, 0);
|
||||
@ -520,13 +626,14 @@ boot(arghowto)
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
u_int dumpmag = 0x8fca0101; /* magic number for savecore */
|
||||
int dumpsize = 0; /* also for savecore */
|
||||
unsigned dumpmag = 0x8fca0101; /* magic number for savecore */
|
||||
int dumpsize = 0; /* also for savecore */
|
||||
/*
|
||||
* Doadump comes here after turning off memory management and
|
||||
* getting on the dump stack, either when called above, or by
|
||||
* the auto-restart code.
|
||||
*/
|
||||
void
|
||||
dumpsys()
|
||||
{
|
||||
|
||||
@ -534,37 +641,37 @@ dumpsys()
|
||||
return;
|
||||
if ((minor(dumpdev)&07) != 1)
|
||||
return;
|
||||
printf("\nThe operating system is saving a copy of RAM memory to device %x, offset %d\n\
|
||||
(hit any key to abort): [ amount left to save (MB) ] ", dumpdev, dumplo);
|
||||
dumpsize = physmem;
|
||||
printf("\ndumping to dev %x, offset %d\n", dumpdev, dumplo);
|
||||
printf("dump ");
|
||||
switch ((*bdevsw[major(dumpdev)].d_dump)(dumpdev)) {
|
||||
|
||||
case ENXIO:
|
||||
printf("-- device bad\n");
|
||||
printf("device bad\n");
|
||||
break;
|
||||
|
||||
case EFAULT:
|
||||
printf("-- device not ready\n");
|
||||
printf("device not ready\n");
|
||||
break;
|
||||
|
||||
case EINVAL:
|
||||
printf("-- area improper\n");
|
||||
printf("area improper\n");
|
||||
break;
|
||||
|
||||
case EIO:
|
||||
printf("-- i/o error\n");
|
||||
printf("i/o error\n");
|
||||
break;
|
||||
|
||||
case EINTR:
|
||||
printf("-- aborted from console\n");
|
||||
printf("aborted from console\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
printf(" succeeded\n");
|
||||
printf("succeeded\n");
|
||||
break;
|
||||
}
|
||||
printf("system rebooting.\n\n");
|
||||
DELAY(10000);
|
||||
printf("\n\n");
|
||||
DELAY(1000);
|
||||
}
|
||||
|
||||
#ifdef HZ
|
||||
@ -624,6 +731,7 @@ initcpu()
|
||||
/*
|
||||
* Clear registers on exec
|
||||
*/
|
||||
void
|
||||
setregs(p, entry)
|
||||
struct proc *p;
|
||||
u_long entry;
|
||||
@ -634,7 +742,7 @@ setregs(p, entry)
|
||||
|
||||
p->p_addr->u_pcb.pcb_flags = 0; /* no fp at all */
|
||||
load_cr0(rcr0() | CR0_TS); /* start emulating */
|
||||
#ifdef NPX
|
||||
#if NNPX > 0
|
||||
npxinit(__INITIAL_NPXCW__);
|
||||
#endif
|
||||
}
|
||||
@ -648,7 +756,6 @@ setregs(p, entry)
|
||||
*/
|
||||
#define DESCRIPTOR_SIZE 8
|
||||
|
||||
|
||||
#define GNULL_SEL 0 /* Null Descriptor */
|
||||
#define GCODE_SEL 1 /* Kernel Code Descriptor */
|
||||
#define GDATA_SEL 2 /* Kernel Data Descriptor */
|
||||
@ -678,15 +785,15 @@ struct i386tss tss, panic_tss;
|
||||
|
||||
extern struct user *proc0paddr;
|
||||
|
||||
/* software prototypes -- in more palitable form */
|
||||
/* software prototypes -- in more palatable form */
|
||||
struct soft_segment_descriptor gdt_segs[] = {
|
||||
/* Null Descriptor */
|
||||
{ 0x0, /* segment base address */
|
||||
0x0, /* length - all address space */
|
||||
0x0, /* length */
|
||||
0, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
0, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* Code Descriptor for kernel */
|
||||
@ -695,7 +802,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
SDT_MEMERA, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
1, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* Data Descriptor for kernel */
|
||||
@ -704,7 +811,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
SDT_MEMRWA, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
1, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* LDT Descriptor */
|
||||
@ -713,7 +820,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
SDT_SYSLDT, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
0, /* unused - default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* Null Descriptor - Placeholder */
|
||||
@ -722,7 +829,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
0, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
0, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* Panic Tss Descriptor */
|
||||
@ -731,7 +838,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
SDT_SYS386TSS, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
0, /* unused - default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* Proc 0 Tss Descriptor */
|
||||
@ -740,7 +847,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
SDT_SYS386TSS, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
0, /* unused - default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ }};
|
||||
|
||||
@ -751,7 +858,7 @@ struct soft_segment_descriptor ldt_segs[] = {
|
||||
0, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
0, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* Null Descriptor - overwritten by call gate */
|
||||
@ -760,7 +867,7 @@ struct soft_segment_descriptor ldt_segs[] = {
|
||||
0, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
0, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* Null Descriptor - overwritten by call gate */
|
||||
@ -769,7 +876,7 @@ struct soft_segment_descriptor ldt_segs[] = {
|
||||
0, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
0, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* Code Descriptor for user */
|
||||
@ -778,7 +885,7 @@ struct soft_segment_descriptor ldt_segs[] = {
|
||||
SDT_MEMERA, /* segment type */
|
||||
SEL_UPL, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
1, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* Data Descriptor for user */
|
||||
@ -787,7 +894,7 @@ struct soft_segment_descriptor ldt_segs[] = {
|
||||
SDT_MEMRWA, /* segment type */
|
||||
SEL_UPL, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0,0,
|
||||
0, 0,
|
||||
1, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ } };
|
||||
|
||||
@ -815,7 +922,7 @@ extern IDTVEC(div), IDTVEC(dbg), IDTVEC(nmi), IDTVEC(bpt), IDTVEC(ofl),
|
||||
IDTVEC(rsvd13), IDTVEC(rsvd14), IDTVEC(rsvd14), IDTVEC(syscall);
|
||||
|
||||
int lcr0(), lcr3(), rcr0(), rcr2();
|
||||
int _udatasel, _ucodesel, _gsel_tss;
|
||||
int _gsel_tss;
|
||||
|
||||
init386(first)
|
||||
{
|
||||
@ -979,15 +1086,17 @@ init386(first)
|
||||
* If they get working well enough to recompile, they can unset
|
||||
* the flag; otherwise, it's a toy and they have to lump it.
|
||||
*/
|
||||
getchar(); /* kernel getchar in /sys/i386/isa/pccons.c*/
|
||||
cngetc();
|
||||
#endif /* !INFORM_WAIT*/
|
||||
}
|
||||
/*
|
||||
* End of CMOS bux fix
|
||||
*/
|
||||
|
||||
/* call pmap initialization to make new kernel address space */
|
||||
#ifndef MACHINCE_NONCONTIG
|
||||
pmap_bootstrap (first, 0);
|
||||
#else
|
||||
pmap_bootstrap ((vm_offset_t)atdevbase + IOM_SIZE);
|
||||
|
||||
#endif /* MACHINE_NONCONTIG */
|
||||
/* now running on new page tables, configured,and u/iom is accessible */
|
||||
|
||||
/* make a initial tss so microp can get interrupt stack on syscall! */
|
||||
@ -1034,13 +1143,16 @@ clearseg(n) {
|
||||
*(int *)CMAP2 = PG_V | PG_KW | ctob(n);
|
||||
load_cr3(rcr3());
|
||||
bzero(CADDR2,NBPG);
|
||||
#ifndef MACHINE_NONCONTIG
|
||||
*(int *) CADDR2 = 0;
|
||||
#endif /* MACHINE_NONCONTIG */
|
||||
}
|
||||
|
||||
/*
|
||||
* copy a page of physical memory
|
||||
* specified in relocation units (NBPG bytes)
|
||||
*/
|
||||
void
|
||||
copyseg(frm, n) {
|
||||
|
||||
*(int *)CMAP2 = PG_V | PG_KW | ctob(n);
|
||||
@ -1052,6 +1164,7 @@ copyseg(frm, n) {
|
||||
* copy a page of physical memory
|
||||
* specified in relocation units (NBPG bytes)
|
||||
*/
|
||||
void
|
||||
physcopyseg(frm, to) {
|
||||
|
||||
*(int *)CMAP1 = PG_V | PG_KW | ctob(frm);
|
||||
@ -1064,6 +1177,7 @@ physcopyseg(frm, to) {
|
||||
schednetisr(NETISR_AST);
|
||||
}*/
|
||||
|
||||
void
|
||||
setsoftclock() {
|
||||
schednetisr(NETISR_SCLK);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user