mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
target/arm: Add v8M stack checks on ADD/SUB/MOV of SP
Add code to insert calls to a helper function to do the stack limit checking when we handle these forms of instruction that write to SP: * ADD (SP plus immediate) * ADD (SP plus register) * SUB (SP minus immediate) * SUB (SP minus register) * MOV (register) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20181002163556.10279-5-peter.maydell@linaro.org
This commit is contained in:
parent
5529bf188d
commit
5520318939
4 changed files with 106 additions and 9 deletions
|
@ -817,4 +817,18 @@ static inline bool v7m_using_psp(CPUARMState *env)
|
|||
env->v7m.control[env->v7m.secure] & R_V7M_CONTROL_SPSEL_MASK;
|
||||
}
|
||||
|
||||
/**
|
||||
* v7m_sp_limit: Return SP limit for current CPU state
|
||||
* Return the SP limit value for the current CPU security state
|
||||
* and stack pointer.
|
||||
*/
|
||||
static inline uint32_t v7m_sp_limit(CPUARMState *env)
|
||||
{
|
||||
if (v7m_using_psp(env)) {
|
||||
return env->v7m.psplim[env->v7m.secure];
|
||||
} else {
|
||||
return env->v7m.msplim[env->v7m.secure];
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue