arm: add syscall SYS_save_context support for old arm and armv7-r

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
This commit is contained in:
wangbowen6 2022-12-08 10:38:31 +08:00 committed by Xiang Xiao
parent 18482efc39
commit c44f87eb1a
2 changed files with 39 additions and 0 deletions

View File

@ -73,6 +73,26 @@ uint32_t *arm_syscall(uint32_t *regs)
switch (cmd)
{
/* R0=SYS_save_context: This is a save context command:
*
* int up_saveusercontext(void *saveregs);
*
* At this point, the following values are saved in context:
*
* R0 = SYS_save_context
* R1 = saveregs
*
* In this case, we simply need to copy the current registers to the
* save register space references in the saved R1 and return.
*/
case SYS_save_context:
{
DEBUGASSERT(regs[REG_R1] != 0);
memcpy((uint32_t *)regs[REG_R1], regs, XCPTCONTEXT_SIZE);
}
break;
/* R0=SYS_restore_context: Restore task context
*
* void arm_fullcontextrestore(uint32_t *restoreregs)

View File

@ -246,6 +246,25 @@ uint32_t *arm_syscall(uint32_t *regs)
}
break;
#endif
/* R0=SYS_save_context: This is a save context command:
*
* int up_saveusercontext(void *saveregs);
*
* At this point, the following values are saved in context:
*
* R0 = SYS_save_context
* R1 = saveregs
*
* In this case, we simply need to copy the current registers to the
* save register space references in the saved R1 and return.
*/
case SYS_save_context:
{
DEBUGASSERT(regs[REG_R1] != 0);
memcpy((uint32_t *)regs[REG_R1], regs, XCPTCONTEXT_SIZE);
}
break;
/* R0=SYS_restore_context: Restore task context
*