Commit d4624bf6 authored by Vineet Gupta's avatar Vineet Gupta

ARCv2: entry: rearrange pt_regs slightly

Instead of r26,fp,sp,r12,r30 order as fp,r30,r12,r26,sp

 - keeps SP at well known position (right abive hardware autosave)
 - r26,r12 saved specifically for ARCv2 (and not in ARCv3) kept
   closer for easy ifdef'ry later
Signed-off-by: default avatarVineet Gupta <vgupta@kernel.org>
parent 656f18ad
...@@ -149,10 +149,10 @@ ...@@ -149,10 +149,10 @@
*/ */
.macro __SAVE_REGFILE_SOFT .macro __SAVE_REGFILE_SOFT
ST2 gp, fp, PT_r26 ; gp (r26), fp (r27) st fp, [sp, PT_fp] ; r27
st r12, [sp, PT_r12]
st r30, [sp, PT_r30] st r30, [sp, PT_r30]
st r12, [sp, PT_r12]
st r26, [sp, PT_r26] ; gp
; Saving pt_regs->sp correctly requires some extra work due to the way ; Saving pt_regs->sp correctly requires some extra work due to the way
; Auto stack switch works ; Auto stack switch works
...@@ -187,10 +187,10 @@ ...@@ -187,10 +187,10 @@
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
.macro __RESTORE_REGFILE_SOFT .macro __RESTORE_REGFILE_SOFT
LD2 gp, fp, PT_r26 ; gp (r26), fp (r27) ld fp, [sp, PT_fp]
ld r12, [sp, PT_r12]
ld r30, [sp, PT_r30] ld r30, [sp, PT_r30]
ld r12, [sp, PT_r12]
ld r26, [sp, PT_r26]
; Restore SP (into AUX_USER_SP) only if returning to U mode ; Restore SP (into AUX_USER_SP) only if returning to U mode
; - for K mode, it will be implicitly restored as stack is unwound ; - for K mode, it will be implicitly restored as stack is unwound
......
...@@ -77,11 +77,10 @@ struct pt_regs { ...@@ -77,11 +77,10 @@ struct pt_regs {
unsigned long bta; /* erbta */ unsigned long bta; /* erbta */
unsigned long r26; /* gp */
unsigned long fp; unsigned long fp;
unsigned long sp; /* user/kernel sp depending on where we came from */ unsigned long r30;
unsigned long r12;
unsigned long r12, r30; unsigned long r26; /* gp */
#ifdef CONFIG_ARC_HAS_ACCL_REGS #ifdef CONFIG_ARC_HAS_ACCL_REGS
unsigned long r58, r59; /* ACCL/ACCH used by FPU / DSP MPY */ unsigned long r58, r59; /* ACCL/ACCH used by FPU / DSP MPY */
...@@ -90,6 +89,8 @@ struct pt_regs { ...@@ -90,6 +89,8 @@ struct pt_regs {
unsigned long DSP_CTRL; unsigned long DSP_CTRL;
#endif #endif
unsigned long sp; /* user/kernel sp depending on entry */
/*------- Below list auto saved by h/w -----------*/ /*------- Below list auto saved by h/w -----------*/
unsigned long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11; unsigned long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11;
......
...@@ -62,11 +62,9 @@ int main(void) ...@@ -62,11 +62,9 @@ int main(void)
DEFINE(PT_r26, offsetof(struct pt_regs, r26)); DEFINE(PT_r26, offsetof(struct pt_regs, r26));
DEFINE(PT_ret, offsetof(struct pt_regs, ret)); DEFINE(PT_ret, offsetof(struct pt_regs, ret));
DEFINE(PT_blink, offsetof(struct pt_regs, blink)); DEFINE(PT_blink, offsetof(struct pt_regs, blink));
OFFSET(PT_fp, pt_regs, fp);
DEFINE(PT_lpe, offsetof(struct pt_regs, lp_end)); DEFINE(PT_lpe, offsetof(struct pt_regs, lp_end));
DEFINE(PT_lpc, offsetof(struct pt_regs, lp_count)); DEFINE(PT_lpc, offsetof(struct pt_regs, lp_count));
DEFINE(SZ_CALLEE_REGS, sizeof(struct callee_regs));
DEFINE(SZ_PT_REGS, sizeof(struct pt_regs));
#ifdef CONFIG_ISA_ARCV2 #ifdef CONFIG_ISA_ARCV2
OFFSET(PT_r12, pt_regs, r12); OFFSET(PT_r12, pt_regs, r12);
OFFSET(PT_r30, pt_regs, r30); OFFSET(PT_r30, pt_regs, r30);
...@@ -79,5 +77,8 @@ int main(void) ...@@ -79,5 +77,8 @@ int main(void)
OFFSET(PT_DSP_CTRL, pt_regs, DSP_CTRL); OFFSET(PT_DSP_CTRL, pt_regs, DSP_CTRL);
#endif #endif
DEFINE(SZ_CALLEE_REGS, sizeof(struct callee_regs));
DEFINE(SZ_PT_REGS, sizeof(struct pt_regs));
return 0; return 0;
} }
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