1 /*
2  * Copyright (c) 2017 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @file
9  * @brief Per-arch thread definition
10  *
11  * This file contains definitions for
12  *
13  *  struct _thread_arch
14  *  struct _callee_saved
15  *
16  * necessary to instantiate instances of struct k_thread.
17  */
18 
19 #ifndef ZEPHYR_INCLUDE_ARCH_ARC_THREAD_H_
20 #define ZEPHYR_INCLUDE_ARCH_ARC_THREAD_H_
21 
22 /*
23  * Reason a thread has relinquished control.
24  */
25 #define _CAUSE_NONE 0
26 #define _CAUSE_COOP 1
27 #define _CAUSE_RIRQ 2
28 #define _CAUSE_FIRQ 3
29 
30 #ifndef _ASMLANGUAGE
31 #include <zephyr/types.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 struct _callee_saved {
38 	uintptr_t sp; /* r28 */
39 };
40 typedef struct _callee_saved _callee_saved_t;
41 
42 struct _thread_arch {
43 
44 	/* one of the _CAUSE_xxxx definitions above */
45 	int32_t relinquish_cause;
46 
47 #ifdef CONFIG_ARC_STACK_CHECKING
48 	/* High address of stack region, stack grows downward from this
49 	 * location. Usesd for hardware stack checking
50 	 */
51 	uintptr_t k_stack_base;
52 	uintptr_t k_stack_top;
53 #ifdef CONFIG_USERSPACE
54 	uintptr_t u_stack_base;
55 	uintptr_t u_stack_top;
56 #endif
57 #endif
58 
59 #ifdef CONFIG_USERSPACE
60 	uintptr_t priv_stack_start;
61 #endif
62 };
63 
64 typedef struct _thread_arch _thread_arch_t;
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 
70 #endif /* _ASMLANGUAGE */
71 
72 
73 #endif /* ZEPHYR_INCLUDE_ARCH_ARC_THREAD_H_ */
74