Skip to content

Commit e6a9dc6

Browse files
author
Russell King
committed
ARM: introduce svc_pt_regs structure
Since the privileged mode pt_regs are an extended version of the saved userland pt_regs, introduce a new svc_pt_regs structure to describe this layout. Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
1 parent 5745eef commit e6a9dc6

4 files changed

Lines changed: 14 additions & 4 deletions

File tree

‎arch/arm/include/asm/assembler.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,13 +480,13 @@ THUMB( orr \reg , \reg , #PSR_T_BIT )
480480
.macro uaccess_save, tmp
481481
#ifdef CONFIG_CPU_SW_DOMAIN_PAN
482482
mrc p15, 0, \tmp, c3, c0, 0
483-
str \tmp, [sp, #PT_REGS_SIZE]
483+
str \tmp, [sp, #SVC_DACR]
484484
#endif
485485
.endm
486486

487487
.macro uaccess_restore
488488
#ifdef CONFIG_CPU_SW_DOMAIN_PAN
489-
ldr r0, [sp, #PT_REGS_SIZE]
489+
ldr r0, [sp, #SVC_DACR]
490490
mcr p15, 0, r0, c3, c0, 0
491491
#endif
492492
.endm

‎arch/arm/include/asm/ptrace.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,18 @@
1313
#include <uapi/asm/ptrace.h>
1414

1515
#ifndef __ASSEMBLY__
16+
#include <linux/types.h>
17+
1618
struct pt_regs {
1719
unsigned long uregs[18];
1820
};
1921

22+
struct svc_pt_regs {
23+
struct pt_regs regs;
24+
u32 dacr;
25+
u32 unused;
26+
};
27+
2028
#define user_mode(regs) \
2129
(((regs)->ARM_cpsr & 0xf) == 0)
2230

‎arch/arm/kernel/asm-offsets.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ int main(void)
108108
DEFINE(S_PSR, offsetof(struct pt_regs, ARM_cpsr));
109109
DEFINE(S_OLD_R0, offsetof(struct pt_regs, ARM_ORIG_r0));
110110
DEFINE(PT_REGS_SIZE, sizeof(struct pt_regs));
111+
DEFINE(SVC_DACR, offsetof(struct svc_pt_regs, dacr));
112+
DEFINE(SVC_REGS_SIZE, sizeof(struct svc_pt_regs));
111113
BLANK();
112114
#ifdef CONFIG_CACHE_L2X0
113115
DEFINE(L2X0_R_PHY_BASE, offsetof(struct l2x0_regs, phy_base));

‎arch/arm/kernel/entry-armv.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ ENDPROC(__und_invalid)
152152
.macro svc_entry, stack_hole=0, trace=1, uaccess=1
153153
UNWIND(.fnstart )
154154
UNWIND(.save {r0 - pc} )
155-
sub sp, sp, #(PT_REGS_SIZE + 8 + \stack_hole - 4)
155+
sub sp, sp, #(SVC_REGS_SIZE + \stack_hole - 4)
156156
#ifdef CONFIG_THUMB2_KERNEL
157157
SPFIX( str r0, [sp] ) @ temporarily saved
158158
SPFIX( mov r0, sp )
@@ -167,7 +167,7 @@ ENDPROC(__und_invalid)
167167
ldmia r0, {r3 - r5}
168168
add r7, sp, #S_SP - 4 @ here for interlock avoidance
169169
mov r6, #-1 @ "" "" "" ""
170-
add r2, sp, #(PT_REGS_SIZE + 8 + \stack_hole - 4)
170+
add r2, sp, #(SVC_REGS_SIZE + \stack_hole - 4)
171171
SPFIX( addeq r2, r2, #4 )
172172
str r3, [sp, #-4]! @ save the "real" r0 copied
173173
@ from the exception stack

0 commit comments

Comments
 (0)