summaryrefslogtreecommitdiff
path: root/src/interrupt.c
blob: 97bc9210e56660da84bf93ce9db383d732252a55 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "aplos.h"

static char8_t *descriptions[256] = {
	[0]  = u8"divide-by-zero-error",
	[1]  = u8"debug",
	[2]  = u8"non-maskable-interrupt",
	[3]  = u8"breakpoint",
	[4]  = u8"overflow",
	[5]  = u8"bound-range",
	[6]  = u8"invalid-opcode",
	[7]  = u8"device-not-available",
	[8]  = u8"double-fault",
	[9]  = u8"coprocessor-segment-overrun",
	[10] = u8"invalid-tss",
	[11] = u8"segment-not-present",
	[12] = u8"stack",
	[13] = u8"general-protection",	
	[14] = u8"page-fault",
	[16] = u8"x87 floating-point exception-pending",
	[17] = u8"alignment-check",
	[18] = u8"machine-check",
	[19] = u8"simd floating-point",
	[21] = u8"control protection",
	[28] = u8"hypervisor injection exception",
	[29] = u8"vmm communication exception",
	[30] = u8"security exception",
};

void
interrupt_handler(uint8_t n)
{
	char8_t *desc = descriptions[n];

	print(u8"Got interrupt: %u8", n);
	if(desc)
		print(u8" (%s)", desc);
	print(u8"\n");
	panic();
}