Commit 6fad9ddc authored by Max Filippov's avatar Max Filippov

xtensa: rename PT_SIZE to PT_KERNEL_SIZE

PT_SIZE is used by the xtensa port to designate kernel exception frame
size. In preparation for struct pt_regs size change rename PT_SIZE to
PT_KERNEL_SIZE for clarity and change its definition to always cover
only the kernel exception frame.
Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
parent 6496f3a7
...@@ -63,7 +63,7 @@ int main(void) ...@@ -63,7 +63,7 @@ int main(void)
DEFINE(PT_AREG15, offsetof (struct pt_regs, areg[15])); DEFINE(PT_AREG15, offsetof (struct pt_regs, areg[15]));
DEFINE(PT_WINDOWBASE, offsetof (struct pt_regs, windowbase)); DEFINE(PT_WINDOWBASE, offsetof (struct pt_regs, windowbase));
DEFINE(PT_WINDOWSTART, offsetof(struct pt_regs, windowstart)); DEFINE(PT_WINDOWSTART, offsetof(struct pt_regs, windowstart));
DEFINE(PT_SIZE, sizeof(struct pt_regs)); DEFINE(PT_KERNEL_SIZE, offsetof(struct pt_regs, areg[16]));
DEFINE(PT_AREG_END, offsetof (struct pt_regs, areg[XCHAL_NUM_AREGS])); DEFINE(PT_AREG_END, offsetof (struct pt_regs, areg[XCHAL_NUM_AREGS]));
DEFINE(PT_USER_SIZE, offsetof(struct pt_regs, areg[XCHAL_NUM_AREGS])); DEFINE(PT_USER_SIZE, offsetof(struct pt_regs, areg[XCHAL_NUM_AREGS]));
DEFINE(PT_XTREGS_OPT, offsetof(struct pt_regs, xtregs_opt)); DEFINE(PT_XTREGS_OPT, offsetof(struct pt_regs, xtregs_opt));
......
...@@ -341,8 +341,8 @@ KABI_W _bbsi.l a2, 3, 1f ...@@ -341,8 +341,8 @@ KABI_W _bbsi.l a2, 3, 1f
/* Copy spill slots of a0 and a1 to imitate movsp /* Copy spill slots of a0 and a1 to imitate movsp
* in order to keep exception stack continuous * in order to keep exception stack continuous
*/ */
l32i a3, a1, PT_SIZE l32i a3, a1, PT_KERNEL_SIZE
l32i a0, a1, PT_SIZE + 4 l32i a0, a1, PT_KERNEL_SIZE + 4
s32e a3, a1, -16 s32e a3, a1, -16
s32e a0, a1, -12 s32e a0, a1, -12
#endif #endif
...@@ -706,12 +706,12 @@ kernel_exception_exit: ...@@ -706,12 +706,12 @@ kernel_exception_exit:
addi a0, a1, -16 addi a0, a1, -16
l32i a3, a0, 0 l32i a3, a0, 0
l32i a4, a0, 4 l32i a4, a0, 4
s32i a3, a1, PT_SIZE+0 s32i a3, a1, PT_KERNEL_SIZE + 0
s32i a4, a1, PT_SIZE+4 s32i a4, a1, PT_KERNEL_SIZE + 4
l32i a3, a0, 8 l32i a3, a0, 8
l32i a4, a0, 12 l32i a4, a0, 12
s32i a3, a1, PT_SIZE+8 s32i a3, a1, PT_KERNEL_SIZE + 8
s32i a4, a1, PT_SIZE+12 s32i a4, a1, PT_KERNEL_SIZE + 12
/* Common exception exit. /* Common exception exit.
* We restore the special register and the current window frame, and * We restore the special register and the current window frame, and
...@@ -821,7 +821,7 @@ ENTRY(debug_exception) ...@@ -821,7 +821,7 @@ ENTRY(debug_exception)
bbsi.l a2, PS_UM_BIT, 2f # jump if user mode bbsi.l a2, PS_UM_BIT, 2f # jump if user mode
addi a2, a1, -16-PT_SIZE # assume kernel stack addi a2, a1, -16 - PT_KERNEL_SIZE # assume kernel stack
3: 3:
l32i a0, a3, DT_DEBUG_SAVE l32i a0, a3, DT_DEBUG_SAVE
s32i a1, a2, PT_AREG1 s32i a1, a2, PT_AREG1
......
...@@ -88,7 +88,7 @@ ENDPROC(_UserExceptionVector) ...@@ -88,7 +88,7 @@ ENDPROC(_UserExceptionVector)
* Kernel exception vector. (Exceptions with PS.UM == 0, PS.EXCM == 0) * Kernel exception vector. (Exceptions with PS.UM == 0, PS.EXCM == 0)
* *
* We get this exception when we were already in kernel space. * We get this exception when we were already in kernel space.
* We decrement the current stack pointer (kernel) by PT_SIZE and * We decrement the current stack pointer (kernel) by PT_KERNEL_SIZE and
* jump to the first-level handler associated with the exception cause. * jump to the first-level handler associated with the exception cause.
* *
* Note: we need to preserve space for the spill region. * Note: we need to preserve space for the spill region.
...@@ -100,7 +100,7 @@ ENTRY(_KernelExceptionVector) ...@@ -100,7 +100,7 @@ ENTRY(_KernelExceptionVector)
xsr a3, excsave1 # save a3, and get dispatch table xsr a3, excsave1 # save a3, and get dispatch table
wsr a2, depc # save a2 wsr a2, depc # save a2
addi a2, a1, -16-PT_SIZE # adjust stack pointer addi a2, a1, -16 - PT_KERNEL_SIZE # adjust stack pointer
s32i a0, a2, PT_AREG0 # save a0 to ESF s32i a0, a2, PT_AREG0 # save a0 to ESF
rsr a0, exccause # retrieve exception cause rsr a0, exccause # retrieve exception cause
s32i a0, a2, PT_DEPC # mark it as a regular exception s32i a0, a2, PT_DEPC # mark it as a regular exception
......
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