You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
3.1 KiB
C

/* Copyright (C) 2021,2022 fef <owo@fef.moe>. All rights reserved. */
#pragma once
#define _ARCH_TRAP_H_
/**
* @file include/arch/trap.h
* @brief Low level system interrupt handler definitions.
*
* The functions prefixed with an underscore are implemented in assembly and
* are what is actually referenced in the IDT. They call the respective C
* handler (the one without the underscore), and then return from the interrupt.
* Yes i know that there is the thing where compilers automatically prefix C
* symbols with an underscore which potentially leads to a name clash, but clang
* doesn't do that. That is, i hope it doesn't, but i checked and it doesn't
* appear to be the case. Trust me, it's fine.
*/
#include <arch/interrupt.h>
#include <gay/cdefs.h>
#include <gay/types.h>
#ifdef __x86_64__
#include <amd64/trap.h>
#else
#include <i386/trap.h>
#endif
extern void _x86_isr_divide_error(void);
__asmlink void x86_isr_divide_error(trap_frame_t *frame);
extern void _x86_isr_debug_exception(void);
__asmlink void x86_isr_debug_exception(trap_frame_t *frame);
extern void _x86_isr_nmi(void);
__asmlink void x86_isr_nmi(trap_frame_t *frame);
extern void _x86_isr_breakpoint(void);
__asmlink void x86_isr_breakpoint(trap_frame_t *frame);
extern void _x86_isr_overflow(void);
__asmlink void x86_isr_overflow(trap_frame_t *frame);
extern void _x86_isr_bound_range_exceeded(void);
__asmlink void x86_isr_bound_range_exceeded(trap_frame_t *frame);
extern void _x86_isr_invalid_opcode(void);
__asmlink void x86_isr_invalid_opcode(trap_frame_t *frame);
extern void _x86_isr_device_not_available(void);
__asmlink void x86_isr_device_not_available(trap_frame_t *frame);
extern void _x86_isr_double_fault(void);
__asmlink void x86_isr_double_fault(trap_frame_t *frame, u32 error_code);
extern void _x86_isr_invalid_tss(void);
__asmlink void x86_isr_invalid_tss(trap_frame_t *frame, u32 error_code);
extern void _x86_isr_segment_not_present(void);
__asmlink void x86_isr_segment_not_present(trap_frame_t *frame, u32 error_code);
extern void _x86_isr_stack_segment_fault(void);
__asmlink void x86_isr_stack_segment_fault(trap_frame_t *frame, u32 error_code);
extern void _x86_isr_general_protection(void);
__asmlink void x86_isr_general_protection(trap_frame_t *frame, u32 error_code);
extern void _x86_isr_page_fault(void);
__asmlink void x86_isr_page_fault(trap_frame_t *frame, u32 error_code);
extern void _x86_isr_x87_fpu_error(void);
__asmlink void x86_isr_x87_fpu_error(trap_frame_t *frame);
extern void _x86_isr_alignment_check(void);
__asmlink void x86_isr_alignment_check(trap_frame_t *frame, u32 error_code);
extern void _x86_isr_machine_check(void);
__asmlink void x86_isr_machine_check(trap_frame_t *frame);
extern void _x86_isr_simd_floating_point_exception(void);
__asmlink void x86_isr_simd_floating_point_exception(trap_frame_t *frame);
extern void _x86_isr_virtualization_exception(void);
__asmlink void x86_isr_virtualization_exception(trap_frame_t *frame);
extern void _x86_isr_control_protection_exception(void);
__asmlink void x86_isr_control_protection_exception(trap_frame_t *frame, u32 error_code);