diff options
| author | Bernard Xiong <[email protected]> | 2024-07-24 13:32:11 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-07-24 13:32:11 +0800 |
| commit | e955e411b7539d091939a589abc29338aed1b11f (patch) | |
| tree | 8f591e567449f350494610a49dc3f7d087abdc7a /components | |
| parent | 79457efc49dd514c45912f6ebeb1e9b672062ffc (diff) | |
| parent | 7138f340b2c1cf002779a45d73c4d30295d44c58 (diff) | |
Merge pull request #9212 from polarvid/shell/opt-gctx
[libcpu] trimming ARM64 general context
Diffstat (limited to 'components')
| -rw-r--r-- | components/lwp/arch/aarch64/cortex-a/lwp_arch.c | 10 | ||||
| -rw-r--r-- | components/lwp/arch/aarch64/cortex-a/lwp_gcc.S | 5 |
2 files changed, 8 insertions, 7 deletions
diff --git a/components/lwp/arch/aarch64/cortex-a/lwp_arch.c b/components/lwp/arch/aarch64/cortex-a/lwp_arch.c index 3df6b2f4f7..7e6cd45960 100644 --- a/components/lwp/arch/aarch64/cortex-a/lwp_arch.c +++ b/components/lwp/arch/aarch64/cortex-a/lwp_arch.c @@ -106,18 +106,16 @@ int arch_set_thread_context(void (*exit)(void), void *new_thread_stack, struct rt_hw_exp_stack *ori_syscall = rt_thread_self()->user_ctx.ctx; RT_ASSERT(ori_syscall != RT_NULL); - thread_frame = (void *)((long)new_thread_stack - sizeof(struct rt_hw_exp_stack)); - syscall_frame = (void *)((long)new_thread_stack - 2 * sizeof(struct rt_hw_exp_stack)); + new_thread_stack = (rt_ubase_t*)RT_ALIGN_DOWN((rt_ubase_t)new_thread_stack, 16); + syscall_frame = (void *)((long)new_thread_stack - sizeof(struct rt_hw_exp_stack)); memcpy(syscall_frame, ori_syscall, sizeof(*syscall_frame)); syscall_frame->sp_el0 = (long)user_stack; syscall_frame->x0 = 0; - thread_frame->cpsr = ((3 << 6) | 0x4 | 0x1); - thread_frame->pc = (long)exit; - thread_frame->x0 = 0; + thread_frame = (void *)rt_hw_stack_init(exit, RT_NULL, (void *)syscall_frame, RT_NULL); - *thread_sp = syscall_frame; + *thread_sp = thread_frame; return 0; } diff --git a/components/lwp/arch/aarch64/cortex-a/lwp_gcc.S b/components/lwp/arch/aarch64/cortex-a/lwp_gcc.S index a71ee339cb..571f422a74 100644 --- a/components/lwp/arch/aarch64/cortex-a/lwp_gcc.S +++ b/components/lwp/arch/aarch64/cortex-a/lwp_gcc.S @@ -125,12 +125,15 @@ lwp_exec_user: * since this routine reset the SP, we take it as a start point */ START_POINT(SVC_Handler) + mov fp, xzr + mov lr, xzr + /* x0 is initial sp */ mov sp, x0 msr daifclr, #3 /* enable interrupt */ - bl rt_thread_self + GET_THREAD_SELF x0 bl lwp_user_setting_save ldp x8, x9, [sp, #(CONTEXT_OFFSET_X8)] |
