Repository: SerenityOS/serenity
File: Kernel/Arch/aarch64/Registers.h (C/C++)

Code before:
    }
}

static inline bool exception_class_is_data_abort(u8 exception_class)
{
    return exception_class == 0x24 || exception_class == 0x25;
}

static inline bool exception_class_is_instruction_abort(u8 exception_class)
{
    return exception_class == 0x20 || exception_class == 0x21;
}

static inline bool exception_class_is_data_or_instruction_abort_from_lower_exception_level(u8 exception_class)
{
    return exception_class == 0x20 || exception_class == 0x24;
}

static inline bool exception_class_is_svc_instruction_execution(u8 exception_class)
{
    return exception_class == 0x11 || exception_class == 0x15;
}

static inline bool exception_class_is_breakpoint_instruction(u8 exception_class)
{
    return exception_class == 0x38 || exception_class == 0x3c;
}

// D17.2.37 ESR_EL1, Exception Syndrome Register (EL1)
// ISS encoding for an exception from a Data Abort
// DFSC, bits [5:0]
static inline StringView data_fault_status_code_to_string(u32 instruction_specific_syndrome)
{
    u8 data_fault_status_code = instruction_specific_syndrome & 0x3f;
    switch (data_fault_status_code) {
    case 0b000000:
        return "Address size fault, level 0 of translation or translation table base register"sv;
    case 0b000001:
        return "Address size fault, level 1"sv;
    case 0b000010:
        return "Address size fault, level 2"sv;
    case 0b000011:
        return "Address size fault, level 3"sv;
    case 0b000100:
        return "Translation fault, level 0"sv;
    case 0b000101:
        return "Translation fault, level 1"sv;
    case 0b000110:
        return "Translation fault, level 2"sv;
    case 0b000111:
        return "Translation fault, level 3"sv;

Review comment (suggestion):
We don't really need EC=0x38 here, sine we don't support AArch32.
But the other functions in this file also catch AArch32 state versions, so I guess it's fine. We should clean this up in the future though.

Code after:
    }
}

static inline bool exception_class_is_data_abort(u8 exception_class)
{
    return exception_class == 0x24 || exception_class == 0x25;
}

static inline bool exception_class_is_instruction_abort(u8 exception_class)
{
    return exception_class == 0x20 || exception_class == 0x21;
}

static inline bool exception_class_is_data_or_instruction_abort_from_lower_exception_level(u8 exception_class)
{
    return exception_class == 0x20 || exception_class == 0x24;
}

static inline bool exception_class_is_svc_instruction_execution(u8 exception_class)
{
    return exception_class == 0x11 || exception_class == 0x15;
}

static inline bool exception_class_is_breakpoint_instruction(u8 exception_class)
{
    return exception_class == 0x38 || exception_class == 0x3c;
}

static inline bool exception_class_is_software_step(u8 exception_class)
{
    return exception_class == 0x32 || exception_class == 0x33;
}

// D17.2.37 ESR_EL1, Exception Syndrome Register (EL1)
// ISS encoding for an exception from a Data Abort
// DFSC, bits [5:0]
static inline StringView data_fault_status_code_to_string(u32 instruction_specific_syndrome)
{
    u8 data_fault_status_code = instruction_specific_syndrome & 0x3f;
    switch (data_fault_status_code) {
    case 0b000000:
        return "Address size fault, level 0 of translation or translation table base register"sv;
    case 0b000001:
        return "Address size fault, level 1"sv;
    case 0b000010:
        return "Address size fault, level 2"sv;
    case 0b000011:
        return "Address size fault, level 3"sv;
    case 0b000100:
        return "Translation fault, level 0"sv;
    case 0b000101: