Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * __put_user functions. |
| 3 | * |
| 4 | * (C) Copyright 1998 Linus Torvalds |
| 5 | * (C) Copyright 2001 Hirokazu Takata |
| 6 | * |
| 7 | * These functions have a non-standard call interface |
| 8 | * to make them more efficient. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/config.h> |
| 12 | |
| 13 | /* |
| 14 | * __put_user_X |
| 15 | * |
| 16 | * Inputs: r0 contains the address |
| 17 | * r1 contains the value |
| 18 | * |
| 19 | * Outputs: r0 is error code (0 or -EFAULT) |
| 20 | * r1 is corrupted (will contain "current_task"). |
| 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 __put_user_1 |
| 31 | __put_user_1: |
| 32 | 1: stb r1, @r0 || ldi r0, #0 |
| 33 | jmp r14 |
| 34 | |
| 35 | .balign 4 |
| 36 | .globl __put_user_2 |
| 37 | __put_user_2: |
| 38 | 2: sth r1, @r0 || ldi r0, #0 |
| 39 | jmp r14 |
| 40 | |
| 41 | .balign 4 |
| 42 | .globl __put_user_4 |
| 43 | __put_user_4: |
| 44 | 3: st r1, @r0 || ldi r0, #0 |
| 45 | jmp r14 |
| 46 | |
| 47 | bad_put_user: |
| 48 | ldi r0, #-14 || jmp r14 |
| 49 | |
| 50 | #else /* not CONFIG_ISA_DUAL_ISSUE */ |
| 51 | |
| 52 | .text |
| 53 | .balign 4 |
| 54 | .globl __put_user_1 |
| 55 | __put_user_1: |
| 56 | 1: stb r1, @r0 |
| 57 | ldi r0, #0 |
| 58 | jmp r14 |
| 59 | |
| 60 | .balign 4 |
| 61 | .globl __put_user_2 |
| 62 | __put_user_2: |
| 63 | 2: sth r1, @r0 |
| 64 | ldi r0, #0 |
| 65 | jmp r14 |
| 66 | |
| 67 | .balign 4 |
| 68 | .globl __put_user_4 |
| 69 | __put_user_4: |
| 70 | 3: st r1, @r0 |
| 71 | ldi r0, #0 |
| 72 | jmp r14 |
| 73 | |
| 74 | bad_put_user: |
| 75 | ldi r0, #-14 |
| 76 | jmp r14 |
| 77 | |
| 78 | #endif /* not CONFIG_ISA_DUAL_ISSUE */ |
| 79 | |
| 80 | .section __ex_table,"a" |
| 81 | .long 1b,bad_put_user |
| 82 | .long 2b,bad_put_user |
| 83 | .long 3b,bad_put_user |
| 84 | .previous |