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 <autoconf.h> 10#include <sel4/faults.h> 11#include <sel4/sel4_arch/constants.h> 12 13LIBSEL4_INLINE_FUNC seL4_Fault_t seL4_getArchFault(seL4_MessageInfo_t tag) 14{ 15 switch (seL4_MessageInfo_get_label(tag)) { 16 case seL4_Fault_UnknownSyscall: 17 return seL4_Fault_UnknownSyscall_new(seL4_GetMR(seL4_UnknownSyscall_X0), 18 seL4_GetMR(seL4_UnknownSyscall_X1), 19 seL4_GetMR(seL4_UnknownSyscall_X2), 20 seL4_GetMR(seL4_UnknownSyscall_X3), 21 seL4_GetMR(seL4_UnknownSyscall_X4), 22 seL4_GetMR(seL4_UnknownSyscall_X5), 23 seL4_GetMR(seL4_UnknownSyscall_X6), 24 seL4_GetMR(seL4_UnknownSyscall_X7), 25 seL4_GetMR(seL4_UnknownSyscall_FaultIP), 26 seL4_GetMR(seL4_UnknownSyscall_SP), 27 seL4_GetMR(seL4_UnknownSyscall_LR), 28 seL4_GetMR(seL4_UnknownSyscall_SPSR), 29 seL4_GetMR(seL4_UnknownSyscall_Syscall)); 30 31 case seL4_Fault_UserException: 32 return seL4_Fault_UserException_new(seL4_GetMR(seL4_UserException_FaultIP), 33 seL4_GetMR(seL4_UserException_SP), 34 seL4_GetMR(seL4_UserException_SPSR), 35 seL4_GetMR(seL4_UserException_Number), 36 seL4_GetMR(seL4_UserException_Code)); 37 case seL4_Fault_VMFault: 38 return seL4_Fault_VMFault_new(seL4_GetMR(seL4_VMFault_IP), 39 seL4_GetMR(seL4_VMFault_Addr), 40 seL4_GetMR(seL4_VMFault_PrefetchFault), 41 seL4_GetMR(seL4_VMFault_FSR)); 42#ifdef CONFIG_ARM_HYPERVISOR_SUPPORT 43 case seL4_Fault_VGICMaintenance: 44 return seL4_Fault_VGICMaintenance_new(seL4_GetMR(seL4_VGICMaintenance_IDX)); 45 case seL4_Fault_VCPUFault: 46 return seL4_Fault_VCPUFault_new(seL4_GetMR(seL4_VCPUFault_HSR)); 47 case seL4_Fault_VPPIEvent: 48 return seL4_Fault_VPPIEvent_new(seL4_GetMR(seL4_VPPIEvent_IRQ)); 49#endif /* CONFIG_ARM_HYPERVISOR_SUPPORT */ 50#ifdef CONFIG_KERNEL_MCS 51 case seL4_Fault_Timeout: 52 return seL4_Fault_Timeout_new(seL4_GetMR(seL4_Timeout_Data), 53 seL4_GetMR(seL4_Timeout_Consumed)); 54#endif /* CONFIG_KERNEL_MCS */ 55 default: 56 return seL4_Fault_NullFault_new(); 57 } 58} 59