2022-12-03 12:07:44 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __LWP_ARCH_COMM__
|
|
|
|
#define __LWP_ARCH_COMM__
|
|
|
|
|
2023-01-09 10:08:55 +08:00
|
|
|
#include <mm_aspace.h>
|
2022-12-03 12:07:44 +08:00
|
|
|
#include <rtthread.h>
|
2023-01-09 10:08:55 +08:00
|
|
|
#include <mmu.h>
|
2022-12-03 12:07:44 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* APIs that must port to all architectures
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* syscall handlers */
|
|
|
|
void arch_clone_exit(void);
|
|
|
|
void arch_fork_exit(void);
|
|
|
|
void arch_syscall_exit();
|
|
|
|
void arch_ret_to_user();
|
|
|
|
|
|
|
|
/* ELF relocation */
|
2022-12-16 18:38:28 +08:00
|
|
|
#ifdef ARCH_MM_MMU
|
2023-01-09 10:08:55 +08:00
|
|
|
|
|
|
|
struct rt_lwp;
|
|
|
|
void arch_elf_reloc(rt_aspace_t aspace, void *text_start, void *rel_dyn_start, size_t rel_dyn_size, void *got_start, size_t got_size, void *dynsym);
|
2022-12-03 12:07:44 +08:00
|
|
|
#else
|
|
|
|
void arch_elf_reloc(void *text_start, void *rel_dyn_start, size_t rel_dyn_size, void *got_start, size_t got_size, void *dynsym);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* User entry. enter user program code for the first time */
|
|
|
|
void arch_crt_start_umode(void *args, const void *text, void *ustack, void *user_stack);
|
|
|
|
void arch_start_umode(void *args, const void *text, void *ustack, void *k_stack);
|
|
|
|
|
|
|
|
/* lwp create and setup */
|
|
|
|
int arch_set_thread_context(void (*exit)(void), void *new_thread_stack,
|
|
|
|
void *user_stack, void **thread_sp);
|
|
|
|
void *arch_get_user_sp(void);
|
|
|
|
|
|
|
|
/* user space setup and control */
|
|
|
|
int arch_user_space_init(struct rt_lwp *lwp);
|
|
|
|
void arch_user_space_vtable_free(struct rt_lwp *lwp);
|
|
|
|
void *arch_kernel_mmu_table_get(void);
|
2023-01-09 10:08:55 +08:00
|
|
|
void arch_kuser_init(rt_aspace_t aspace, void *vectors);
|
2022-12-03 12:07:44 +08:00
|
|
|
int arch_expand_user_stack(void *addr);
|
|
|
|
|
|
|
|
/* thread id register */
|
|
|
|
void arch_set_thread_area(void *p);
|
|
|
|
void* arch_get_tidr(void);
|
|
|
|
void arch_set_tidr(void *p);
|
|
|
|
|
|
|
|
#endif /* __LWP_ARCH_COMM__ */
|