version 1.30, 2004/08/22 06:46:34 |
version 1.31.6.2, 2005/03/19 08:33:02 |
|
|
/* $NetBSD$ */ |
/* $NetBSD$ */ |
|
|
/*- |
/*- |
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. |
* Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc. |
* All rights reserved. |
* All rights reserved. |
* |
* |
* This code is derived from software contributed to The NetBSD Foundation |
* This code is derived from software contributed to The NetBSD Foundation |
|
|
#include <machine/i82489reg.h> |
#include <machine/i82489reg.h> |
#endif |
#endif |
|
|
/* |
/* This shouldn't conflict with a macro of the same name defined in pmap.h */ |
* PTmap is recursive pagemap at top of virtual address space. |
#define PTE_BASE (PDSLOT_PTE << PDSHIFT) |
* Within PTmap, the page directory can be found (third indirection). |
|
* |
|
* XXX 4 == sizeof pde |
|
*/ |
|
.set _C_LABEL(PTmap),(PDSLOT_PTE << PDSHIFT) |
|
.set _C_LABEL(PTD),(_C_LABEL(PTmap) + PDSLOT_PTE * PAGE_SIZE) |
|
.set _C_LABEL(PTDpde),(_C_LABEL(PTD) + PDSLOT_PTE * 4) |
|
|
|
/* |
|
* APTmap, APTD is the alternate recursive pagemap. |
|
* It's used when modifying another process's page tables. |
|
* |
|
* XXX 4 == sizeof pde |
|
*/ |
|
.set _C_LABEL(APTmap),(PDSLOT_APTE << PDSHIFT) |
|
.set _C_LABEL(APTD),(_C_LABEL(APTmap) + PDSLOT_APTE * PAGE_SIZE) |
|
.set _C_LABEL(APTDpde),(_C_LABEL(PTD) + PDSLOT_APTE * 4) |
|
|
|
|
|
/* |
/* |
* Initialization |
* Initialization |
|
|
#ifdef COMPAT_OLDBOOT |
#ifdef COMPAT_OLDBOOT |
.globl _C_LABEL(bootdev) |
.globl _C_LABEL(bootdev) |
#endif |
#endif |
.globl _C_LABEL(proc0paddr),_C_LABEL(PTDpaddr) |
.globl _C_LABEL(proc0paddr),_C_LABEL(PDPpaddr) |
.globl _C_LABEL(biosbasemem),_C_LABEL(biosextmem) |
.globl _C_LABEL(biosbasemem),_C_LABEL(biosextmem) |
.globl _C_LABEL(gdt) |
.globl _C_LABEL(gdt) |
#ifdef I586_CPU |
#ifdef I586_CPU |
Line 222 _C_LABEL(cpu): .long 0 # are we 386, 38 |
|
Line 204 _C_LABEL(cpu): .long 0 # are we 386, 38 |
|
_C_LABEL(esym): .long 0 # ptr to end of syms |
_C_LABEL(esym): .long 0 # ptr to end of syms |
_C_LABEL(atdevbase): .long 0 # location of start of iomem in virtual |
_C_LABEL(atdevbase): .long 0 # location of start of iomem in virtual |
_C_LABEL(proc0paddr): .long 0 |
_C_LABEL(proc0paddr): .long 0 |
_C_LABEL(PTDpaddr): .long 0 # paddr of PTD, for libkvm |
_C_LABEL(PDPpaddr): .long 0 # paddr of PDP, for libkvm |
#ifndef REALBASEMEM |
#ifndef REALBASEMEM |
_C_LABEL(biosbasemem): .long 0 # base memory reported by BIOS |
_C_LABEL(biosbasemem): .long 0 # base memory reported by BIOS |
#else |
#else |
Line 620 try586: /* Use the `cpuid' instruction. |
|
Line 602 try586: /* Use the `cpuid' instruction. |
|
leal (PROC0PDIR+PG_V|PG_KW)(%esi),%eax # pte for ptd |
leal (PROC0PDIR+PG_V|PG_KW)(%esi),%eax # pte for ptd |
movl %eax,(PROC0PDIR+PDSLOT_PTE*4)(%esi) # recursive PD slot |
movl %eax,(PROC0PDIR+PDSLOT_PTE*4)(%esi) # recursive PD slot |
|
|
/* Save phys. addr of PTD, for libkvm. */ |
/* Save phys. addr of PDP, for libkvm. */ |
movl %esi,RELOC(PTDpaddr) |
movl %esi,RELOC(PDPpaddr) |
|
|
/* Load base of page directory and enable mapping. */ |
/* Load base of page directory and enable mapping. */ |
movl %esi,%eax # phys address of ptd in proc 0 |
movl %esi,%eax # phys address of ptd in proc 0 |
Line 922 ENTRY(i386_copyout) |
|
Line 904 ENTRY(i386_copyout) |
|
movl $2f,PCB_ONFAULT(%edx) |
movl $2f,PCB_ONFAULT(%edx) |
|
|
1: /* Check PTE for each page. */ |
1: /* Check PTE for each page. */ |
testb $PG_RW,_C_LABEL(PTmap)(,%edi,4) |
testb $PG_RW,PTE_BASE(,%edi,4) |
jz 2f |
jz 2f |
|
|
4: incl %edi |
4: incl %edi |
Line 1132 ENTRY(copyoutstr) |
|
Line 1114 ENTRY(copyoutstr) |
|
movl %edi,%eax |
movl %edi,%eax |
shrl $PGSHIFT,%eax # calculate pte address |
shrl $PGSHIFT,%eax # calculate pte address |
|
|
testb $PG_RW,_C_LABEL(PTmap)(,%eax,4) |
testb $PG_RW,PTE_BASE(,%eax,4) |
jnz 2f |
jnz 2f |
|
|
6: /* Simulate a trap. */ |
6: /* Simulate a trap. */ |
Line 1180 ENTRY(copyoutstr) |
|
Line 1162 ENTRY(copyoutstr) |
|
*/ |
*/ |
movl $VM_MAXUSER_ADDRESS,%eax |
movl $VM_MAXUSER_ADDRESS,%eax |
subl %edi,%eax |
subl %edi,%eax |
|
jc _C_LABEL(copystr_efault) |
cmpl %edx,%eax |
cmpl %edx,%eax |
jae 1f |
jae 1f |
movl %eax,%edx |
movl %eax,%edx |
Line 1234 ENTRY(copyinstr) |
|
Line 1217 ENTRY(copyinstr) |
|
*/ |
*/ |
movl $VM_MAXUSER_ADDRESS,%eax |
movl $VM_MAXUSER_ADDRESS,%eax |
subl %esi,%eax |
subl %esi,%eax |
|
jc _C_LABEL(copystr_efault) |
cmpl %edx,%eax |
cmpl %edx,%eax |
jae 1f |
jae 1f |
movl %eax,%edx |
movl %eax,%edx |
|
|
|
|
movl %edx,%eax |
movl %edx,%eax |
shrl $PGSHIFT,%eax # calculate pte address |
shrl $PGSHIFT,%eax # calculate pte address |
testb $PG_RW,_C_LABEL(PTmap)(,%eax,4) |
testb $PG_RW,PTE_BASE(,%eax,4) |
jnz 1f |
jnz 1f |
|
|
3: /* Simulate a trap. */ |
3: /* Simulate a trap. */ |
|
|
|
|
movl %edx,%eax |
movl %edx,%eax |
shrl $PGSHIFT,%eax # calculate pte address |
shrl $PGSHIFT,%eax # calculate pte address |
testb $PG_RW,_C_LABEL(PTmap)(,%eax,4) |
testb $PG_RW,PTE_BASE(,%eax,4) |
jnz 1f |
jnz 1f |
|
|
3: /* Simulate a trap. */ |
3: /* Simulate a trap. */ |
Line 1546 ENTRY(suswintr) |
|
Line 1530 ENTRY(suswintr) |
|
|
|
movl %edx,%eax |
movl %edx,%eax |
shrl $PGSHIFT,%eax # calculate pte address |
shrl $PGSHIFT,%eax # calculate pte address |
testb $PG_RW,_C_LABEL(PTmap)(,%eax,4) |
testb $PG_RW,PTE_BASE(,%eax,4) |
jnz 1f |
jnz 1f |
|
|
/* Simulate a trap. */ |
/* Simulate a trap. */ |
|
|
|
|
movl %edx,%eax |
movl %edx,%eax |
shrl $PGSHIFT,%eax # calculate pte address |
shrl $PGSHIFT,%eax # calculate pte address |
testb $PG_RW,_C_LABEL(PTmap)(,%eax,4) |
testb $PG_RW,PTE_BASE(,%eax,4) |
jnz 1f |
jnz 1f |
|
|
3: /* Simulate a trap. */ |
3: /* Simulate a trap. */ |
Line 2069 ENTRY(cpu_switchto) |
|
Line 2053 ENTRY(cpu_switchto) |
|
#ifndef MULTIPROCESSOR |
#ifndef MULTIPROCESSOR |
.globl _C_LABEL(lwp0) |
.globl _C_LABEL(lwp0) |
#endif |
#endif |
.globl _C_LABEL(uvmspace_free),_C_LABEL(kernel_map) |
|
.globl _C_LABEL(uvm_km_free),_C_LABEL(tss_free) |
|
/* LINTSTUB: Func: void cpu_exit(struct lwp *l) */ |
/* LINTSTUB: Func: void cpu_exit(struct lwp *l) */ |
ENTRY(cpu_exit) |
ENTRY(cpu_exit) |
movl 4(%esp),%edi # old process |
movl 4(%esp),%edi # old process |