Skip to content

Commit 8ede890

Browse files
author
Russell King
committed
ARM: uaccess: integrate uaccess_save and uaccess_restore
Integrate uaccess_save / uaccess_restore macros into the new uaccess_entry / uaccess_exit macros respectively. Signed-off-by: Russell King <[email protected]>
1 parent 747ffc2 commit 8ede890

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

arch/arm/include/asm/uaccess-asm.h

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,30 +67,23 @@
6767
#endif
6868
.endm
6969

70-
.macro uaccess_save, tmp
7170
#ifdef CONFIG_CPU_SW_DOMAIN_PAN
72-
mrc p15, 0, \tmp, c3, c0, 0
73-
str \tmp, [sp, #SVC_DACR]
74-
#endif
75-
.endm
76-
77-
.macro uaccess_restore
78-
#ifdef CONFIG_CPU_SW_DOMAIN_PAN
79-
ldr r0, [sp, #SVC_DACR]
80-
mcr p15, 0, r0, c3, c0, 0
71+
#define DACR(x...) x
72+
#else
73+
#define DACR(x...)
8174
#endif
82-
.endm
8375

8476
/*
8577
* Save the address limit on entry to a privileged exception and
8678
* if using PAN, save and disable usermode access.
8779
*/
8880
.macro uaccess_entry, tsk, tmp0, tmp1, tmp2, disable
89-
ldr \tmp0, [\tsk, #TI_ADDR_LIMIT]
90-
mov \tmp1, #TASK_SIZE
91-
str \tmp1, [\tsk, #TI_ADDR_LIMIT]
92-
str \tmp0, [sp, #SVC_ADDR_LIMIT]
93-
uaccess_save \tmp0
81+
ldr \tmp1, [\tsk, #TI_ADDR_LIMIT]
82+
mov \tmp2, #TASK_SIZE
83+
str \tmp2, [\tsk, #TI_ADDR_LIMIT]
84+
DACR( mrc p15, 0, \tmp0, c3, c0, 0)
85+
DACR( str \tmp0, [sp, #SVC_DACR])
86+
str \tmp1, [sp, #SVC_ADDR_LIMIT]
9487
.if \disable
9588
uaccess_disable \tmp0
9689
.endif
@@ -99,8 +92,11 @@
9992
/* Restore the user access state previously saved by uaccess_entry */
10093
.macro uaccess_exit, tsk, tmp0, tmp1
10194
ldr \tmp1, [sp, #SVC_ADDR_LIMIT]
102-
uaccess_restore
95+
DACR( ldr \tmp0, [sp, #SVC_DACR])
10396
str \tmp1, [\tsk, #TI_ADDR_LIMIT]
97+
DACR( mcr p15, 0, \tmp0, c3, c0, 0)
10498
.endm
10599

100+
#undef DACR
101+
106102
#endif /* __ASM_UACCESS_ASM_H__ */

0 commit comments

Comments
 (0)