Kintsugi OS
0.2.0
x86 Monolithic OS
Loading...
Searching...
No Matches
idt.h
Go to the documentation of this file.
1
#ifndef IDT_H
2
#define IDT_H
3
4
#include "../kklibc/ctypes.h"
5
6
/* Селекторы сегментов */
7
#define KERNEL_CS 0x08
8
#define IDT_ENTRIES 256
9
10
/* Как определяется каждый элемент прерывания (обработчик) */
11
typedef
struct
{
12
u16
low_offset
;
/* Младшие 16 бит адреса функции обработчика */
13
u16
sel
;
/* Селектор сегментов ядра */
14
u8
always0
;
15
/*
16
Бит 7 первого байта: "Присутствует прерывание"
17
Биты 6-5: Уровень привилегий вызывающего абонента (0=ядро..3=пользователь)
18
Бит 4: Устанавливается равным 0 для элементов прерывания
19
Биты 3-0: биты 1110 = десятичное число 14 = "32-разрядный элемент прерывания"*/
20
u8
flags
;
21
u16
high_offset
;
/* Higher 16 bits of handler function address */
22
}
__attribute__
((packed)) idt_gate_t;
23
24
/* Указатель на массив обработчиков прерывания.
25
Ассемблерная инструкция 'lidt' читает это. */
26
typedef
struct
{
27
u16
limit
;
28
u32
base
;
29
}
__attribute__
((packed)) idt_register_t;
30
31
extern
idt_gate_t
idt
[
IDT_ENTRIES
];
32
extern
idt_register_t
idt_reg
;
33
40
void
set_idt_gate
(
int
n,
u32
handler);
41
46
void
set_idt
();
47
48
#endif
u32
unsigned int u32
Definition
ctypes.h:11
u16
unsigned short u16
Definition
ctypes.h:13
u8
unsigned char u8
Definition
ctypes.h:15
IDT_ENTRIES
#define IDT_ENTRIES
Definition
idt.h:8
idt
idt_gate_t idt[IDT_ENTRIES]
Definition
idt.c:3
idt_reg
idt_register_t idt_reg
Definition
idt.c:4
set_idt_gate
void set_idt_gate(int n, u32 handler)
Заготовка обработчика IDT.
Definition
idt.c:6
set_idt
void set_idt()
Заготовка IDT.
Definition
idt.c:14
__attribute__
Definition
idt.h:11
__attribute__::base
u32 base
Definition
idt.h:28
__attribute__::always0
u8 always0
Definition
idt.h:14
__attribute__::high_offset
u16 high_offset
Definition
idt.h:21
__attribute__::low_offset
u16 low_offset
Definition
idt.h:12
__attribute__::sel
u16 sel
Definition
idt.h:13
__attribute__::limit
u16 limit
Definition
idt.h:27
__attribute__::flags
u8 flags
Definition
idt.h:20
src
kernel
cpu
idt.h
Generated by
1.9.8