This patchset improves the context handling in 2 ways: firstly it unifies the context structures between switch_to() and CIF entry, and secondly fixes up the context switch code enough so that we can switch and return from an arbitrary PC address in testing.
This is a precursor to fixing up the load/init-program logic so that clients are able to access and alter their own context from Forth.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
v2: - Make sure trap level is preserved after SAVE_CPU_TRAP_STATE - Add separate RESET_CPU_WINDOW_STATE macro - Ensure that __context points to the saved entry state during CIF calls
Mark Cave-Ayland (11): SPARC64: add parameter to indicate %cwp save/restore direction SPARC64: allocate space in context to save global registers SPARC64: save/restore global registers to context when entering CIF SPARC64: save CIF entry globals under the client stack SPARC64: introduce %pc into context and use it when exiting CIF SPARC64: make sure that %tl is restored after SAVE_CPU_TRAP_STATE SPARC64: save/restore entire CPU state when entering/leaving CIF SPARC64: split off CPU window reset logic into RESET_CPU_WINDOW_STATE macro SPARC64: split off general CPU registers into *_GENERAL_STATE macros SPARC64: point __context to saved context during CIF calls SPARC64: switch entry.S over to use existing context macros
arch/sparc64/call-client.S | 94 ++++++++++++++++++++++---------- arch/sparc64/context.c | 6 +-- arch/sparc64/context.h | 7 +-- arch/sparc64/cpustate.h | 115 ++++++++++++++++++++++++--------------- arch/sparc64/entry.S | 17 +++++- arch/sparc64/switch.S | 129 ++++++++++++++++---------------------------- arch/sparc64/vectors.S | 8 ++- 7 files changed, 213 insertions(+), 163 deletions(-)