Commit 842f2d59 authored by Russell King's avatar Russell King

[ARM] Remove unnecessary get_user/put_user checks.

Remove unnecessary checks for addresses > TI_ADDR_LIMIT in
get_user/put_user.  The MMU will catch out of bounds accesses
for us.
parent ef4ecc64
...@@ -32,59 +32,34 @@ ...@@ -32,59 +32,34 @@
.global __get_user_1 .global __get_user_1
__get_user_1: __get_user_1:
bic r1, sp, #0x1f00 1: ldrbt r1, [r0]
bic r1, r1, #0x00ff mov r0, #0
ldr r1, [r1, #TI_ADDR_LIMIT] mov pc, lr
sub r1, r1, #1
cmp r0, r1
1: ldrlsbt r1, [r0]
movls r0, #0
movls pc, lr
b __get_user_bad
.global __get_user_2 .global __get_user_2
__get_user_2: __get_user_2:
bic r2, sp, #0x1f00 2: ldrbt r1, [r0], #1
bic r2, r2, #0x00ff 3: ldrbt r2, [r0]
ldr r2, [r2, #TI_ADDR_LIMIT]
sub r2, r2, #2
cmp r0, r2
2: ldrlsbt r1, [r0], #1
3: ldrlsbt r2, [r0]
#ifndef __ARMEB__ #ifndef __ARMEB__
orrls r1, r1, r2, lsl #8 orr r1, r1, r2, lsl #8
#else #else
orrls r1, r2, r1, lsl #8 orr r1, r2, r1, lsl #8
#endif #endif
movls r0, #0 mov r0, #0
movls pc, lr mov pc, lr
b __get_user_bad
.global __get_user_4 .global __get_user_4
__get_user_4: __get_user_4:
bic r1, sp, #0x1f00 4: ldrt r1, [r0]
bic r1, r1, #0x00ff mov r0, #0
ldr r1, [r1, #TI_ADDR_LIMIT] mov pc, lr
sub r1, r1, #4
cmp r0, r1
4: ldrlst r1, [r0]
movls r0, #0
movls pc, lr
b __get_user_bad
.global __get_user_8 .global __get_user_8
__get_user_8: __get_user_8:
bic r2, sp, #0x1f00 5: ldrt r1, [r0], #4
bic r2, r2, #0x00ff 6: ldrt r2, [r0]
ldr r2, [r2, #TI_ADDR_LIMIT] mov r0, #0
sub r2, r2, #8 mov pc, lr
cmp r0, r2
5: ldrlst r1, [r0], #4
6: ldrlst r2, [r0]
movls r0, #0
movls pc, lr
/* fall through */
__get_user_bad_8: __get_user_bad_8:
mov r2, #0 mov r2, #0
......
...@@ -32,60 +32,35 @@ ...@@ -32,60 +32,35 @@
.global __put_user_1 .global __put_user_1
__put_user_1: __put_user_1:
bic ip, sp, #0x1f00 1: strbt r1, [r0]
bic ip, ip, #0x00ff mov r0, #0
ldr ip, [ip, #TI_ADDR_LIMIT] mov pc, lr
sub ip, ip, #1
cmp r0, ip
1: strlsbt r1, [r0]
movls r0, #0
movls pc, lr
b __put_user_bad
.global __put_user_2 .global __put_user_2
__put_user_2: __put_user_2:
bic ip, sp, #0x1f00 mov ip, r1, lsr #8
bic ip, ip, #0x00ff
ldr ip, [ip, #TI_ADDR_LIMIT]
sub ip, ip, #2
cmp r0, ip
movls ip, r1, lsr #8
#ifndef __ARMEB__ #ifndef __ARMEB__
2: strlsbt r1, [r0], #1 2: strbt r1, [r0], #1
3: strlsbt ip, [r0] 3: strbt ip, [r0]
#else #else
2: strlsbt ip, [r0], #1 2: strbt ip, [r0], #1
3: strlsbt r1, [r0] 3: strbt r1, [r0]
#endif #endif
movls r0, #0 mov r0, #0
movls pc, lr mov pc, lr
b __put_user_bad
.global __put_user_4 .global __put_user_4
__put_user_4: __put_user_4:
bic ip, sp, #0x1f00 4: strt r1, [r0]
bic ip, ip, #0x00ff mov r0, #0
ldr ip, [ip, #TI_ADDR_LIMIT] mov pc, lr
sub ip, ip, #4
cmp r0, ip
4: strlst r1, [r0]
movls r0, #0
movls pc, lr
b __put_user_bad
.global __put_user_8 .global __put_user_8
__put_user_8: __put_user_8:
bic ip, sp, #0x1f00 5: strt r1, [r0], #4
bic ip, ip, #0x00ff 6: strt r2, [r0]
ldr ip, [ip, #TI_ADDR_LIMIT] mov r0, #0
sub ip, ip, #8 mov pc, lr
cmp r0, ip
5: strlst r1, [r0], #4
6: strlst r2, [r0]
movls r0, #0
movls pc, lr
/* fall through */
__put_user_bad: __put_user_bad:
mov r0, #-EFAULT mov r0, #-EFAULT
......
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