Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+14 -4
+2 -2
arch/arm/include/asm/assembler.h
··· 480 480 .macro uaccess_save, tmp 481 481 #ifdef CONFIG_CPU_SW_DOMAIN_PAN 482 482 mrc p15, 0, \tmp, c3, c0, 0 483 - str \tmp, [sp, #PT_REGS_SIZE] 483 + str \tmp, [sp, #SVC_DACR] 484 484 #endif 485 485 .endm 486 486 487 487 .macro uaccess_restore 488 488 #ifdef CONFIG_CPU_SW_DOMAIN_PAN 489 - ldr r0, [sp, #PT_REGS_SIZE] 489 + ldr r0, [sp, #SVC_DACR] 490 490 mcr p15, 0, r0, c3, c0, 0 491 491 #endif 492 492 .endm
+8
arch/arm/include/asm/ptrace.h
··· 13 13 #include <uapi/asm/ptrace.h> 14 14 15 15 #ifndef __ASSEMBLY__ 16 + #include <linux/types.h> 17 + 16 18 struct pt_regs { 17 19 unsigned long uregs[18]; 20 + }; 21 + 22 + struct svc_pt_regs { 23 + struct pt_regs regs; 24 + u32 dacr; 25 + u32 unused; 18 26 }; 19 27 20 28 #define user_mode(regs) \
+2
arch/arm/kernel/asm-offsets.c
··· 108 108 DEFINE(S_PSR, offsetof(struct pt_regs, ARM_cpsr)); 109 109 DEFINE(S_OLD_R0, offsetof(struct pt_regs, ARM_ORIG_r0)); 110 110 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)); 111 113 BLANK(); 112 114 #ifdef CONFIG_CACHE_L2X0 113 115 DEFINE(L2X0_R_PHY_BASE, offsetof(struct l2x0_regs, phy_base));
+2 -2
arch/arm/kernel/entry-armv.S
··· 152 152 .macro svc_entry, stack_hole=0, trace=1, uaccess=1 153 153 UNWIND(.fnstart ) 154 154 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) 156 156 #ifdef CONFIG_THUMB2_KERNEL 157 157 SPFIX( str r0, [sp] ) @ temporarily saved 158 158 SPFIX( mov r0, sp ) ··· 167 167 ldmia r0, {r3 - r5} 168 168 add r7, sp, #S_SP - 4 @ here for interlock avoidance 169 169 mov r6, #-1 @ "" "" "" "" 170 - add r2, sp, #(PT_REGS_SIZE + 8 + \stack_hole - 4) 170 + add r2, sp, #(SVC_REGS_SIZE + \stack_hole - 4) 171 171 SPFIX( addeq r2, r2, #4 ) 172 172 str r3, [sp, #-4]! @ save the "real" r0 copied 173 173 @ from the exception stack