2 * linux/arch/arm/lib/uaccess-armo.S
4 * Copyright (C) 1998 Russell King
6 * Note! Some code fragments found in here have a special calling
7 * convention - they are not APCS compliant!
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
13 #include <linux/linkage.h>
14 #include <asm/assembler.h>
18 .globl SYMBOL_NAME(uaccess_user)
19 SYMBOL_NAME(uaccess_user):
20 .word uaccess_user_put_byte
21 .word uaccess_user_get_byte
22 .word uaccess_user_put_half
23 .word uaccess_user_get_half
24 .word uaccess_user_put_word
25 .word uaccess_user_get_word
26 .word __arch_copy_from_user
27 .word __arch_copy_to_user
28 .word __arch_clear_user
29 .word __arch_strncpy_from_user
30 .word __arch_strnlen_user
33 @ In : r0 = x, r1 = addr, r2 = error
35 uaccess_user_put_byte:
40 @ In : r0 = x, r1 = addr, r2 = error
42 uaccess_user_put_half:
44 USER( strbt r0, [r1], #1)
49 @ In : r0 = x, r1 = addr, r2 = error
51 uaccess_user_put_word:
56 9001: mov r2, #-EFAULT
59 @ In : r0 = addr, r1 = error
60 @ Out: r0 = x, r1 = error
61 uaccess_user_get_byte:
66 @ In : r0 = addr, r1 = error
67 @ Out: r0 = x, r1 = error
68 uaccess_user_get_half:
75 @ In : r0 = addr, r1 = error
76 @ Out: r0 = x, r1 = error
77 uaccess_user_get_word:
82 9001: mov r1, #-EFAULT
87 .globl SYMBOL_NAME(uaccess_kernel)
88 SYMBOL_NAME(uaccess_kernel):
89 .word uaccess_kernel_put_byte
90 .word uaccess_kernel_get_byte
91 .word uaccess_kernel_put_half
92 .word uaccess_kernel_get_half
93 .word uaccess_kernel_put_word
94 .word uaccess_kernel_get_word
95 .word uaccess_kernel_copy
96 .word uaccess_kernel_copy
97 .word uaccess_kernel_clear
98 .word uaccess_kernel_strncpy_from
99 .word uaccess_kernel_strnlen
101 @ In : r0 = x, r1 = addr, r2 = error
103 uaccess_kernel_put_byte:
108 @ In : r0 = x, r1 = addr, r2 = error
110 uaccess_kernel_put_half:
117 @ In : r0 = x, r1 = addr, r2 = error
119 uaccess_kernel_put_word:
124 @ In : r0 = addr, r1 = error
125 @ Out: r0 = x, r1 = error
126 uaccess_kernel_get_byte:
131 @ In : r0 = addr, r1 = error
132 @ Out: r0 = x, r1 = error
133 uaccess_kernel_get_half:
140 @ In : r0 = addr, r1 = error
141 @ Out: r0 = x, r1 = error
142 uaccess_kernel_get_word:
148 /* Prototype: int uaccess_kernel_copy(void *to, const char *from, size_t n)
149 * Purpose : copy a block to kernel memory from kernel memory
150 * Params : to - kernel memory
151 * : from - kernel memory
152 * : n - number of bytes to copy
153 * Returns : Number of bytes NOT copied.
157 bl SYMBOL_NAME(memcpy)
161 /* Prototype: int uaccess_kernel_clear(void *addr, size_t sz)
162 * Purpose : clear some kernel memory
163 * Params : addr - kernel memory address to clear
164 * : sz - number of bytes to clear
165 * Returns : number of bytes NOT cleared
167 uaccess_kernel_clear:
179 sub r1, r1, ip @ 7 6 5 4 3 2 1
180 1: subs r1, r1, #8 @ -1 -2 -3 -4 -5 -6 -7
185 2: adds r1, r1, #4 @ 3 2 1 0 -1 -2 -3
187 tst r1, #2 @ 1x 1x 0x 0x 1x 1x 0x
190 tst r1, #1 @ x1 x0 x1 x0 x1 x0 x1
195 /* Prototype: size_t uaccess_kernel_strncpy_from(char *dst, char *src, size_t len)
196 * Purpose : copy a string from kernel memory to kernel memory
197 * Params : dst - kernel memory destination
198 * : src - kernel memory source
199 * : len - maximum length of string
200 * Returns : number of characters copied
202 uaccess_kernel_strncpy_from:
214 /* Prototype: int uaccess_kernel_strlen(char *str, long n)
215 * Purpose : get length of a string in kernel memory
216 * Params : str - address of string in kernel memory
217 * Returns : length of string *including terminator*,
218 * or zero on exception, or n + 1 if too long
220 uaccess_kernel_strnlen: