rt-thread/components/lwp/lwp_arch_comm.h
guo ecf2d82159
sync branch rt-smart. (#6641)
* Synchronize the code of the rt mart branch to the master branch.
  * TTY device
  * Add lwP code from rt-smart
  * Add vnode in DFS, but DFS will be re-write for rt-smart
  * There are three libcpu for rt-smart:
    * arm/cortex-a, arm/aarch64
    * riscv64

Co-authored-by: Rbb666 <zhangbingru@rt-thread.com>
Co-authored-by: zhkag <zhkag@foxmail.com>
2022-12-03 12:07:44 +08:00

54 lines
1.6 KiB
C

/*
* 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__
#include <rtthread.h>
/**
* 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 */
#ifdef RT_USING_USERSPACE
void arch_elf_reloc(rt_mmu_info *m_info, void *text_start, void *rel_dyn_start, size_t rel_dyn_size, void *got_start, size_t got_size, void *dynsym);
#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);
void arch_kuser_init(rt_mmu_info *mmu_info, void *vectors);
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__ */