matos/core/exception.h
Mathieu Maret 29f085b7aa Add va_list
and rename types.h into stdarg.h
2018-08-06 21:28:42 +02:00

47 lines
1.4 KiB
C

#pragma once
#include "interrupt.h"
#include "stdarg.h"
#define EXCEPTION_INTERRUPT_BASE_ADDRESS 0
// list and description https://wiki.osdev.org/Exceptions
#define EXCEPTION_DIVIDE_ZERO 0
#define EXCEPTION_DEBUG 1
#define EXCEPTION_NMI 2
#define EXCEPTION_BREAKPOINT 3
#define EXCEPTION_OVERFLOW 4
#define EXCEPTION_BOUND_RANGE_EXCEEDED 5
#define EXCEPTION_INVALID_OPCODE 6
#define EXCEPTION_DEVICE_NOT_AVAILABLE 7
#define EXCEPTION_DOUBLE_FAULT 8
#define EXCEPTION_COPRO_OVERRUN 9
#define EXCEPTION_INVALID_TSS 10
#define EXCEPTION_SEGMENT_NOT_PRESENT 11
#define EXCEPTION_STACK_SEGMENT_FAULT 12
#define EXCEPTION_GENERAL_PROTECTION_FAULT 13
#define EXCEPTION_PAGE_FAULT 14
#define EXCEPTION_RESERVED_1 15
#define EXCEPTION_X87_FP_EXCEPTION 16
#define EXCEPTION_ALIGNMENT_CHECK 17
#define EXCEPTION_MACHINE_CHECK 18
#define EXCEPTION_SIMD_FP 19
#define EXCEPTION_VIRTUALIZATION 20
#define EXCEPTION_RESERVED_2 21
#define EXCEPTION_RESERVED_3 22
#define EXCEPTION_RESERVED_4 23
#define EXCEPTION_RESERVED_5 24
#define EXCEPTION_RESERVED_6 25
#define EXCEPTION_RESERVED_7 26
#define EXCEPTION_RESERVED_8 27
#define EXCEPTION_RESERVED_9 28
#define EXCEPTION_RESERVED_10 29
#define EXCEPTION_SECURITY 30
#define EXCEPTION_RESERVED_11 31
#define EXCEPTION_NUM 32
typedef void (*exception_handler) (struct interrupt_frame *frame, ulong error_code);
int exceptionSetRoutine(int exception, exception_handler handler);