summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_trap.c
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1994-01-17 09:32:32 +0000
committerdg <dg@FreeBSD.org>1994-01-17 09:32:32 +0000
commitbd28d97caf58bfad9667e55320e3d7ea48c19ad5 (patch)
treebcb0bc6307862838dc90df7785da95239d19e78b /sys/kern/subr_trap.c
parentebd78d05263f349ef009b13a910f6080cca5324d (diff)
downloadFreeBSD-src-bd28d97caf58bfad9667e55320e3d7ea48c19ad5.zip
FreeBSD-src-bd28d97caf58bfad9667e55320e3d7ea48c19ad5.tar.gz
Improvements mostly from John Dyson, with a little bit from me.
* Removed pmap_is_wired * added extra cli/sti protection in idle (swtch.s) * slight code improvement in trap.c * added lots of comments * improved paging and other algorithms in VM system
Diffstat (limited to 'sys/kern/subr_trap.c')
-rw-r--r--sys/kern/subr_trap.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c
index 15a2684..7e5d5c4 100644
--- a/sys/kern/subr_trap.c
+++ b/sys/kern/subr_trap.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
- * $Id: trap.c,v 1.13 1994/01/03 07:55:24 davidg Exp $
+ * $Id: trap.c,v 1.14 1994/01/14 16:23:41 davidg Exp $
*/
/*
@@ -390,10 +390,10 @@ skiptoswitch:
/* check if page table is mapped, if not, fault it first */
#define pde_v(v) (PTD[((v)>>PD_SHIFT)&1023].pd_v)
{
- vm_offset_t v = trunc_page(vtopte(va));
if (map != kernel_map) {
vm_offset_t pa;
+ vm_offset_t v = (vm_offset_t) vtopte(va);
/* Fault the pte only if needed: */
*(volatile char *)v += 0;
@@ -401,16 +401,21 @@ skiptoswitch:
/* Get the physical address: */
pa = pmap_extract(vm_map_pmap(map), v);
- /* And wire the page at system vm level: */
+ /* And wire the pte page at system vm level: */
vm_page_wire(PHYS_TO_VM_PAGE(pa));
/* Fault in the user page: */
rv = vm_fault(map, va, ftype, FALSE);
- /* Unwire the pte page */
+ /* Unwire the pte page: */
vm_page_unwire(PHYS_TO_VM_PAGE(pa));
} else {
+ /*
+ * Since we know that kernel virtual address addresses
+ * always have pte pages mapped, we just have to fault
+ * the page.
+ */
rv = vm_fault(map, va, ftype, FALSE);
}
@@ -606,10 +611,19 @@ int trapwrite(addr)
{
vm_offset_t v;
v = trunc_page(vtopte(va));
+ /*
+ * wire the pte page
+ */
if (va < USRSTACK) {
vm_map_pageable(&vm->vm_map, v, round_page(v+1), FALSE);
}
+ /*
+ * fault the data page
+ */
rv = vm_fault(&vm->vm_map, va, VM_PROT_READ|VM_PROT_WRITE, FALSE);
+ /*
+ * unwire the pte page
+ */
if (va < USRSTACK) {
vm_map_pageable(&vm->vm_map, v, round_page(v+1), TRUE);
}
OpenPOWER on IntegriCloud