Skip to content

Commit

Permalink
x86: adapt x86_64 getuser functions.
Browse files Browse the repository at this point in the history
Instead of doing a sub after the addition, use the
offset directly at the memory operand of the mov instructions.
This is the way i386 do.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Glauber Costa authored and Ingo Molnar committed Jul 9, 2008
1 parent 9aa0388 commit 9262875
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions arch/x86/lib/getuser_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -47,49 +47,40 @@ ENDPROC(__get_user_1)

ENTRY(__get_user_2)
CFI_STARTPROC
GET_THREAD_INFO(%rdx)
addq $1,%rax
jc 20f
jc bad_get_user
GET_THREAD_INFO(%rdx)
cmpq threadinfo_addr_limit(%rdx),%rax
jae 20f
decq %rax
2: movzwl (%rax),%edx
jae bad_get_user
2: movzwl -1(%rax),%edx
xorl %eax,%eax
ret
20: decq %rax
jmp bad_get_user
CFI_ENDPROC
ENDPROC(__get_user_2)

ENTRY(__get_user_4)
CFI_STARTPROC
GET_THREAD_INFO(%rdx)
addq $3,%rax
jc 30f
jc bad_get_user
GET_THREAD_INFO(%rdx)
cmpq threadinfo_addr_limit(%rdx),%rax
jae 30f
subq $3,%rax
3: movl (%rax),%edx
jae bad_get_user
3: movl -3(%rax),%edx
xorl %eax,%eax
ret
30: subq $3,%rax
jmp bad_get_user
CFI_ENDPROC
ENDPROC(__get_user_4)

ENTRY(__get_user_8)
CFI_STARTPROC
GET_THREAD_INFO(%rdx)
addq $7,%rax
jc 40f
jc bad_get_user
GET_THREAD_INFO(%rdx)
cmpq threadinfo_addr_limit(%rdx),%rax
jae 40f
subq $7,%rax
4: movq (%rax),%rdx
jae bad_get_user
4: movq -7(%rax),%rdx
xorl %eax,%eax
ret
40: subq $7,%rax
jmp bad_get_user
CFI_ENDPROC
ENDPROC(__get_user_8)

Expand Down

0 comments on commit 9262875

Please sign in to comment.