diff options
author | jhb <jhb@FreeBSD.org> | 2001-05-11 23:50:08 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-05-11 23:50:08 +0000 |
commit | c20ad9aee20025e5e02cc318f355e6866e04bef1 (patch) | |
tree | bc6fd1892ca4ffcf8937beab0e366b979b5c8a37 /sys/amd64 | |
parent | bba3cec519b0df520da69e77e569c12fad190810 (diff) | |
download | FreeBSD-src-c20ad9aee20025e5e02cc318f355e6866e04bef1.zip FreeBSD-src-c20ad9aee20025e5e02cc318f355e6866e04bef1.tar.gz |
Simplify the vm fault trap handling code a bit by using if-else instead of
duplicating code in the then case and then using a goto to jump around
the else case.
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/trap.c | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index d9597df..5ff51fd 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -743,16 +743,11 @@ trap_pfault(frame, usermode, eva) * a growable stack region, or if the stack * growth succeeded. */ - if (!grow_stack (p, va)) { + if (!grow_stack (p, va)) rv = KERN_FAILURE; - PROC_LOCK(p); - --p->p_lock; - PROC_UNLOCK(p); - goto nogo; - } - - /* Fault in the user page: */ - rv = vm_fault(map, va, ftype, + else + /* Fault in the user page: */ + rv = vm_fault(map, va, ftype, (ftype & VM_PROT_WRITE) ? VM_FAULT_DIRTY : VM_FAULT_NORMAL); @@ -864,16 +859,11 @@ trap_pfault(frame, usermode, eva) * a growable stack region, or if the stack * growth succeeded. */ - if (!grow_stack (p, va)) { + if (!grow_stack (p, va)) rv = KERN_FAILURE; - PROC_LOCK(p); - --p->p_lock; - PROC_UNLOCK(p); - goto nogo; - } - - /* Fault in the user page: */ - rv = vm_fault(map, va, ftype, + else + /* Fault in the user page: */ + rv = vm_fault(map, va, ftype, (ftype & VM_PROT_WRITE) ? VM_FAULT_DIRTY : VM_FAULT_NORMAL); @@ -1044,17 +1034,13 @@ int trapwrite(addr) ++p->p_lock; PROC_UNLOCK(p); - if (!grow_stack (p, va)) { - PROC_LOCK(p); - --p->p_lock; - PROC_UNLOCK(p); - return (1); - } - - /* - * fault the data page - */ - rv = vm_fault(&vm->vm_map, va, VM_PROT_WRITE, VM_FAULT_DIRTY); + if (!grow_stack (p, va)) + rv = KERN_FAILURE; + else + /* + * fault the data page + */ + rv = vm_fault(&vm->vm_map, va, VM_PROT_WRITE, VM_FAULT_DIRTY); PROC_LOCK(p); --p->p_lock; |