Correct BB-profiling and adjust comments.

Pointed out by:	bde
Reviewed by:	bde
This commit is contained in:
jkim 2007-03-31 01:47:37 +00:00
parent 0b07299b2a
commit 19c0211d4d
2 changed files with 88 additions and 89 deletions

View File

@ -671,6 +671,49 @@ ENTRY(longjmp)
incl %eax
ret
/*****************************************************************************/
/* linux_futex support */
/*****************************************************************************/
futex_fault:
movq $0,PCB_ONFAULT(%rcx)
movq $-EFAULT,%rax
ret
ENTRY(futex_xchgl)
movq PCPU(CURPCB),%rcx
movq $futex_fault,PCB_ONFAULT(%rcx)
movq $VM_MAXUSER_ADDRESS-4,%rax
cmpq %rax,%rsi
ja futex_fault
#ifdef SMP
lock
#endif
xchgl %edi,(%rsi)
movl %edi,(%rdx)
xorl %eax,%eax
movq %rax,PCB_ONFAULT(%rcx)
ret
ENTRY(futex_addl)
movq PCPU(CURPCB),%rcx
movq $futex_fault,PCB_ONFAULT(%rcx)
movq $VM_MAXUSER_ADDRESS-4,%rax
cmpq %rax,%rsi
ja futex_fault
#ifdef SMP
lock
#endif
xaddl %edi,(%rsi)
movl %edi,(%rdx)
xorl %eax,%eax
movq %rax,PCB_ONFAULT(%rcx)
ret
/*
* Support for BB-profiling (gcc -a). The kernbb program will extract
* the data from the kernel.
@ -689,46 +732,3 @@ NON_GPROF_ENTRY(__bb_init_func)
movq %rax,32(%rdi)
movq %rdi,bbhead
NON_GPROF_RET
.text
futex_fault:
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),%rcx
movq $futex_fault,PCB_ONFAULT(%rcx)
movq $VM_MAXUSER_ADDRESS-4,%rax
cmpq %rax,%rsi
ja futex_fault
#ifdef SMP
lock
#endif
xchgl %edi,(%rsi)
movl %edi,(%rdx)
xorl %eax,%eax
movq %rax,PCB_ONFAULT(%rcx)
ret
/* int futex_addl(int oparg, caddr_t uaddr, int *oldval); */
ENTRY(futex_addl)
movq PCPU(CURPCB),%rcx
movq $futex_fault,PCB_ONFAULT(%rcx)
movq $VM_MAXUSER_ADDRESS-4,%rax
cmpq %rax,%rsi
ja futex_fault
#ifdef SMP
lock
#endif
xaddl %edi,(%rsi)
movl %edi,(%rdx)
xorl %eax,%eax
movq %rax,PCB_ONFAULT(%rcx)
ret

View File

@ -1513,6 +1513,51 @@ ENTRY(longjmp)
incl %eax
ret
/*****************************************************************************/
/* linux_futex support */
/*****************************************************************************/
futex_fault:
movl $0,PCB_ONFAULT(%ecx)
movl $-EFAULT,%eax
ret
ENTRY(futex_xchgl)
movl PCPU(CURPCB),%ecx
movl $futex_fault,PCB_ONFAULT(%ecx)
movl 4(%esp),%eax
movl 8(%esp),%edx
cmpl $VM_MAXUSER_ADDRESS-4,%edx
ja futex_fault
#ifdef SMP
lock
#endif
xchgl %eax,(%edx)
movl 12(%esp),%edx
movl %eax,(%edx)
xorl %eax,%eax
movl $0,PCB_ONFAULT(%ecx)
ret
ENTRY(futex_addl)
movl PCPU(CURPCB),%ecx
movl $futex_fault,PCB_ONFAULT(%ecx)
movl 4(%esp),%eax
movl 8(%esp),%edx
cmpl $VM_MAXUSER_ADDRESS-4,%edx
ja futex_fault
#ifdef SMP
lock
#endif
xaddl %eax,(%edx)
movl 12(%esp),%edx
movl %eax,(%edx)
xorl %eax,%eax
movl $0,PCB_ONFAULT(%ecx)
ret
/*
* Support for BB-profiling (gcc -a). The kernbb program will extract
* the data from the kernel.
@ -1532,49 +1577,3 @@ NON_GPROF_ENTRY(__bb_init_func)
movl %edx,16(%eax)
movl %eax,bbhead
NON_GPROF_RET
/* necessary for linux_futex support */
.text
futex_fault:
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),%ecx
movl $futex_fault,PCB_ONFAULT(%ecx)
movl 4(%esp),%eax
movl 8(%esp),%edx
cmpl $VM_MAXUSER_ADDRESS-4,%edx
ja futex_fault
#ifdef SMP
lock
#endif
xchgl %eax,(%edx)
movl 12(%esp),%edx
movl %eax,(%edx)
xorl %eax,%eax
movl $0,PCB_ONFAULT(%ecx)
ret
/* int futex_addl(int oparg, caddr_t uaddr, int *oldval); */
ENTRY(futex_addl)
movl PCPU(CURPCB),%ecx
movl $futex_fault,PCB_ONFAULT(%ecx)
movl 4(%esp),%eax
movl 8(%esp),%edx
cmpl $VM_MAXUSER_ADDRESS-4,%edx
ja futex_fault
#ifdef SMP
lock
#endif
xaddl %eax,(%edx)
movl 12(%esp),%edx
movl %eax,(%edx)
xorl %eax,%eax
movl $0,PCB_ONFAULT(%ecx)
ret