1 /*
2  * Copyright (c) 2016 Jean-Paul Etienne <fractalclone@gmail.com>
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_ARCH_RISCV_INCLUDE_OFFSETS_SHORT_ARCH_H_
8 #define ZEPHYR_ARCH_RISCV_INCLUDE_OFFSETS_SHORT_ARCH_H_
9 
10 #include <offsets.h>
11 
12 /* kernel */
13 
14 /* nothing for now */
15 
16 /* end - kernel */
17 
18 /* threads */
19 
20 #define _thread_offset_to_sp \
21 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_sp_OFFSET)
22 
23 #define _thread_offset_to_s0 \
24 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_s0_OFFSET)
25 
26 #define _thread_offset_to_s1 \
27 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_s1_OFFSET)
28 
29 #define _thread_offset_to_s2 \
30 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_s2_OFFSET)
31 
32 #define _thread_offset_to_s3 \
33 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_s3_OFFSET)
34 
35 #define _thread_offset_to_s4 \
36 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_s4_OFFSET)
37 
38 #define _thread_offset_to_s5 \
39 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_s5_OFFSET)
40 
41 #define _thread_offset_to_s6 \
42 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_s6_OFFSET)
43 
44 #define _thread_offset_to_s7 \
45 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_s7_OFFSET)
46 
47 #define _thread_offset_to_s8 \
48 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_s8_OFFSET)
49 
50 #define _thread_offset_to_s9 \
51 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_s9_OFFSET)
52 
53 #define _thread_offset_to_s10 \
54 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_s10_OFFSET)
55 
56 #define _thread_offset_to_s11 \
57 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_s11_OFFSET)
58 
59 #define _thread_offset_to_swap_return_value \
60 	(___thread_t_arch_OFFSET + ___thread_arch_t_swap_return_value_OFFSET)
61 
62 #if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING)
63 
64 #define _thread_offset_to_fcsr \
65 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_fcsr_OFFSET)
66 
67 #define _thread_offset_to_fs0 \
68 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_fs0_OFFSET)
69 
70 #define _thread_offset_to_fs1 \
71 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_fs1_OFFSET)
72 
73 #define _thread_offset_to_fs2 \
74 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_fs2_OFFSET)
75 
76 #define _thread_offset_to_fs3 \
77 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_fs3_OFFSET)
78 
79 #define _thread_offset_to_fs4 \
80 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_fs4_OFFSET)
81 
82 #define _thread_offset_to_fs5 \
83 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_fs5_OFFSET)
84 
85 #define _thread_offset_to_fs6 \
86 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_fs6_OFFSET)
87 
88 #define _thread_offset_to_fs7 \
89 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_fs7_OFFSET)
90 
91 #define _thread_offset_to_fs8 \
92 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_fs8_OFFSET)
93 
94 #define _thread_offset_to_fs9 \
95 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_fs9_OFFSET)
96 
97 #define _thread_offset_to_fs10 \
98 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_fs10_OFFSET)
99 
100 #define _thread_offset_to_fs11 \
101 	(___thread_t_callee_saved_OFFSET + ___callee_saved_t_fs11_OFFSET)
102 
103 #endif /* defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING) */
104 
105 #ifdef CONFIG_USERSPACE
106 #define _thread_offset_to_priv_stack_start \
107 	(___thread_t_arch_OFFSET + ___thread_arch_t_priv_stack_start_OFFSET)
108 #define _thread_offset_to_user_sp \
109 	(___thread_t_arch_OFFSET + ___thread_arch_t_user_sp_OFFSET)
110 #endif
111 
112 /* end - threads */
113 
114 #endif /* ZEPHYR_ARCH_RISCV_INCLUDE_OFFSETS_SHORT_ARCH_H_ */
115