From dc82fa81b8feadc94eb5e446caaf7f42dd2437c6 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 30 Oct 2016 07:09:24 -0600 Subject: [PATCH] Xtensa: Remove XTENSA_EXTRA_SA_SIZE. It is not used. --- arch/xtensa/src/common/xtensa_context.S | 57 ++------- arch/xtensa/src/common/xtensa_window_vector.S | 118 +++++++++--------- 2 files changed, 66 insertions(+), 109 deletions(-) diff --git a/arch/xtensa/src/common/xtensa_context.S b/arch/xtensa/src/common/xtensa_context.S index 6d32fc92b3..0e163a475e 100644 --- a/arch/xtensa/src/common/xtensa_context.S +++ b/arch/xtensa/src/common/xtensa_context.S @@ -65,8 +65,7 @@ #include #include -#warning REVIST XTENSA_EXTRA_SA_SIZE is not yet provided -#define XTENSA_EXTRA_SA_SIZE 0 /* REMOVE ME */ +#include "xtensa_abi.h" /**************************************************************************** * Public Functions @@ -147,7 +146,7 @@ _xtensa_context_save: s32i a3, a2, (4 * REG_LCOUNT) #endif -#if XTENSA_EXTRA_SA_SIZE > 0 || !defined(CONFIG_XTENSA_CALL0_ABI) +#ifndef CONFIG_XTENSA_CALL0_ABI mov a9, a0 /* Preserve ret addr */ #endif @@ -185,28 +184,6 @@ _xtensa_context_save: l32i a9, sp, (4 * REG_TMP2) #endif -#if XTENSA_EXTRA_SA_SIZE > 0 - /* NOTE: Normally the xthal_save_extra_nw macro only affects address - * registers a2-a5. It is theoretically possible for Xtensa processor - * designers to write TIE that causes more address registers to be - * affected, but it is generally unlikely. If that ever happens, - * more registers need to be saved/restored around this macro invocation. - * Here we assume a9,12,13 are preserved. - * Future Xtensa tools releases might limit the regs that can be affected. - */ - - addi a2, a2, (4 * REG_EXTRA) /* Where to save it */ -#if XTENSA_EXTRA_SA_ALIGN > 16 - movi a3, -XTENSA_EXTRA_SA_ALIGN - and a2, a2, a3 /* Align dynamically >16 bytes */ -#endif - call0 xthal_save_extra_nw /* Destroys a0,2,3,4,5 */ -#endif - -#if XTENSA_EXTRA_SA_SIZE > 0 || !defined(CONFIG_XTENSA_CALL0_ABI) - mov a0, a9 /* Retrieve ret addr */ -#endif - ret .size _xtensa_context_save, . - _xtensa_context_save @@ -309,27 +286,6 @@ xtensa_context_save: _xtensa_context_restore: -#if XTENSA_EXTRA_SA_SIZE > 0 - /* NOTE: Normally the xthal_restore_extra_nw macro only affects address - * registers a2-a5. It is theoretically possible for Xtensa processor - * designers to write TIE that causes more address registers to be - * affected, but it is generally unlikely. If that ever happens, - * more registers need to be saved/restored around this macro invocation. - * Here we only assume a13 is preserved. - * Future Xtensa tools releases might limit the regs that can be affected. - */ - - mov a13, a0 /* Preserve ret addr */ - addi a2, a2, (4 * REG_EXTRA) /* Where to find it */ - -#if XTENSA_EXTRA_SA_ALIGN > 16 - movi a3, -XTENSA_EXTRA_SA_ALIGN - and a2, a2, a3 /* Align dynamically >16 bytes */ -#endif - call0 xthal_restore_extra_nw /* Destroys a0,2,3,4,5 */ - mov a0, a13 /* Retrieve ret addr */ -#endif - #ifdef XCHAL_HAVE_LOOPS l32i a2, a2, (4 * REG_LBEG) l32i a3, a2, (4 * REG_LEND) @@ -387,8 +343,10 @@ _xtensa_context_restore: * * This functions implements the moral equivalent of longjmp(). It is * called from user code (with interrupts disabled) to restor the current - * state of the running thread. This function always returns 1 because - * the saved value of A2 was set to 1 in xtensa_context_save(). + * state of the running thread. This function always appears to be a + * second return from xtensa_context_save except that that it returns the + * value 1 (because the saved value of A2 was set to 1 + * inxtensa_context_save()). * * The counterpart to this function is xtensa_context_save(). * @@ -398,7 +356,8 @@ _xtensa_context_restore: * * Exit conditions: * NOTE: That this function does NOT return to the caller but rather - * to a new threading context. + * to a new threading context. It is not necessary to save any of the + * caller's registers. * * Assumptions: * - Interrupts are disabled. diff --git a/arch/xtensa/src/common/xtensa_window_vector.S b/arch/xtensa/src/common/xtensa_window_vector.S index 5b8314042e..de68c2010e 100644 --- a/arch/xtensa/src/common/xtensa_window_vector.S +++ b/arch/xtensa/src/common/xtensa_window_vector.S @@ -72,8 +72,6 @@ * Registers a2 and up may contain return values. */ -*******************************************************************************/ - #if XCHAL_HAVE_WINDOWED .section .window_vectors.text, "ax" @@ -94,11 +92,11 @@ .global _window_overflow4 _window_overflow4: - s32e a0, a5, -16 /* save a0 to call[j+1]'s stack frame */ - s32e a1, a5, -12 /* save a1 to call[j+1]'s stack frame */ - s32e a2, a5, -8 /* save a2 to call[j+1]'s stack frame */ - s32e a3, a5, -4 /* save a3 to call[j+1]'s stack frame */ - rfwo /* rotates back to call[i] position */ + s32e a0, a5, -16 /* Save a0 to call[j+1]'s stack frame */ + s32e a1, a5, -12 /* Save a1 to call[j+1]'s stack frame */ + s32e a2, a5, -8 /* Save a2 to call[j+1]'s stack frame */ + s32e a3, a5, -4 /* Save a3 to call[j+1]'s stack frame */ + rfwo /* Rotates back to call[i] position */ /* Window Underflow Exception for Call4 * @@ -117,10 +115,10 @@ _window_overflow4: .global _window_underflow4 _window_underflow4: - l32e a0, a5, -16 /* restore a0 from call[i+1]'s stack frame */ - l32e a1, a5, -12 /* restore a1 from call[i+1]'s stack frame */ - l32e a2, a5, -8 /* restore a2 from call[i+1]'s stack frame */ - l32e a3, a5, -4 /* restore a3 from call[i+1]'s stack frame */ + l32e a0, a5, -16 /* Restore a0 from call[i+1]'s stack frame */ + l32e a1, a5, -12 /* Restore a1 from call[i+1]'s stack frame */ + l32e a2, a5, -8 /* Restore a2 from call[i+1]'s stack frame */ + l32e a3, a5, -4 /* Restore a3 from call[i+1]'s stack frame */ rfwu /* Handle alloca exception generated by interruptee executing 'movsp'. @@ -137,19 +135,19 @@ _window_underflow4: .global _xt_alloca_exc _xt_alloca_exc: - rsr a0, WINDOWBASE /* grab WINDOWBASE before rotw changes it */ + rsr a0, WINDOWBASE /* Grab WINDOWBASE before rotw changes it */ rotw -1 /* WINDOWBASE goes to a4, new a0-a3 are scratch */ rsr a2, PS extui a3, a2, XCHAL_PS_OWB_SHIFT, XCHAL_PS_OWB_BITS - xor a3, a3, a4 /* bits changed from old to current windowbase */ - rsr a4, EXCSAVE_1 /* restore original a0 (now in a4) */ + xor a3, a3, a4 /* Bits changed from old to current windowbase */ + rsr a4, EXCSAVE_1 /* Restore original a0 (now in a4) */ slli a3, a3, XCHAL_PS_OWB_SHIFT - xor a2, a2, a3 /* flip changed bits in old window base */ - wsr a2, PS /* update PS.OWB to new window base */ + xor a2, a2, a3 /* Flip changed bits in old window base */ + wsr a2, PS /* Update PS.OWB to new window base */ rsync _bbci.l a4, 31, _window_underflow4 - rotw -1 /* original a0 goes to a8 */ + rotw -1 /* Original a0 goes to a8 */ _bbci.l a8, 30, _window_underflow8 rotw -1 j _window_underflow12 @@ -170,17 +168,17 @@ _xt_alloca_exc: .global _window_overflow8 _window_overflow8: - s32e a0, a9, -16 /* save a0 to call[j+1]'s stack frame */ + s32e a0, a9, -16 /* Save a0 to call[j+1]'s stack frame */ l32e a0, a1, -12 /* a0 <- call[j-1]'s sp * (used to find end of call[j]'s frame) */ - s32e a1, a9, -12 /* save a1 to call[j+1]'s stack frame */ - s32e a2, a9, -8 /* save a2 to call[j+1]'s stack frame */ - s32e a3, a9, -4 /* save a3 to call[j+1]'s stack frame */ - s32e a4, a0, -32 /* save a4 to call[j]'s stack frame */ - s32e a5, a0, -28 /* save a5 to call[j]'s stack frame */ - s32e a6, a0, -24 /* save a6 to call[j]'s stack frame */ - s32e a7, a0, -20 /* save a7 to call[j]'s stack frame */ - rfwo /* rotates back to call[i] position */ + s32e a1, a9, -12 /* Save a1 to call[j+1]'s stack frame */ + s32e a2, a9, -8 /* Save a2 to call[j+1]'s stack frame */ + s32e a3, a9, -4 /* Save a3 to call[j+1]'s stack frame */ + s32e a4, a0, -32 /* Save a4 to call[j]'s stack frame */ + s32e a5, a0, -28 /* Save a5 to call[j]'s stack frame */ + s32e a6, a0, -24 /* Save a6 to call[j]'s stack frame */ + s32e a7, a0, -20 /* Save a7 to call[j]'s stack frame */ + rfwo /* Rotates back to call[i] position */ /* Window Underflow Exception for Call8 * @@ -199,16 +197,16 @@ _window_overflow8: .global _window_underflow8 _window_underflow8: - l32e a0, a9, -16 /* restore a0 from call[i+1]'s stack frame */ - l32e a1, a9, -12 /* restore a1 from call[i+1]'s stack frame */ - l32e a2, a9, -8 /* restore a2 from call[i+1]'s stack frame */ + l32e a0, a9, -16 /* Restore a0 from call[i+1]'s stack frame */ + l32e a1, a9, -12 /* Restore a1 from call[i+1]'s stack frame */ + l32e a2, a9, -8 /* Restore a2 from call[i+1]'s stack frame */ l32e a7, a1, -12 /* a7 <- call[i-1]'s sp * (used to find end of call[i]'s frame) */ - l32e a3, a9, -4 /* restore a3 from call[i+1]'s stack frame */ - l32e a4, a7, -32 /* restore a4 from call[i]'s stack frame */ - l32e a5, a7, -28 /* restore a5 from call[i]'s stack frame */ - l32e a6, a7, -24 /* restore a6 from call[i]'s stack frame */ - l32e a7, a7, -20 /* restore a7 from call[i]'s stack frame */ + l32e a3, a9, -4 /* Restore a3 from call[i+1]'s stack frame */ + l32e a4, a7, -32 /* Restore a4 from call[i]'s stack frame */ + l32e a5, a7, -28 /* Restore a5 from call[i]'s stack frame */ + l32e a6, a7, -24 /* Restore a6 from call[i]'s stack frame */ + l32e a7, a7, -20 /* Restore a7 from call[i]'s stack frame */ rfwu /* Window Overflow Exception for Call12 @@ -227,21 +225,21 @@ _window_underflow8: .global _window_overflow12 _window_overflow12: - s32e a0, a13, -16 /* save a0 to call[j+1]'s stack frame */ + s32e a0, a13, -16 /* Save a0 to call[j+1]'s stack frame */ l32e a0, a1, -12 /* a0 <- call[j-1]'s sp * (used to find end of call[j]'s frame) */ - s32e a1, a13, -12 /* save a1 to call[j+1]'s stack frame */ - s32e a2, a13, -8 /* save a2 to call[j+1]'s stack frame */ - s32e a3, a13, -4 /* save a3 to call[j+1]'s stack frame */ - s32e a4, a0, -48 /* save a4 to end of call[j]'s stack frame */ - s32e a5, a0, -44 /* save a5 to end of call[j]'s stack frame */ - s32e a6, a0, -40 /* save a6 to end of call[j]'s stack frame */ - s32e a7, a0, -36 /* save a7 to end of call[j]'s stack frame */ - s32e a8, a0, -32 /* save a8 to end of call[j]'s stack frame */ - s32e a9, a0, -28 /* save a9 to end of call[j]'s stack frame */ - s32e a10, a0, -24 /* save a10 to end of call[j]'s stack frame */ - s32e a11, a0, -20 /* save a11 to end of call[j]'s stack frame */ - rfwo /* rotates back to call[i] position */ + s32e a1, a13, -12 /* Save a1 to call[j+1]'s stack frame */ + s32e a2, a13, -8 /* Save a2 to call[j+1]'s stack frame */ + s32e a3, a13, -4 /* Save a3 to call[j+1]'s stack frame */ + s32e a4, a0, -48 /* Save a4 to end of call[j]'s stack frame */ + s32e a5, a0, -44 /* Save a5 to end of call[j]'s stack frame */ + s32e a6, a0, -40 /* Save a6 to end of call[j]'s stack frame */ + s32e a7, a0, -36 /* Save a7 to end of call[j]'s stack frame */ + s32e a8, a0, -32 /* Save a8 to end of call[j]'s stack frame */ + s32e a9, a0, -28 /* Save a9 to end of call[j]'s stack frame */ + s32e a10, a0, -24 /* Save a10 to end of call[j]'s stack frame */ + s32e a11, a0, -20 /* Save a11 to end of call[j]'s stack frame */ + rfwo /* Rotates back to call[i] position */ /* Window Underflow Exception for Call12 * @@ -260,20 +258,20 @@ _window_overflow12: .global _window_underflow12 _window_underflow12: - l32e a0, a13, -16 /* restore a0 from call[i+1]'s stack frame */ - l32e a1, a13, -12 /* restore a1 from call[i+1]'s stack frame */ - l32e a2, a13, -8 /* restore a2 from call[i+1]'s stack frame */ + l32e a0, a13, -16 /* Restore a0 from call[i+1]'s stack frame */ + l32e a1, a13, -12 /* Restore a1 from call[i+1]'s stack frame */ + l32e a2, a13, -8 /* Restore a2 from call[i+1]'s stack frame */ l32e a11, a1, -12 /* a11 <- call[i-1]'s sp - * (used to find end of call[i]'s frame) */ - l32e a3, a13, -4 /* restore a3 from call[i+1]'s stack frame */ - l32e a4, a11, -48 /* restore a4 from end of call[i]'s stack frame */ - l32e a5, a11, -44 /* restore a5 from end of call[i]'s stack frame */ - l32e a6, a11, -40 /* restore a6 from end of call[i]'s stack frame */ - l32e a7, a11, -36 /* restore a7 from end of call[i]'s stack frame */ - l32e a8, a11, -32 /* restore a8 from end of call[i]'s stack frame */ - l32e a9, a11, -28 /* restore a9 from end of call[i]'s stack frame */ - l32e a10, a11, -24 /* restore a10 from end of call[i]'s stack frame */ - l32e a11, a11, -20 /* restore a11 from end of call[i]'s stack frame */ + * (used to find end of call[i]'s frame) */ + l32e a3, a13, -4 /* Restore a3 from call[i+1]'s stack frame */ + l32e a4, a11, -48 /* Restore a4 from end of call[i]'s stack frame */ + l32e a5, a11, -44 /* Restore a5 from end of call[i]'s stack frame */ + l32e a6, a11, -40 /* Restore a6 from end of call[i]'s stack frame */ + l32e a7, a11, -36 /* Restore a7 from end of call[i]'s stack frame */ + l32e a8, a11, -32 /* Restore a8 from end of call[i]'s stack frame */ + l32e a9, a11, -28 /* Restore a9 from end of call[i]'s stack frame */ + l32e a10, a11, -24 /* Restore a10 from end of call[i]'s stack frame */ + l32e a11, a11, -20 /* Restore a11 from end of call[i]'s stack frame */ rfwu #endif /* XCHAL_HAVE_WINDOWED */