Fix off-by-4 error in address validation for i386, reduce PCB reloading, and

fix more style(9) nits.

Pointed out by:	bde
Discussed with:	kib
Reviewd by:	bde
This commit is contained in:
Jung-uk Kim 2007-03-30 23:19:08 +00:00
parent 92ed5e9841
commit 6a4abad780
2 changed files with 17 additions and 23 deletions

View File

@ -693,15 +693,14 @@ NON_GPROF_ENTRY(__bb_init_func)
.text
futex_fault:
movq PCPU(CURPCB),%rdx
movq $0,PCB_ONFAULT(%rdx)
movq $0,PCB_ONFAULT(%rcx)
movq $-EFAULT,%rax
ret
/* int futex_xchgl(int oparg, caddr_t uaddr, int *oldval); */
ENTRY(futex_xchgl)
movq PCPU(CURPCB),%r11
movq $futex_fault,PCB_ONFAULT(%r11)
movq PCPU(CURPCB),%rcx
movq $futex_fault,PCB_ONFAULT(%rcx)
movq $VM_MAXUSER_ADDRESS-4,%rax
cmpq %rax,%rsi
@ -713,13 +712,13 @@ ENTRY(futex_xchgl)
xchgl %edi,(%rsi)
movl %edi,(%rdx)
xorl %eax,%eax
movq %rax,PCB_ONFAULT(%r11)
movq %rax,PCB_ONFAULT(%rcx)
ret
/* int futex_addl(int oparg, caddr_t uaddr, int *oldval); */
ENTRY(futex_addl)
movq PCPU(CURPCB),%r11
movq $futex_fault,PCB_ONFAULT(%r11)
movq PCPU(CURPCB),%rcx
movq $futex_fault,PCB_ONFAULT(%rcx)
movq $VM_MAXUSER_ADDRESS-4,%rax
cmpq %rax,%rsi
@ -731,5 +730,5 @@ ENTRY(futex_addl)
xaddl %edi,(%rsi)
movl %edi,(%rdx)
xorl %eax,%eax
movq %rax,PCB_ONFAULT(%r11)
movq %rax,PCB_ONFAULT(%rcx)
ret

View File

@ -1537,39 +1537,36 @@ NON_GPROF_ENTRY(__bb_init_func)
.text
futex_fault:
movl PCPU(CURPCB),%edx
movl $0,PCB_ONFAULT(%edx)
movl $0,PCB_ONFAULT(%ecx)
movl $-EFAULT,%eax
ret
/* int futex_xchgl(int oparg, caddr_t uaddr, int *oldval); */
ENTRY(futex_xchgl)
movl PCPU(CURPCB),%eax
movl $futex_fault,PCB_ONFAULT(%eax)
movl PCPU(CURPCB),%ecx
movl $futex_fault,PCB_ONFAULT(%ecx)
movl 4(%esp),%eax
movl 8(%esp),%edx
cmpl $VM_MAXUSER_ADDRESS,%edx
cmpl $VM_MAXUSER_ADDRESS-4,%edx
ja futex_fault
#ifdef SMP
lock
#endif
xchgl %eax,(%edx)
movl 0xc(%esp),%edx
movl 12(%esp),%edx
movl %eax,(%edx)
xorl %eax,%eax
movl PCPU(CURPCB),%edx
movl $0,PCB_ONFAULT(%edx)
movl $0,PCB_ONFAULT(%ecx)
ret
/* int futex_addl(int oparg, caddr_t uaddr, int *oldval); */
ENTRY(futex_addl)
movl PCPU(CURPCB),%eax
movl $futex_fault,PCB_ONFAULT(%eax)
movl PCPU(CURPCB),%ecx
movl $futex_fault,PCB_ONFAULT(%ecx)
movl 4(%esp),%eax
movl 8(%esp),%edx
cmpl $VM_MAXUSER_ADDRESS,%edx
cmpl $VM_MAXUSER_ADDRESS-4,%edx
ja futex_fault
#ifdef SMP
@ -1579,7 +1576,5 @@ ENTRY(futex_addl)
movl 12(%esp),%edx
movl %eax,(%edx)
xorl %eax,%eax
movl PCPU(CURPCB),%edx
movl $0,PCB_ONFAULT(%edx)
movl $0,PCB_ONFAULT(%ecx)
ret