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