1 /*
2  * Copyright (c) 2006-2021, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2021-07-18     JasonHu      first version
9  */
10 
11 #ifndef  LWP_ARCH_H__
12 #define  LWP_ARCH_H__
13 
14 #include <lwp.h>
15 #include <lwp_arch_comm.h>
16 #include <stackframe.h>
17 
18 #ifdef ARCH_MM_MMU
19 #define USER_VADDR_TOP    0xFFFFF000UL
20 #define USER_HEAP_VEND    0xE0000000UL
21 #define USER_HEAP_VADDR   0x90000000UL
22 #define USER_STACK_VSTART 0x80000000UL
23 #define USER_STACK_VEND   USER_HEAP_VADDR
24 #define LDSO_LOAD_VADDR   0x70000000UL
25 #define USER_VADDR_START  0x40000000UL
26 #define USER_LOAD_VADDR   USER_VADDR_START
27 
28 #define SIGNAL_RETURN_SYSCAL_ID    0xe000
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 rt_thread_t rt_thread_sp_to_thread(void *spmember_addr);
35 
36 void lwp_signal_do_return(rt_hw_stack_frame_t *frame);
37 
rt_hw_ffz(unsigned long x)38 rt_inline unsigned long rt_hw_ffz(unsigned long x)
39 {
40     return __builtin_ffsl(~x) - 1;
41 }
42 
43 #ifdef __cplusplus
44 }
45 #endif
46 
47 #endif  /* ARCH_MM_MMU */
48 
49 #endif  /*LWP_ARCH_H__*/
50