1/*
2 * Copyright 2017, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
8 * See "LICENSE_BSD2.txt" for details.
9 *
10 * @TAG(DATA61_BSD)
11 */
12
13#ifndef __LIBSEL4_SEL4_DEPRECATED_H
14#define __LIBSEL4_SEL4_DEPRECATED_H
15
16#include <sel4/arch/deprecated.h>
17#include <sel4/sel4_arch/deprecated.h>
18
19#define SEL4_PFIPC_LABEL SEL4_DEPRECATE_MACRO(seL4_Fault_VMFault)
20#define SEL4_PFIPC_LENGTH SEL4_DEPRECATE_MACRO(seL4_VMFault_Length)
21#define SEL4_PFIPC_FAULT_IP SEL4_DEPRECATE_MACRO(seL4_VMFault_IP)
22#define SEL4_PFIPC_FAULT_ADDR SEL4_DEPRECATE_MACRO(seL4_VMFault_Addr)
23#define SEL4_PFIPC_PREFETCH_FAULT SEL4_DEPRECATE_MACRO(seL4_VMFault_PrefetchFault)
24#define SEL4_PFIPC_FSR SEL4_DEPRECATE_MACRO(seL4_VMFault_FSR)
25
26#define SEL4_EXCEPT_IPC_LABEL SEL4_DEPRECATE_MACRO(seL4_Fault_UnknownSyscall)
27#define SEL4_USER_EXCEPTION_LABEL SEL4_DEPRECATE_MACRO(seL4_Fault_UserException)
28#define SEL4_USER_EXCEPTION_LENGTH  SEL4_DEPRECATE_MACRO(seL4_UserException_Length)
29
30#ifdef CONFIG_ARM_HYPERVISOR_SUPPORT
31#define SEL4_VGIC_MAINTENANCE_LENGTH SEL4_DEPRECATE_MACRO(seL4_VGICMaintenance_Length)
32#define SEL4_VGIC_MAINTENANCE_LABEL  SEL4_DEPRECATE_MACRO(seL4_Fault_VGICMaintenance)
33#define SEL4_VCPU_FAULT_LENGTH SEL4_DEPRECATE_MACRO(seL4_VCPUFault_Length)
34#define SEL4_VCPU_FAULT_LABEL SEL4_DEPRECATE_MACRO(seL4_Fault_VCPUFault)
35#endif /* CONFIG_ARM_HYPERVISOR_SUPPORT */
36
37typedef seL4_CapRights_t seL4_CapRights SEL4_DEPRECATED("use seL4_CapRights_t");
38
39typedef union {
40    struct {
41        seL4_Word fault_ip;
42        seL4_Word fault_addr;
43        seL4_Word prefetch_fault;
44        seL4_Word fsr;
45    } regs;
46    seL4_Word raw[4];
47} seL4_PageFaultIpcRegisters SEL4_DEPRECATED("use seL4_Fault_VMFault_new()");
48
49typedef seL4_Fault_tag_t seL4_FaultType SEL4_DEPRECATED("use seL4_Fault_tag_t");
50
51#define seL4_NoFault SEL4_DEPRECATE_MACRO(seL4_Fault_NullFault)
52#define seL4_CapFault SEL4_DEPRECATE_MACRO(seL4_Fault_CapFault)
53#define seL4_UnknownSyscall SEL4_DEPRECATE_MACRO(seL4_Fault_UnknownSyscall)
54#define seL4_UserException SEL4_DEPRECATE_MACRO(seL4_Fault_UserException)
55#define seL4_VMFault SEL4_DEPRECATE_MACRO(seL4_Fault_VMFault)
56
57static inline SEL4_DEPRECATED("removed") seL4_MessageInfo_t
58seL4_GetTag(void)
59{
60    return seL4_GetIPCBuffer()->tag;
61}
62
63static inline SEL4_DEPRECATED("removed") void
64seL4_SetTag(seL4_MessageInfo_t tag)
65{
66    seL4_GetIPCBuffer()->tag = tag;
67}
68
69static inline SEL4_DEPRECATED("use seL4_GetMR(seL4_VMFault_IP)") seL4_Word
70seL4_PF_FIP(void)
71{
72    return seL4_GetMR(seL4_VMFault_IP);
73}
74
75static inline SEL4_DEPRECATED("use seL4_GetMR(seL4_VMFault_Addr)") seL4_Word
76seL4_PF_Addr(void)
77{
78    return seL4_GetMR(seL4_VMFault_Addr);
79}
80
81static inline SEL4_DEPRECATED("use seL4_isVMFault_tag") seL4_Word
82seL4_isPageFault_MSG(void)
83{
84    return seL4_isVMFault_tag(seL4_GetIPCBuffer()->tag);
85}
86
87static inline SEL4_DEPRECATED("use seL4_isVMFault_tag") seL4_Word
88seL4_isPageFault_Tag(seL4_MessageInfo_t tag)
89{
90    return seL4_isVMFault_tag(tag);
91}
92
93static inline SEL4_DEPRECATED("use seL4_isUnknownSyscall_tag") seL4_Word
94seL4_isExceptIPC_Tag(seL4_MessageInfo_t tag)
95{
96    return seL4_isUnknownSyscall_tag(tag);
97}
98
99static inline SEL4_DEPRECATED("use seL4_GetMR") seL4_Word
100seL4_ExceptIPC_Get(seL4_Word mr)
101{
102    return seL4_GetMR(mr);
103}
104
105static inline SEL4_DEPRECATED("use seL4_SetMR") void
106seL4_ExceptIPC_Set(seL4_Word index, seL4_Word val)
107{
108    seL4_SetMR(index, val);
109}
110
111static inline SEL4_DEPRECATED("") seL4_Word
112seL4_IsArchSyscallFrom(seL4_MessageInfo_t tag)
113{
114    return seL4_MessageInfo_get_length(tag) == seL4_UnknownSyscall_Length;
115}
116
117static inline SEL4_DEPRECATED("") seL4_Word
118seL4_IsArchExceptionFrom(seL4_MessageInfo_t tag)
119{
120    return seL4_MessageInfo_get_length(tag) == seL4_UnknownSyscall_Length;
121}
122
123typedef seL4_Word seL4_CapData_t SEL4_DEPRECATED("Badge and guard data are just seL4_Word type");
124
125static inline SEL4_DEPRECATED("Badges do not need to be constructed") seL4_Word seL4_CapData_Badge_new(seL4_Word badge)
126{
127    return badge;
128}
129
130static inline SEL4_DEPRECATED("Use seL4_CNode_CapData_new().words[0]") seL4_Word seL4_CapData_Guard_new(seL4_Word guard, seL4_Word bits)
131{
132    return seL4_CNode_CapData_new(guard, bits).words[0];
133}
134
135#endif // __LIBSEL4_SEL4_DEPRECATED_H
136
137