Commit 733536b8 authored by Max Filippov's avatar Max Filippov Committed by Chris Zankel

xtensa: save and restore scompare1 SR on kernel entry

Although scompare1 may be saved/restored by xchal_ncp_{load,store}
macros, explicit save/restore of registers manipulated by the kernel
itself is considered more correct.
Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
Signed-off-by: default avatarChris Zankel <chris@zankel.net>
parent 2f6ea6a7
...@@ -37,7 +37,7 @@ struct pt_regs { ...@@ -37,7 +37,7 @@ struct pt_regs {
unsigned long windowstart; /* 52 */ unsigned long windowstart; /* 52 */
unsigned long syscall; /* 56 */ unsigned long syscall; /* 56 */
unsigned long icountlevel; /* 60 */ unsigned long icountlevel; /* 60 */
int reserved[1]; /* 64 */ unsigned long scompare1; /* 64 */
/* Additional configurable registers that are used by the compiler. */ /* Additional configurable registers that are used by the compiler. */
xtregs_opt_t xtregs_opt; xtregs_opt_t xtregs_opt;
......
...@@ -41,6 +41,7 @@ int main(void) ...@@ -41,6 +41,7 @@ int main(void)
DEFINE(PT_SAR, offsetof (struct pt_regs, sar)); DEFINE(PT_SAR, offsetof (struct pt_regs, sar));
DEFINE(PT_ICOUNTLEVEL, offsetof (struct pt_regs, icountlevel)); DEFINE(PT_ICOUNTLEVEL, offsetof (struct pt_regs, icountlevel));
DEFINE(PT_SYSCALL, offsetof (struct pt_regs, syscall)); DEFINE(PT_SYSCALL, offsetof (struct pt_regs, syscall));
DEFINE(PT_SCOMPARE1, offsetof(struct pt_regs, scompare1));
DEFINE(PT_AREG, offsetof (struct pt_regs, areg[0])); DEFINE(PT_AREG, offsetof (struct pt_regs, areg[0]));
DEFINE(PT_AREG0, offsetof (struct pt_regs, areg[0])); DEFINE(PT_AREG0, offsetof (struct pt_regs, areg[0]));
DEFINE(PT_AREG1, offsetof (struct pt_regs, areg[1])); DEFINE(PT_AREG1, offsetof (struct pt_regs, areg[1]));
......
...@@ -372,6 +372,13 @@ common_exception: ...@@ -372,6 +372,13 @@ common_exception:
s32i a2, a1, PT_LBEG s32i a2, a1, PT_LBEG
s32i a3, a1, PT_LEND s32i a3, a1, PT_LEND
/* Save SCOMPARE1 */
#if XCHAL_HAVE_S32C1I
rsr a2, scompare1
s32i a2, a1, PT_SCOMPARE1
#endif
/* Save optional registers. */ /* Save optional registers. */
save_xtregs_opt a1 a2 a4 a5 a6 a7 PT_XTREGS_OPT save_xtregs_opt a1 a2 a4 a5 a6 a7 PT_XTREGS_OPT
...@@ -433,6 +440,12 @@ common_exception_return: ...@@ -433,6 +440,12 @@ common_exception_return:
load_xtregs_opt a1 a2 a4 a5 a6 a7 PT_XTREGS_OPT load_xtregs_opt a1 a2 a4 a5 a6 a7 PT_XTREGS_OPT
/* Restore SCOMPARE1 */
#if XCHAL_HAVE_S32C1I
l32i a2, a1, PT_SCOMPARE1
wsr a2, scompare1
#endif
wsr a3, ps /* disable interrupts */ wsr a3, ps /* disable interrupts */
_bbci.l a3, PS_UM_BIT, kernel_exception_exit _bbci.l a3, PS_UM_BIT, kernel_exception_exit
......
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