MushOS  0.1
A UNIX-like OS prototype, written from scratch
Loading...
Searching...
No Matches
interruption_tables.h
1#ifndef MUSHOS_INTERRUPTION_TABLES_H
2#define MUSHOS_INTERRUPTION_TABLES_H
3
4#include "../../lib/base/generic.h"
5
6
7typedef struct {
8 u_word base_low;
9 u_word selector;
10 u_byte always0;
11 u_byte flags;
12 u_word base_high;
13} __attribute__((packed)) IDT_entry;
14
15typedef struct {
16 u_word size;
17 u_dword pos;
18} __attribute__((packed)) IDT_descriptor;
19
20typedef struct {
21 IDT_entry entries [256];
22 IDT_descriptor descriptor;
23} IDT;
24
25void init_interruptions();
26void init_debug_handler();
27
28typedef struct {
29 u_dword ds; // Data segment selector
30 u_dword edi, esi, ebp, esp_plus, ebx, edx, ecx, eax; // Pushed by pusha.
31 u_dword int_no, err_code; // Interrupt number and error code (if applicable)
32 u_dword eip, cs, eflags; // Pushed by the processor automatically.
33} registers;
34
35typedef void (*interruption_handler)(registers* regs);
36void set_interrupt_handler(u_byte n, interruption_handler handler);
37void silence_interrupt(u_byte n);
38
39#endif //MUSHOS_INTERRUPTION_TABLES_H
u_dword size(void *structure)
Definition: lib/base/heap.c:65