1 /*
2  * Copyright 2014, General Dynamics C4 Systems
3  *
4  * SPDX-License-Identifier: GPL-2.0-only
5  */
6 
7 #pragma once
8 
9 #include <util.h>
10 #include <arch/types.h>
11 #include <arch/machine/registerset.h>
12 #include <arch/object/structures.h>
13 
14 typedef enum {
15     MessageID_Syscall,
16     MessageID_Exception,
17 #ifdef CONFIG_KERNEL_MCS
18     MessageID_TimeoutReply,
19 #endif
20 } MessageID_t;
21 
22 #ifdef CONFIG_KERNEL_MCS
23 #define MAX_MSG_SIZE MAX(n_syscallMessage, MAX(n_timeoutMessage, n_exceptionMessage))
24 #else
25 #define MAX_MSG_SIZE MAX(n_syscallMessage, n_exceptionMessage)
26 #endif
27 extern const register_t fault_messages[][MAX_MSG_SIZE] VISIBLE;
28 
setRegister(tcb_t * thread,register_t reg,word_t w)29 static inline void setRegister(tcb_t *thread, register_t reg, word_t w)
30 {
31     thread->tcbArch.tcbContext.registers[reg] = w;
32 }
33 
getRegister(tcb_t * thread,register_t reg)34 static inline word_t PURE getRegister(tcb_t *thread, register_t reg)
35 {
36     return thread->tcbArch.tcbContext.registers[reg];
37 }
38 
39 #ifdef CONFIG_KERNEL_MCS
40 word_t getNBSendRecvDest(void);
41 #endif
42 
43