Stack Memory Selection Upon Exception in Data Processing
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing data processing systems incur significant overhead during context switches due to the time taken to save and restore user level state data from the privileged level stack to a task control block, which can lead to performance issues, especially in interrupt-driven deeply embedded processors where rapid task switching is critical.
Innovation Solution
The system modifies its behavior to save user level state data to the process stack memory instead of the privileged level stack upon an exception, allowing for faster context switches by eliminating the need for the privileged level code to save and restore this data, and uses hardware-controlled restoration to ensure efficient exception handling.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If user level state data is saved to the privileged level stack upon exception, then the state data can be stored safely, but the context switch time increases due to the overhead of saving and restoring data between stack and task control block
Solution Approach 1:
The patent extracts the state data storage operation from the privileged level exception handling path and places it directly in the user level exception entry path. When an exception occurs, the user level state data is saved directly to the process stack memory region at user level, eliminating the intermediate step of transferring data through the privileged level stack and task control block, thus reducing context switch time while maintaining data safety
Solution Approach 2:
The patent introduces a dedicated process stack memory region that acts as an intermediary storage area specifically for user level state data. This separate stack memory region serves as a direct buffer between the user level processor state and the exception handling mechanism, eliminating the need for data to traverse the privileged level stack and task control block, thereby reducing the time overhead while ensuring reliable state preservation
2Reliability
If separate stack pointers are provided for each privilege level, then stack isolation between user and privileged levels is achieved, but the device complexity increases
Solution Approach 1:
The patent segments the stack memory into distinct regions: a process stack memory region for user level and a privileged level stack memory region for privileged level operations. Each segment is managed by its own dedicated stack pointer (process stack pointer for user level, privileged level stack pointer for privileged level), creating clear isolation boundaries while simplifying management by assigning specific responsibilities to each pointer rather than requiring complex switching logic
Solution Approach 2:
Instead of having a single unified stack that requires complex switching and management between privilege levels, the patent inverts the approach by providing separate dedicated stacks for each privilege level. This inversion simplifies the system by eliminating the need for complex stack switching logic - each privilege level simply uses its own dedicated stack pointer and stack region, reducing overall device complexity while maintaining strict isolation
Data Source
AI summary
A data processor 2 has privilege levels associated with it including a user level and a privileged level. The processor 2 also has multiple stack memories which can be used including one or more process stacks, a main stack and a deep stack. The stack memory to be used is de-coupled from the privilege level. An activation level state variable tracking the number of pending exceptions is held by the processor and used to modify which stack memory stores pending state values when an exception occurs. If the system is at a base level of activation, corresponding to currently no pending exceptions, then when an exception occurs the current state data is saved on the process stack with the main stack being available for the exception handling code. Particular exceptions can be flagged as requiring use of a deep stack rather than either the process stack or the main stack. If the system is not at the base level of activation, then the main stack is used to save state variables when an exception occurs rather than the process stack.


