Commit e6a9dc61 authored by Russell King's avatar Russell King

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: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent 5745eef6
...@@ -480,13 +480,13 @@ THUMB( orr \reg , \reg , #PSR_T_BIT ) ...@@ -480,13 +480,13 @@ THUMB( orr \reg , \reg , #PSR_T_BIT )
.macro uaccess_save, tmp .macro uaccess_save, tmp
#ifdef CONFIG_CPU_SW_DOMAIN_PAN #ifdef CONFIG_CPU_SW_DOMAIN_PAN
mrc p15, 0, \tmp, c3, c0, 0 mrc p15, 0, \tmp, c3, c0, 0
str \tmp, [sp, #PT_REGS_SIZE] str \tmp, [sp, #SVC_DACR]
#endif #endif
.endm .endm
.macro uaccess_restore .macro uaccess_restore
#ifdef CONFIG_CPU_SW_DOMAIN_PAN #ifdef CONFIG_CPU_SW_DOMAIN_PAN
ldr r0, [sp, #PT_REGS_SIZE] ldr r0, [sp, #SVC_DACR]
mcr p15, 0, r0, c3, c0, 0 mcr p15, 0, r0, c3, c0, 0
#endif #endif
.endm .endm
......
...@@ -13,10 +13,18 @@ ...@@ -13,10 +13,18 @@
#include <uapi/asm/ptrace.h> #include <uapi/asm/ptrace.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <linux/types.h>
struct pt_regs { struct pt_regs {
unsigned long uregs[18]; unsigned long uregs[18];
}; };
struct svc_pt_regs {
struct pt_regs regs;
u32 dacr;
u32 unused;
};
#define user_mode(regs) \ #define user_mode(regs) \
(((regs)->ARM_cpsr & 0xf) == 0) (((regs)->ARM_cpsr & 0xf) == 0)
......
...@@ -108,6 +108,8 @@ int main(void) ...@@ -108,6 +108,8 @@ int main(void)
DEFINE(S_PSR, offsetof(struct pt_regs, ARM_cpsr)); DEFINE(S_PSR, offsetof(struct pt_regs, ARM_cpsr));
DEFINE(S_OLD_R0, offsetof(struct pt_regs, ARM_ORIG_r0)); DEFINE(S_OLD_R0, offsetof(struct pt_regs, ARM_ORIG_r0));
DEFINE(PT_REGS_SIZE, sizeof(struct pt_regs)); DEFINE(PT_REGS_SIZE, sizeof(struct pt_regs));
DEFINE(SVC_DACR, offsetof(struct svc_pt_regs, dacr));
DEFINE(SVC_REGS_SIZE, sizeof(struct svc_pt_regs));
BLANK(); BLANK();
#ifdef CONFIG_CACHE_L2X0 #ifdef CONFIG_CACHE_L2X0
DEFINE(L2X0_R_PHY_BASE, offsetof(struct l2x0_regs, phy_base)); DEFINE(L2X0_R_PHY_BASE, offsetof(struct l2x0_regs, phy_base));
......
...@@ -152,7 +152,7 @@ ENDPROC(__und_invalid) ...@@ -152,7 +152,7 @@ ENDPROC(__und_invalid)
.macro svc_entry, stack_hole=0, trace=1, uaccess=1 .macro svc_entry, stack_hole=0, trace=1, uaccess=1
UNWIND(.fnstart ) UNWIND(.fnstart )
UNWIND(.save {r0 - pc} ) UNWIND(.save {r0 - pc} )
sub sp, sp, #(PT_REGS_SIZE + 8 + \stack_hole - 4) sub sp, sp, #(SVC_REGS_SIZE + \stack_hole - 4)
#ifdef CONFIG_THUMB2_KERNEL #ifdef CONFIG_THUMB2_KERNEL
SPFIX( str r0, [sp] ) @ temporarily saved SPFIX( str r0, [sp] ) @ temporarily saved
SPFIX( mov r0, sp ) SPFIX( mov r0, sp )
...@@ -167,7 +167,7 @@ ENDPROC(__und_invalid) ...@@ -167,7 +167,7 @@ ENDPROC(__und_invalid)
ldmia r0, {r3 - r5} ldmia r0, {r3 - r5}
add r7, sp, #S_SP - 4 @ here for interlock avoidance add r7, sp, #S_SP - 4 @ here for interlock avoidance
mov r6, #-1 @ "" "" "" "" mov r6, #-1 @ "" "" "" ""
add r2, sp, #(PT_REGS_SIZE + 8 + \stack_hole - 4) add r2, sp, #(SVC_REGS_SIZE + \stack_hole - 4)
SPFIX( addeq r2, r2, #4 ) SPFIX( addeq r2, r2, #4 )
str r3, [sp, #-4]! @ save the "real" r0 copied str r3, [sp, #-4]! @ save the "real" r0 copied
@ from the exception stack @ from the exception stack
......
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