Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * __get_user functions. | |
3 | * | |
4 | * (C) Copyright 2001 Hirokazu Takata | |
5 | * | |
6 | * These functions have a non-standard call interface | |
7 | * to make them more efficient, especially as they | |
8 | * return an error value in addition to the "real" | |
9 | * return value. | |
10 | */ | |
11 | ||
12 | #include <linux/config.h> | |
13 | ||
14 | /* | |
15 | * __get_user_X | |
16 | * | |
17 | * Inputs: r0 contains the address | |
18 | * | |
19 | * Outputs: r0 is error code (0 or -EFAULT) | |
20 | * r1 contains zero-extended value | |
21 | * | |
22 | * These functions should not modify any other registers, | |
23 | * as they get called from within inline assembly. | |
24 | */ | |
25 | ||
26 | #ifdef CONFIG_ISA_DUAL_ISSUE | |
27 | ||
28 | .text | |
29 | .balign 4 | |
30 | .globl __get_user_1 | |
31 | __get_user_1: | |
32 | 1: ldub r1, @r0 || ldi r0, #0 | |
33 | jmp r14 | |
34 | ||
35 | .balign 4 | |
36 | .globl __get_user_2 | |
37 | __get_user_2: | |
38 | 2: lduh r1, @r0 || ldi r0, #0 | |
39 | jmp r14 | |
40 | ||
41 | .balign 4 | |
42 | .globl __get_user_4 | |
43 | __get_user_4: | |
44 | 3: ld r1, @r0 || ldi r0, #0 | |
45 | jmp r14 | |
46 | ||
47 | bad_get_user: | |
48 | ldi r1, #0 || ldi r0, #-14 | |
49 | jmp r14 | |
50 | ||
51 | #else /* not CONFIG_ISA_DUAL_ISSUE */ | |
52 | ||
53 | .text | |
54 | .balign 4 | |
55 | .globl __get_user_1 | |
56 | __get_user_1: | |
57 | 1: ldub r1, @r0 | |
58 | ldi r0, #0 | |
59 | jmp r14 | |
60 | ||
61 | .balign 4 | |
62 | .globl __get_user_2 | |
63 | __get_user_2: | |
64 | 2: lduh r1, @r0 | |
65 | ldi r0, #0 | |
66 | jmp r14 | |
67 | ||
68 | .balign 4 | |
69 | .globl __get_user_4 | |
70 | __get_user_4: | |
71 | 3: ld r1, @r0 | |
72 | ldi r0, #0 | |
73 | jmp r14 | |
74 | ||
75 | bad_get_user: | |
76 | ldi r1, #0 | |
77 | ldi r0, #-14 | |
78 | jmp r14 | |
79 | ||
80 | #endif /* not CONFIG_ISA_DUAL_ISSUE */ | |
81 | ||
82 | .section __ex_table,"a" | |
83 | .long 1b,bad_get_user | |
84 | .long 2b,bad_get_user | |
85 | .long 3b,bad_get_user | |
86 | .previous | |
87 | ||
88 | .end |