SPM: Ensure Thread arch context is updated when thread sleeps
When a Partition thread waits for events, the arch context(PSP)
should be updated to the thread struct so that when it is woken up
the return value can be set by referring to the PSP -
tfm_core_thrd_set_retval.
The PSP is updated in PendSV Handler.
As PendSV has the lowest priority, it could be preempted by any
interrupts.
In interrupt handling, Partition Thread could be woken up while
the PSP in thread struct has not been updated yet.
This patch adds tfm_arch_get_ctx() function to get context value
to ctx struct. And it is called wherever it is needed.
This call is ensured to update the thread context as it's called in
SVC Hander code.
This patch also renames the tfm_arch_update_ctx to tfm_arch_set_ctx
to match the new API and reflects what it does more properly.
Change-Id: I66bed1f28b3d0243beb6a47d7bd6c41a5afdda0a
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
4 files changed