Commit 766ed428 authored by Glauber Costa's avatar Glauber Costa Committed by Ingo Molnar

x86: replace function headers by macros.

In putuser_64.S, do it the i386 way, and replace the code
in beginning and end of functions with macros, since it's
always the same thing. Save lines.
Signed-off-by: default avatarGlauber Costa <gcosta@redhat.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 663aa96d
...@@ -31,62 +31,58 @@ ...@@ -31,62 +31,58 @@
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
#include <asm/thread_info.h> #include <asm/thread_info.h>
#define ENTER CFI_STARTPROC ; \
GET_THREAD_INFO(%rbx)
#define EXIT ret ; \
CFI_ENDPROC
.text .text
ENTRY(__put_user_1) ENTRY(__put_user_1)
CFI_STARTPROC ENTER
GET_THREAD_INFO(%rbx)
cmpq TI_addr_limit(%rbx),%rcx cmpq TI_addr_limit(%rbx),%rcx
jae bad_put_user jae bad_put_user
1: movb %al,(%rcx) 1: movb %al,(%rcx)
xorl %eax,%eax xorl %eax,%eax
ret EXIT
CFI_ENDPROC
ENDPROC(__put_user_1) ENDPROC(__put_user_1)
ENTRY(__put_user_2) ENTRY(__put_user_2)
CFI_STARTPROC ENTER
GET_THREAD_INFO(%rbx)
mov TI_addr_limit(%rbx),%rbx mov TI_addr_limit(%rbx),%rbx
sub $1, %rbx sub $1, %rbx
cmpq %rbx ,%rcx cmpq %rbx ,%rcx
jae bad_put_user jae bad_put_user
2: movw %ax,(%rcx) 2: movw %ax,(%rcx)
xorl %eax,%eax xorl %eax,%eax
ret EXIT
CFI_ENDPROC
ENDPROC(__put_user_2) ENDPROC(__put_user_2)
ENTRY(__put_user_4) ENTRY(__put_user_4)
CFI_STARTPROC ENTER
GET_THREAD_INFO(%rbx)
mov TI_addr_limit(%rbx),%rbx mov TI_addr_limit(%rbx),%rbx
sub $3, %rbx sub $3, %rbx
cmp %rbx, %rcx cmp %rbx, %rcx
jae bad_put_user jae bad_put_user
3: movl %eax,(%rcx) 3: movl %eax,(%rcx)
xorl %eax,%eax xorl %eax,%eax
ret EXIT
CFI_ENDPROC
ENDPROC(__put_user_4) ENDPROC(__put_user_4)
ENTRY(__put_user_8) ENTRY(__put_user_8)
CFI_STARTPROC ENTER
GET_THREAD_INFO(%rbx)
mov TI_addr_limit(%rbx),%rbx mov TI_addr_limit(%rbx),%rbx
sub $7, %rbx sub $7, %rbx
cmp %rbx, %rcx cmp %rbx, %rcx
jae bad_put_user jae bad_put_user
4: movq %rax,(%rcx) 4: movq %rax,(%rcx)
xorl %eax,%eax xorl %eax,%eax
ret EXIT
CFI_ENDPROC
ENDPROC(__put_user_8) ENDPROC(__put_user_8)
bad_put_user: bad_put_user:
CFI_STARTPROC CFI_STARTPROC
movq $(-EFAULT),%rax movq $(-EFAULT),%rax
ret EXIT
CFI_ENDPROC
END(bad_put_user) END(bad_put_user)
.section __ex_table,"a" .section __ex_table,"a"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment