x86, extable: Remove open-coded exception table entries in arch/x86/lib/getuser.S
[deliverable/linux.git] / arch / x86 / lib / putuser.S
CommitLineData
1da177e4
LT
1/*
2 * __put_user functions.
3 *
4 * (C) Copyright 2005 Linus Torvalds
5cbbc3b1
GC
5 * (C) Copyright 2005 Andi Kleen
6 * (C) Copyright 2008 Glauber Costa
1da177e4
LT
7 *
8 * These functions have a non-standard call interface
9 * to make them more efficient, especially as they
10 * return an error value in addition to the "real"
11 * return value.
12 */
00e065ea
JB
13#include <linux/linkage.h>
14#include <asm/dwarf2.h>
1da177e4 15#include <asm/thread_info.h>
5cbbc3b1 16#include <asm/errno.h>
2528de43 17#include <asm/asm.h>
1da177e4
LT
18
19
20/*
21 * __put_user_X
22 *
23 * Inputs: %eax[:%edx] contains the data
24 * %ecx contains the address
25 *
26 * Outputs: %eax is error code (0 or -EFAULT)
27 *
28 * These functions should not modify any other registers,
29 * as they get called from within inline assembly.
30 */
31
00e065ea 32#define ENTER CFI_STARTPROC ; \
2528de43 33 GET_THREAD_INFO(%_ASM_BX)
268cf048 34#define EXIT ret ; \
00e065ea 35 CFI_ENDPROC
1da177e4
LT
36
37.text
00e065ea 38ENTRY(__put_user_1)
1da177e4 39 ENTER
2528de43 40 cmp TI_addr_limit(%_ASM_BX),%_ASM_CX
1da177e4 41 jae bad_put_user
2528de43 421: movb %al,(%_ASM_CX)
efea505d 43 xor %eax,%eax
1da177e4 44 EXIT
00e065ea 45ENDPROC(__put_user_1)
1da177e4 46
00e065ea 47ENTRY(__put_user_2)
1da177e4 48 ENTER
2528de43
GC
49 mov TI_addr_limit(%_ASM_BX),%_ASM_BX
50 sub $1,%_ASM_BX
51 cmp %_ASM_BX,%_ASM_CX
1da177e4 52 jae bad_put_user
2528de43 532: movw %ax,(%_ASM_CX)
efea505d 54 xor %eax,%eax
1da177e4 55 EXIT
00e065ea 56ENDPROC(__put_user_2)
1da177e4 57
00e065ea 58ENTRY(__put_user_4)
1da177e4 59 ENTER
2528de43
GC
60 mov TI_addr_limit(%_ASM_BX),%_ASM_BX
61 sub $3,%_ASM_BX
62 cmp %_ASM_BX,%_ASM_CX
1da177e4 63 jae bad_put_user
2528de43 643: movl %eax,(%_ASM_CX)
efea505d 65 xor %eax,%eax
1da177e4 66 EXIT
00e065ea 67ENDPROC(__put_user_4)
1da177e4 68
00e065ea 69ENTRY(__put_user_8)
1da177e4 70 ENTER
2528de43
GC
71 mov TI_addr_limit(%_ASM_BX),%_ASM_BX
72 sub $7,%_ASM_BX
73 cmp %_ASM_BX,%_ASM_CX
1da177e4 74 jae bad_put_user
5cbbc3b1
GC
754: mov %_ASM_AX,(%_ASM_CX)
76#ifdef CONFIG_X86_32
2528de43 775: movl %edx,4(%_ASM_CX)
5cbbc3b1 78#endif
efea505d 79 xor %eax,%eax
1da177e4 80 EXIT
00e065ea 81ENDPROC(__put_user_8)
1da177e4
LT
82
83bad_put_user:
268cf048 84 CFI_STARTPROC
5cbbc3b1 85 movl $-EFAULT,%eax
1da177e4 86 EXIT
00e065ea 87END(bad_put_user)
1da177e4
LT
88
89.section __ex_table,"a"
2528de43
GC
90 _ASM_PTR 1b,bad_put_user
91 _ASM_PTR 2b,bad_put_user
92 _ASM_PTR 3b,bad_put_user
93 _ASM_PTR 4b,bad_put_user
5cbbc3b1 94#ifdef CONFIG_X86_32
2528de43 95 _ASM_PTR 5b,bad_put_user
5cbbc3b1 96#endif
1da177e4 97.previous
This page took 0.756295 seconds and 5 git commands to generate.