mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 11:26:12 +08:00
arch/arm: export arm_saveusercontext()
rename arm_saveusercontext() -> up_arm_saveusercontext() Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
@@ -66,7 +66,7 @@
|
|||||||
|
|
||||||
/* SYS call 0:
|
/* SYS call 0:
|
||||||
*
|
*
|
||||||
* int arm_saveusercontext(uint32_t *saveregs);
|
* int up_saveusercontext(void *saveregs);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SYS_save_context (0)
|
#define SYS_save_context (0)
|
||||||
|
|||||||
@@ -44,12 +44,12 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: arm_saveusercontext
|
* Name: up_saveusercontext
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Save the current thread context. Full prototype is:
|
* Save the current thread context. Full prototype is:
|
||||||
*
|
*
|
||||||
* int arm_saveusercontext(uint32_t *saveregs);
|
* int up_saveusercontext(void *saveregs);
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* 0: Normal return
|
* 0: Normal return
|
||||||
@@ -57,9 +57,9 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
.globl arm_saveusercontext
|
.globl up_saveusercontext
|
||||||
.type arm_saveusercontext, function
|
.type up_saveusercontext, function
|
||||||
arm_saveusercontext:
|
up_saveusercontext:
|
||||||
|
|
||||||
/* On entry, a1 (r0) holds address of struct xcptcontext */
|
/* On entry, a1 (r0) holds address of struct xcptcontext */
|
||||||
|
|
||||||
@@ -96,5 +96,5 @@ arm_saveusercontext:
|
|||||||
|
|
||||||
mov r0, #0 /* Return value == 0 */
|
mov r0, #0 /* Return value == 0 */
|
||||||
bx lr /* Return */
|
bx lr /* Return */
|
||||||
.size arm_saveusercontext, .-arm_saveusercontext
|
.size up_saveusercontext, .-up_saveusercontext
|
||||||
.end
|
.end
|
||||||
|
|||||||
@@ -47,12 +47,12 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: arm_saveusercontext
|
* Name: up_saveusercontext
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Save the current thread context. Full prototype is:
|
* Save the current thread context. Full prototype is:
|
||||||
*
|
*
|
||||||
* int arm_saveusercontext(uint32_t *saveregs);
|
* int up_saveusercontext(void *saveregs);
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* 0: Normal return
|
* 0: Normal return
|
||||||
@@ -64,9 +64,9 @@
|
|||||||
.align 2
|
.align 2
|
||||||
.code 16
|
.code 16
|
||||||
.thumb_func
|
.thumb_func
|
||||||
.globl arm_saveusercontext
|
.globl up_saveusercontext
|
||||||
.type arm_saveusercontext, function
|
.type up_saveusercontext, function
|
||||||
arm_saveusercontext:
|
up_saveusercontext:
|
||||||
|
|
||||||
/* Perform the System call with R0=0 and R1=regs */
|
/* Perform the System call with R0=0 and R1=regs */
|
||||||
|
|
||||||
@@ -85,5 +85,5 @@ arm_saveusercontext:
|
|||||||
str r3, [r2, #0] /* Save return value */
|
str r3, [r2, #0] /* Save return value */
|
||||||
bx lr /* "normal" return with r0=0 or
|
bx lr /* "normal" return with r0=0 or
|
||||||
* context switch with r0=1 */
|
* context switch with r0=1 */
|
||||||
.size arm_saveusercontext, .-arm_saveusercontext
|
.size up_saveusercontext, .-up_saveusercontext
|
||||||
.end
|
.end
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ int arm_svcall(int irq, FAR void *context, FAR void *arg)
|
|||||||
{
|
{
|
||||||
/* R0=SYS_save_context: This is a save context command:
|
/* R0=SYS_save_context: This is a save context command:
|
||||||
*
|
*
|
||||||
* int arm_saveusercontext(uint32_t *saveregs);
|
* int up_saveusercontext(void *saveregs);
|
||||||
*
|
*
|
||||||
* At this point, the following values are saved in context:
|
* At this point, the following values are saved in context:
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -44,12 +44,12 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: arm_saveusercontext
|
* Name: up_saveusercontext
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Save the current thread context. Full prototype is:
|
* Save the current thread context. Full prototype is:
|
||||||
*
|
*
|
||||||
* int arm_saveusercontext(uint32_t *saveregs);
|
* int up_saveusercontext(void *saveregs);
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* 0: Normal return
|
* 0: Normal return
|
||||||
@@ -57,9 +57,9 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
.globl arm_saveusercontext
|
.globl up_saveusercontext
|
||||||
.type arm_saveusercontext, function
|
.type up_saveusercontext, function
|
||||||
arm_saveusercontext:
|
up_saveusercontext:
|
||||||
|
|
||||||
/* On entry, a1 (r0) holds address of struct xcptcontext */
|
/* On entry, a1 (r0) holds address of struct xcptcontext */
|
||||||
|
|
||||||
@@ -134,5 +134,5 @@ arm_saveusercontext:
|
|||||||
mov r0, #1 /* Return value == 1 */
|
mov r0, #1 /* Return value == 1 */
|
||||||
bx lr /* Return */
|
bx lr /* Return */
|
||||||
|
|
||||||
.size arm_saveusercontext, .-arm_saveusercontext
|
.size up_saveusercontext, .-up_saveusercontext
|
||||||
.end
|
.end
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ int arm_svcall(int irq, FAR void *context, FAR void *arg)
|
|||||||
{
|
{
|
||||||
/* R0=SYS_save_context: This is a save context command:
|
/* R0=SYS_save_context: This is a save context command:
|
||||||
*
|
*
|
||||||
* int arm_saveusercontext(uint32_t *saveregs);
|
* int up_saveusercontext(void *saveregs);
|
||||||
*
|
*
|
||||||
* At this point, the following values are saved in context:
|
* At this point, the following values are saved in context:
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -49,12 +49,12 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: arm_saveusercontext
|
* Name: up_saveusercontext
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Save the current thread context. Full prototype is:
|
* Save the current thread context. Full prototype is:
|
||||||
*
|
*
|
||||||
* int arm_saveusercontext(uint32_t *saveregs);
|
* int up_saveusercontext(void *saveregs);
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* 0: Normal return
|
* 0: Normal return
|
||||||
@@ -64,9 +64,9 @@
|
|||||||
|
|
||||||
.text
|
.text
|
||||||
.thumb_func
|
.thumb_func
|
||||||
.globl arm_saveusercontext
|
.globl up_saveusercontext
|
||||||
.type arm_saveusercontext, function
|
.type up_saveusercontext, function
|
||||||
arm_saveusercontext:
|
up_saveusercontext:
|
||||||
|
|
||||||
/* Perform the System call with R0=0 and R1=regs */
|
/* Perform the System call with R0=0 and R1=regs */
|
||||||
|
|
||||||
@@ -84,5 +84,5 @@ arm_saveusercontext:
|
|||||||
str r3, [r2, #0]
|
str r3, [r2, #0]
|
||||||
bx lr /* "normal" return with r0=0 or
|
bx lr /* "normal" return with r0=0 or
|
||||||
* context switch with r0=1 */
|
* context switch with r0=1 */
|
||||||
.size arm_saveusercontext, .-arm_saveusercontext
|
.size up_saveusercontext, .-up_saveusercontext
|
||||||
.end
|
.end
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "nvic.h"
|
#include "nvic.h"
|
||||||
|
|
||||||
MODULE arm_saveusercontext
|
MODULE up_saveusercontext
|
||||||
SECTION .text:CODE:NOROOT(2)
|
SECTION .text:CODE:NOROOT(2)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
* Public Symbols
|
* Public Symbols
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
PUBLIC arm_saveusercontext
|
PUBLIC up_saveusercontext
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Macros
|
* Macros
|
||||||
@@ -50,12 +50,12 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: arm_saveusercontext
|
* Name: up_saveusercontext
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Save the current thread context. Full prototype is:
|
* Save the current thread context. Full prototype is:
|
||||||
*
|
*
|
||||||
* int arm_saveusercontext(uint32_t *saveregs);
|
* int up_saveusercontext(void *saveregs);
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* 0: Normal return
|
* 0: Normal return
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
THUMB
|
THUMB
|
||||||
|
|
||||||
arm_saveusercontext:
|
up_saveusercontext:
|
||||||
|
|
||||||
/* Perform the System call with R0=0 and R1=regs */
|
/* Perform the System call with R0=0 and R1=regs */
|
||||||
|
|
||||||
|
|||||||
@@ -44,12 +44,12 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: arm_saveusercontext
|
* Name: up_saveusercontext
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Save the current thread context. Full prototype is:
|
* Save the current thread context. Full prototype is:
|
||||||
*
|
*
|
||||||
* int arm_saveusercontext(uint32_t *saveregs);
|
* int up_saveusercontext(void *saveregs);
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* 0: Normal return
|
* 0: Normal return
|
||||||
@@ -57,9 +57,9 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
.globl arm_saveusercontext
|
.globl up_saveusercontext
|
||||||
.type arm_saveusercontext, function
|
.type up_saveusercontext, function
|
||||||
arm_saveusercontext:
|
up_saveusercontext:
|
||||||
|
|
||||||
/* On entry, a1 (r0) holds address of struct xcptcontext */
|
/* On entry, a1 (r0) holds address of struct xcptcontext */
|
||||||
|
|
||||||
@@ -125,5 +125,5 @@ arm_saveusercontext:
|
|||||||
|
|
||||||
mov r0, #0 /* Return value == 0 */
|
mov r0, #0 /* Return value == 0 */
|
||||||
bx lr /* Return */
|
bx lr /* Return */
|
||||||
.size arm_saveusercontext, .-arm_saveusercontext
|
.size up_saveusercontext, .-up_saveusercontext
|
||||||
.end
|
.end
|
||||||
|
|||||||
@@ -49,12 +49,12 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: arm_saveusercontext
|
* Name: up_saveusercontext
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Save the current thread context. Full prototype is:
|
* Save the current thread context. Full prototype is:
|
||||||
*
|
*
|
||||||
* int arm_saveusercontext(uint32_t *saveregs);
|
* int up_saveusercontext(void *saveregs);
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* 0: Normal return
|
* 0: Normal return
|
||||||
@@ -64,9 +64,9 @@
|
|||||||
|
|
||||||
.text
|
.text
|
||||||
.thumb_func
|
.thumb_func
|
||||||
.globl arm_saveusercontext
|
.globl up_saveusercontext
|
||||||
.type arm_saveusercontext, function
|
.type up_saveusercontext, function
|
||||||
arm_saveusercontext:
|
up_saveusercontext:
|
||||||
|
|
||||||
/* Perform the System call with R0=0 and R1=regs */
|
/* Perform the System call with R0=0 and R1=regs */
|
||||||
|
|
||||||
@@ -84,5 +84,5 @@ arm_saveusercontext:
|
|||||||
str r3, [r2, #0]
|
str r3, [r2, #0]
|
||||||
bx lr /* "normal" return with r0=0 or
|
bx lr /* "normal" return with r0=0 or
|
||||||
* context switch with r0=1 */
|
* context switch with r0=1 */
|
||||||
.size arm_saveusercontext, .-arm_saveusercontext
|
.size up_saveusercontext, .-up_saveusercontext
|
||||||
.end
|
.end
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ int arm_svcall(int irq, FAR void *context, FAR void *arg)
|
|||||||
{
|
{
|
||||||
/* R0=SYS_save_context: This is a save context command:
|
/* R0=SYS_save_context: This is a save context command:
|
||||||
*
|
*
|
||||||
* int arm_saveusercontext(uint32_t *saveregs);
|
* int up_saveusercontext(void *saveregs);
|
||||||
*
|
*
|
||||||
* At this point, the following values are saved in context:
|
* At this point, the following values are saved in context:
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ static void arm_dumpstate(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
arm_saveusercontext(rtcb->xcp.regs);
|
up_saveusercontext(rtcb->xcp.regs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump the registers */
|
/* Dump the registers */
|
||||||
|
|||||||
@@ -328,7 +328,6 @@ void arm_boot(void);
|
|||||||
/* Context switching */
|
/* Context switching */
|
||||||
|
|
||||||
uint32_t *arm_decodeirq(uint32_t *regs);
|
uint32_t *arm_decodeirq(uint32_t *regs);
|
||||||
int arm_saveusercontext(uint32_t *saveregs);
|
|
||||||
void arm_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
|
void arm_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
|
||||||
void arm_switchcontext(uint32_t **saveregs, uint32_t *restoreregs);
|
void arm_switchcontext(uint32_t **saveregs, uint32_t *restoreregs);
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
/* SYS call 0:
|
/* SYS call 0:
|
||||||
*
|
*
|
||||||
* int up_saveusercontext(uint32_t *saveregs);
|
* int up_saveusercontext(void *saveregs);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SYS_save_context 0x00
|
#define SYS_save_context 0x00
|
||||||
|
|||||||
@@ -228,7 +228,6 @@ void modifyreg32(unsigned int addr, uint32_t clearbits, uint32_t setbits);
|
|||||||
|
|
||||||
/* Context switching */
|
/* Context switching */
|
||||||
|
|
||||||
int up_saveusercontext(uint32_t *saveregs);
|
|
||||||
void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
|
void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
|
||||||
void up_switchcontext(uint32_t **saveregs, uint32_t *restoreregs);
|
void up_switchcontext(uint32_t **saveregs, uint32_t *restoreregs);
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
* Description:
|
* Description:
|
||||||
* Save the current thread context. Full prototype is:
|
* Save the current thread context. Full prototype is:
|
||||||
*
|
*
|
||||||
* int up_saveusercontext(uint32_t *saveregs);
|
* int up_saveusercontext(void *saveregs);
|
||||||
*
|
*
|
||||||
* Return:
|
* Return:
|
||||||
* 0: Normal return
|
* 0: Normal return
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int up_saveusercontext(uint32_t *saveregs)
|
int up_saveusercontext(void *saveregs)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ int up_svcall(int irq, void *context, void *arg)
|
|||||||
{
|
{
|
||||||
/* A0=SYS_save_context: This is a save context command:
|
/* A0=SYS_save_context: This is a save context command:
|
||||||
*
|
*
|
||||||
* int up_saveusercontext(uint32_t *saveregs);
|
* int up_saveusercontext(void *saveregs);
|
||||||
*
|
*
|
||||||
* At this point, the following values are saved in context:
|
* At this point, the following values are saved in context:
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -148,7 +148,6 @@ void modifyreg32(unsigned int addr, uint32_t clearbits, uint32_t setbits);
|
|||||||
|
|
||||||
void up_copystate(uint8_t *dest, uint8_t *src);
|
void up_copystate(uint8_t *dest, uint8_t *src);
|
||||||
void up_decodeirq(uint8_t *regs);
|
void up_decodeirq(uint8_t *regs);
|
||||||
int up_saveusercontext(uint8_t *saveregs);
|
|
||||||
void up_fullcontextrestore(uint8_t *restoreregs) noreturn_function;
|
void up_fullcontextrestore(uint8_t *restoreregs) noreturn_function;
|
||||||
void up_switchcontext(uint8_t *saveregs, uint8_t *restoreregs);
|
void up_switchcontext(uint8_t *saveregs, uint8_t *restoreregs);
|
||||||
|
|
||||||
|
|||||||
@@ -240,7 +240,6 @@ int or1k_print_cpuinfo(void);
|
|||||||
|
|
||||||
void up_copyfullstate(uint32_t *dest, uint32_t *src);
|
void up_copyfullstate(uint32_t *dest, uint32_t *src);
|
||||||
void up_decodeirq(uint32_t *regs);
|
void up_decodeirq(uint32_t *regs);
|
||||||
int up_saveusercontext(uint32_t *saveregs);
|
|
||||||
void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
|
void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
|
||||||
void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
|
void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,6 @@ void up_decodeirq(uint32_t *regs);
|
|||||||
uint32_t *up_doirq(int irq, uint32_t *regs);
|
uint32_t *up_doirq(int irq, uint32_t *regs);
|
||||||
void up_fullcontextrestore(uint32_t *regs) noreturn_function;
|
void up_fullcontextrestore(uint32_t *regs) noreturn_function;
|
||||||
void up_prefetchabort(uint32_t *regs);
|
void up_prefetchabort(uint32_t *regs);
|
||||||
int up_saveusercontext(uint32_t *regs);
|
|
||||||
void up_sigdeliver(void);
|
void up_sigdeliver(void);
|
||||||
void up_syscall(uint32_t *regs);
|
void up_syscall(uint32_t *regs);
|
||||||
void up_undefinedinsn(uint32_t *regs);
|
void up_undefinedinsn(uint32_t *regs);
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ _m16c_commonvector:
|
|||||||
reit /* Return from interrupt */
|
reit /* Return from interrupt */
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: int up_saveusercontext(uint32_t *regs)
|
* Name: int up_saveusercontext(void *regs)
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Save the context of the calling function at the point of the return from the
|
* Save the context of the calling function at the point of the return from the
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ _up_vector:
|
|||||||
.size _up_vector, . - _up_vector
|
.size _up_vector, . - _up_vector
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: int up_saveusercontext(uint32_t *regs)
|
* Name: int up_saveusercontext(void *regs)
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Save the context of the calling function at the point of the return from
|
* Save the context of the calling function at the point of the return from
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
|
|||||||
CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c riscv_usestack.c
|
CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c riscv_usestack.c
|
||||||
CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c riscv_doirq.c
|
CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c riscv_doirq.c
|
||||||
CMN_CSRCS += riscv_exception.c riscv_mtimer.c riscv_misaligned.c
|
CMN_CSRCS += riscv_exception.c riscv_mtimer.c riscv_misaligned.c
|
||||||
|
CMN_CSRCS += riscv_saveusercontext.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
|
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
|
||||||
CMN_CSRCS += riscv_backtrace.c
|
CMN_CSRCS += riscv_backtrace.c
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
|
|||||||
CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
|
CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
|
||||||
CMN_CSRCS += riscv_mdelay.c riscv_idle.c riscv_doirq.c riscv_mtimer.c
|
CMN_CSRCS += riscv_mdelay.c riscv_idle.c riscv_doirq.c riscv_mtimer.c
|
||||||
CMN_CSRCS += riscv_tcbinfo.c riscv_getnewintctx.c
|
CMN_CSRCS += riscv_tcbinfo.c riscv_getnewintctx.c
|
||||||
|
CMN_CSRCS += riscv_saveusercontext.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
|
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
|
||||||
CMN_CSRCS += riscv_backtrace.c
|
CMN_CSRCS += riscv_backtrace.c
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ static void riscv_dumpstate(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
riscv_saveusercontext(rtcb->xcp.regs);
|
up_saveusercontext(rtcb->xcp.regs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump the registers (if available) */
|
/* Dump the registers (if available) */
|
||||||
|
|||||||
@@ -330,18 +330,6 @@ void *riscv_perform_syscall(uintptr_t *regs);
|
|||||||
|
|
||||||
/* Context switching via system calls ***************************************/
|
/* Context switching via system calls ***************************************/
|
||||||
|
|
||||||
/* SYS call 0:
|
|
||||||
*
|
|
||||||
* int riscv_saveusercontext(uintptr_t *saveregs);
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
* 0: Normal Return
|
|
||||||
* 1: Context Switch Return
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define riscv_saveusercontext(saveregs) \
|
|
||||||
sys_call1(SYS_save_context, (uintptr_t)saveregs)
|
|
||||||
|
|
||||||
/* SYS call 1:
|
/* SYS call 1:
|
||||||
*
|
*
|
||||||
* void riscv_fullcontextrestore(uintptr_t *restoreregs) noreturn_function;
|
* void riscv_fullcontextrestore(uintptr_t *restoreregs) noreturn_function;
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* arch/risc-v/src/common/riscv_saveusercontext.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <arch/syscall.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: up_saveusercontext
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Save the current thread context. Full prototype is:
|
||||||
|
*
|
||||||
|
* int up_saveusercontext(void *saveregs);
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* 0: Normal return
|
||||||
|
* 1: Context switch return
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int up_saveusercontext(FAR void *saveregs)
|
||||||
|
{
|
||||||
|
return sys_call1(SYS_save_context, (uintptr_t)saveregs);
|
||||||
|
}
|
||||||
@@ -172,7 +172,7 @@ int riscv_swint(int irq, void *context, void *arg)
|
|||||||
{
|
{
|
||||||
/* A0=SYS_save_context: This is a save context command:
|
/* A0=SYS_save_context: This is a save context command:
|
||||||
*
|
*
|
||||||
* int riscv_saveusercontext(uintptr saveregs);
|
* int up_saveusercontext(void *saveregs);
|
||||||
*
|
*
|
||||||
* At this point, the following values are saved in context:
|
* At this point, the following values are saved in context:
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c
|
|||||||
CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
|
CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
|
||||||
CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c riscv_usestack.c
|
CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c riscv_usestack.c
|
||||||
CMN_CSRCS += riscv_tcbinfo.c riscv_getnewintctx.c riscv_doirq.c
|
CMN_CSRCS += riscv_tcbinfo.c riscv_getnewintctx.c riscv_doirq.c
|
||||||
|
CMN_CSRCS += riscv_saveusercontext.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
|
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
|
||||||
CMN_CSRCS += riscv_backtrace.c
|
CMN_CSRCS += riscv_backtrace.c
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c
|
|||||||
CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
|
CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
|
||||||
CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c riscv_usestack.c
|
CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c riscv_usestack.c
|
||||||
CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c riscv_doirq.c
|
CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c riscv_doirq.c
|
||||||
|
CMN_CSRCS += riscv_saveusercontext.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
|
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
|
||||||
CMN_CSRCS += riscv_backtrace.c
|
CMN_CSRCS += riscv_backtrace.c
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
|
|||||||
CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
|
CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
|
||||||
CMN_CSRCS += riscv_mdelay.c riscv_idle.c riscv_doirq.c
|
CMN_CSRCS += riscv_mdelay.c riscv_idle.c riscv_doirq.c
|
||||||
CMN_CSRCS += riscv_tcbinfo.c riscv_cpuidlestack.c riscv_getnewintctx.c
|
CMN_CSRCS += riscv_tcbinfo.c riscv_cpuidlestack.c riscv_getnewintctx.c
|
||||||
CMN_CSRCS += riscv_misaligned.c
|
CMN_CSRCS += riscv_misaligned.c riscv_saveusercontext.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_SMP), y)
|
ifeq ($(CONFIG_SMP), y)
|
||||||
CMN_CSRCS += riscv_cpuindex.c riscv_cpupause.c riscv_cpustart.c
|
CMN_CSRCS += riscv_cpuindex.c riscv_cpupause.c riscv_cpustart.c
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c
|
|||||||
CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
|
CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
|
||||||
CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c riscv_usestack.c
|
CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c riscv_usestack.c
|
||||||
CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c
|
CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c
|
||||||
|
CMN_CSRCS += riscv_saveusercontext.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
|
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
|
||||||
CMN_CSRCS += riscv_backtrace.c
|
CMN_CSRCS += riscv_backtrace.c
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
|
|||||||
CMN_CSRCS += riscv_mdelay.c riscv_udelay.c
|
CMN_CSRCS += riscv_mdelay.c riscv_udelay.c
|
||||||
CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c
|
CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c
|
||||||
CMN_CSRCS += riscv_doirq.c riscv_mtimer.c
|
CMN_CSRCS += riscv_doirq.c riscv_mtimer.c
|
||||||
|
CMN_CSRCS += riscv_saveusercontext.c
|
||||||
|
|
||||||
# Specify ASM code within the common directory to be included
|
# Specify ASM code within the common directory to be included
|
||||||
CMN_ASRCS += riscv_mhartid.S
|
CMN_ASRCS += riscv_mhartid.S
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
|
|||||||
CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
|
CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
|
||||||
CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_cpuidlestack.c
|
CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_cpuidlestack.c
|
||||||
CMN_CSRCS += riscv_exception.c riscv_getnewintctx.c riscv_doirq.c
|
CMN_CSRCS += riscv_exception.c riscv_getnewintctx.c riscv_doirq.c
|
||||||
|
CMN_CSRCS += riscv_saveusercontext.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_SMP), y)
|
ifeq ($(CONFIG_SMP), y)
|
||||||
CMN_CSRCS += riscv_cpuindex.c riscv_cpupause.c riscv_cpustart.c
|
CMN_CSRCS += riscv_cpuindex.c riscv_cpupause.c riscv_cpustart.c
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c
|
|||||||
CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
|
CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
|
||||||
CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
|
CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
|
||||||
CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c
|
CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c
|
||||||
|
CMN_CSRCS += riscv_saveusercontext.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
|
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
|
||||||
CMN_CSRCS += riscv_backtrace.c
|
CMN_CSRCS += riscv_backtrace.c
|
||||||
|
|||||||
@@ -186,7 +186,6 @@ void up_decodeirq(uint32_t *regs);
|
|||||||
#ifdef CONFIG_ARCH_DMA
|
#ifdef CONFIG_ARCH_DMA
|
||||||
void weak_function up_dma_initialize(void);
|
void weak_function up_dma_initialize(void);
|
||||||
#endif
|
#endif
|
||||||
int up_saveusercontext(uint32_t *saveregs);
|
|
||||||
void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
|
void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
|
||||||
void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
|
void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
|
||||||
void up_sigdeliver(void);
|
void up_sigdeliver(void);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
* Name: up_saveusercontext
|
* Name: up_saveusercontext
|
||||||
*
|
*
|
||||||
* Full C prototype:
|
* Full C prototype:
|
||||||
* int up_saveusercontext(uint32_t *regs);
|
* int up_saveusercontext(void *regs);
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Save the "user" context. It is not necessary to save all of the
|
* Save the "user" context. It is not necessary to save all of the
|
||||||
|
|||||||
@@ -205,7 +205,6 @@ void up_decodeirq(uint64_t *regs);
|
|||||||
#ifdef CONFIG_ARCH_DMA
|
#ifdef CONFIG_ARCH_DMA
|
||||||
void weak_function up_dmainitialize(void);
|
void weak_function up_dmainitialize(void);
|
||||||
#endif
|
#endif
|
||||||
int up_saveusercontext(uint64_t *saveregs);
|
|
||||||
void up_fullcontextrestore(uint64_t *restoreregs) noreturn_function;
|
void up_fullcontextrestore(uint64_t *restoreregs) noreturn_function;
|
||||||
void up_switchcontext(uint64_t *saveregs, uint64_t *restoreregs);
|
void up_switchcontext(uint64_t *saveregs, uint64_t *restoreregs);
|
||||||
void up_sigdeliver(void);
|
void up_sigdeliver(void);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
* Name: up_saveusercontext
|
* Name: up_saveusercontext
|
||||||
*
|
*
|
||||||
* Full C prototype:
|
* Full C prototype:
|
||||||
* int up_saveusercontext(uint32_t *regs);
|
* int up_saveusercontext(void *regs);
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Save the "user" context. It is not necessary to save all of the
|
* Save the "user" context. It is not necessary to save all of the
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ void arch_getfpu(FAR uint32_t *fpusave)
|
|||||||
/* Take a snapshot of the thread context right now */
|
/* Take a snapshot of the thread context right now */
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
arm_saveusercontext(g_saveregs);
|
up_saveusercontext(g_saveregs);
|
||||||
|
|
||||||
/* Return only the floating register values */
|
/* Return only the floating register values */
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ void arch_getfpu(FAR uint32_t *fpusave)
|
|||||||
/* Take a snapshot of the thread context right now */
|
/* Take a snapshot of the thread context right now */
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
arm_saveusercontext(g_saveregs);
|
up_saveusercontext(g_saveregs);
|
||||||
|
|
||||||
/* Return only the floating register values */
|
/* Return only the floating register values */
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void arch_getfpu(FAR uint32_t *fpusave)
|
|||||||
/* Take a snapshot of the thread context right now */
|
/* Take a snapshot of the thread context right now */
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
arm_saveusercontext(g_saveregs);
|
up_saveusercontext(g_saveregs);
|
||||||
|
|
||||||
/* Return only the floating register values */
|
/* Return only the floating register values */
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void arch_getfpu(FAR uint32_t *fpusave)
|
|||||||
/* Take a snapshot of the thread context right now */
|
/* Take a snapshot of the thread context right now */
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
arm_saveusercontext(g_saveregs);
|
up_saveusercontext(g_saveregs);
|
||||||
|
|
||||||
/* Return only the floating register values */
|
/* Return only the floating register values */
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void arch_getfpu(FAR uint32_t *fpusave)
|
|||||||
/* Take a snapshot of the thread context right now */
|
/* Take a snapshot of the thread context right now */
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
arm_saveusercontext(g_saveregs);
|
up_saveusercontext(g_saveregs);
|
||||||
|
|
||||||
/* Return only the floating register values */
|
/* Return only the floating register values */
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ void arch_getfpu(FAR uint32_t *fpusave)
|
|||||||
/* Take a snapshot of the thread context right now */
|
/* Take a snapshot of the thread context right now */
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
arm_saveusercontext(g_saveregs);
|
up_saveusercontext(g_saveregs);
|
||||||
|
|
||||||
/* Return only the floating register values */
|
/* Return only the floating register values */
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void arch_getfpu(FAR uint32_t *fpusave)
|
|||||||
/* Take a snapshot of the thread context right now */
|
/* Take a snapshot of the thread context right now */
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
arm_saveusercontext(g_saveregs);
|
up_saveusercontext(g_saveregs);
|
||||||
|
|
||||||
/* Return only the floating register values */
|
/* Return only the floating register values */
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void arch_getfpu(FAR uint32_t *fpusave)
|
|||||||
/* Take a snapshot of the thread context right now */
|
/* Take a snapshot of the thread context right now */
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
arm_saveusercontext(g_saveregs);
|
up_saveusercontext(g_saveregs);
|
||||||
|
|
||||||
/* Return only the floating register values */
|
/* Return only the floating register values */
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void arch_getfpu(FAR uint32_t *fpusave)
|
|||||||
/* Take a snapshot of the thread context right now */
|
/* Take a snapshot of the thread context right now */
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
arm_saveusercontext(g_saveregs);
|
up_saveusercontext(g_saveregs);
|
||||||
|
|
||||||
/* Return only the floating register values */
|
/* Return only the floating register values */
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void arch_getfpu(FAR uint32_t *fpusave)
|
|||||||
/* Take a snapshot of the thread context right now */
|
/* Take a snapshot of the thread context right now */
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
arm_saveusercontext(g_saveregs);
|
up_saveusercontext(g_saveregs);
|
||||||
|
|
||||||
/* Return only the floating register values */
|
/* Return only the floating register values */
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ void arch_getfpu(FAR uint32_t *fpusave)
|
|||||||
/* Take a snapshot of the thread context right now */
|
/* Take a snapshot of the thread context right now */
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
arm_saveusercontext(g_saveregs);
|
up_saveusercontext(g_saveregs);
|
||||||
|
|
||||||
/* Return only the floating register values */
|
/* Return only the floating register values */
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user