48 lines
2.4 KiB
C++

#pragma once
#if !defined(BAD_APPLE_OS_INTERRUPT_HPP_INCLUDED)
#define BAD_APPLE_OS_INTERRUPT_HPP_INCLUDED
#include <cstdint>
namespace baos
{
#if defined(__x86_64__)
struct InterruptFrame
{
std::uint64_t ip;
std::uint64_t cs;
std::uint64_t flags;
std::uint64_t sp;
std::uint64_t ss;
};
using interrupt_error_code_t = std::uint64_t;
#endif
using interrupt_handler_t = __attribute__((interrupt)) void(*)(baos::InterruptFrame*);
using interrupt_handler_with_error_code_t = __attribute__((interrupt)) void(*)(baos::InterruptFrame*, interrupt_error_code_t);
__attribute__((interrupt))
void isrDivisionError(InterruptFrame* interruptFrame) noexcept;
__attribute__((interrupt)) void isrOverflow(InterruptFrame* interruptFrame) noexcept;
__attribute__((interrupt)) void isrBoundRangeExceeded(InterruptFrame* interruptFrame) noexcept;
__attribute__((interrupt)) void isrInvalidOpCode(InterruptFrame* interruptFrame) noexcept;
__attribute__((interrupt)) void isrDeviceNotAvailable(InterruptFrame* interruptFrame) noexcept;
__attribute__((interrupt)) void isrDoubleFault(InterruptFrame* interruptFrame) noexcept;
__attribute__((interrupt)) void isrInvalidTSS(InterruptFrame* interruptFrame, interrupt_error_code_t errorCode) noexcept;
__attribute__((interrupt)) void isrSegmentNotPresent(InterruptFrame* interruptFrame, interrupt_error_code_t errorCode) noexcept;
__attribute__((interrupt)) void isrStackSegmentFault(InterruptFrame* interruptFrame, interrupt_error_code_t errorCode) noexcept;
__attribute__((interrupt)) void isrGeneralProtectionFault(InterruptFrame* interruptFrame, interrupt_error_code_t errorCode) noexcept;
__attribute__((interrupt)) void isrPageFault(InterruptFrame* interruptFrame, interrupt_error_code_t errorCode) noexcept;
__attribute__((interrupt)) void isrX87FPException(InterruptFrame* interruptFrame) noexcept;
__attribute__((interrupt)) void isrAlignmentCheck(InterruptFrame* interruptFrame, interrupt_error_code_t errorCode) noexcept;
__attribute__((interrupt)) void isrMachineCheck(InterruptFrame* interruptFrame) noexcept;
__attribute__((interrupt)) void isrSimdFpException(InterruptFrame* interruptFrame) noexcept;
__attribute__((interrupt)) void isrVirtualizationException(InterruptFrame* interruptFrame) noexcept;
__attribute__((interrupt)) void isrControlProtectionException(InterruptFrame* interruptFrame, interrupt_error_code_t errorCode) noexcept;
}
#endif // !defined(BAD_APPLE_OS_INTERRUPT_HPP_INCLUDED)