Skip to content

Commit 6fad9dd

Browse files
committed
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: Max Filippov <jcmvbkbc@gmail.com> Reviewed-by: Kees Cook <keescook@chromium.org>
1 parent 6496f3a commit 6fad9dd

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

arch/xtensa/kernel/asm-offsets.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ int main(void)
6363
DEFINE(PT_AREG15, offsetof (struct pt_regs, areg[15]));
6464
DEFINE(PT_WINDOWBASE, offsetof (struct pt_regs, windowbase));
6565
DEFINE(PT_WINDOWSTART, offsetof(struct pt_regs, windowstart));
66-
DEFINE(PT_SIZE, sizeof(struct pt_regs));
66+
DEFINE(PT_KERNEL_SIZE, offsetof(struct pt_regs, areg[16]));
6767
DEFINE(PT_AREG_END, offsetof (struct pt_regs, areg[XCHAL_NUM_AREGS]));
6868
DEFINE(PT_USER_SIZE, offsetof(struct pt_regs, areg[XCHAL_NUM_AREGS]));
6969
DEFINE(PT_XTREGS_OPT, offsetof(struct pt_regs, xtregs_opt));

arch/xtensa/kernel/entry.S

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,8 @@ KABI_W _bbsi.l a2, 3, 1f
341341
/* Copy spill slots of a0 and a1 to imitate movsp
342342
* in order to keep exception stack continuous
343343
*/
344-
l32i a3, a1, PT_SIZE
345-
l32i a0, a1, PT_SIZE + 4
344+
l32i a3, a1, PT_KERNEL_SIZE
345+
l32i a0, a1, PT_KERNEL_SIZE + 4
346346
s32e a3, a1, -16
347347
s32e a0, a1, -12
348348
#endif
@@ -706,12 +706,12 @@ kernel_exception_exit:
706706
addi a0, a1, -16
707707
l32i a3, a0, 0
708708
l32i a4, a0, 4
709-
s32i a3, a1, PT_SIZE+0
710-
s32i a4, a1, PT_SIZE+4
709+
s32i a3, a1, PT_KERNEL_SIZE + 0
710+
s32i a4, a1, PT_KERNEL_SIZE + 4
711711
l32i a3, a0, 8
712712
l32i a4, a0, 12
713-
s32i a3, a1, PT_SIZE+8
714-
s32i a4, a1, PT_SIZE+12
713+
s32i a3, a1, PT_KERNEL_SIZE + 8
714+
s32i a4, a1, PT_KERNEL_SIZE + 12
715715

716716
/* Common exception exit.
717717
* We restore the special register and the current window frame, and
@@ -821,7 +821,7 @@ ENTRY(debug_exception)
821821

822822
bbsi.l a2, PS_UM_BIT, 2f # jump if user mode
823823

824-
addi a2, a1, -16-PT_SIZE # assume kernel stack
824+
addi a2, a1, -16 - PT_KERNEL_SIZE # assume kernel stack
825825
3:
826826
l32i a0, a3, DT_DEBUG_SAVE
827827
s32i a1, a2, PT_AREG1

arch/xtensa/kernel/vectors.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ ENDPROC(_UserExceptionVector)
8888
* Kernel exception vector. (Exceptions with PS.UM == 0, PS.EXCM == 0)
8989
*
9090
* We get this exception when we were already in kernel space.
91-
* We decrement the current stack pointer (kernel) by PT_SIZE and
91+
* We decrement the current stack pointer (kernel) by PT_KERNEL_SIZE and
9292
* jump to the first-level handler associated with the exception cause.
9393
*
9494
* Note: we need to preserve space for the spill region.
@@ -100,7 +100,7 @@ ENTRY(_KernelExceptionVector)
100100

101101
xsr a3, excsave1 # save a3, and get dispatch table
102102
wsr a2, depc # save a2
103-
addi a2, a1, -16-PT_SIZE # adjust stack pointer
103+
addi a2, a1, -16 - PT_KERNEL_SIZE # adjust stack pointer
104104
s32i a0, a2, PT_AREG0 # save a0 to ESF
105105
rsr a0, exccause # retrieve exception cause
106106
s32i a0, a2, PT_DEPC # mark it as a regular exception

0 commit comments

Comments
 (0)