FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
idt.h
Go to the documentation of this file.
1
11
12
13#ifndef IDT_H
14#define IDT_H
15
16#include <stdint.h>
17
18#define ICW1_INIT 0x10
19#define ICW1_ICW4 0x01
20#define ICW4_8086 0x01
21
22#define IA32_EFER 0xC0000080
23#define IA32_STAR 0xC0000081
24#define IA32_LSTAR 0xC0000082
25#define IA32_FMASK 0xC0000084
26
27#define EFER_SCE (1 << 0)
28
29typedef struct IDTEntry
30{
31 uint16_t offset_1; // offset bits 0..15
32 uint16_t selector; // a code segment selector in GDT or LDT
33 uint8_t ist; // bits 0..2 holds Interrupt Stack Table offset, rest of bits zero.
34 uint8_t type_attributes; // gate type, dpl, and p fields
35 uint16_t offset_2; // offset bits 16..31
36 uint32_t offset_3; // offset bits 32..63
37 uint32_t zero; // reserved
38}__attribute__((packed)) IDTEntry;
39
40typedef struct IDTPointer
41{
42 uint16_t size;
43 uint64_t offset;
44}__attribute__((packed)) IDTPointer;
45
50extern void syscall_entry(void);
51
57
58void initIdt();
59void setIdtEntry(IDTEntry *target, uint64_t offset, uint16_t selector, uint8_t ist, uint8_t type_attributes);
60
61#endif
struct acpi_gas __attribute__
Physical Region Descriptor Table (PRDT) entry.
Definition ahci.h:71
void init_syscall()
Tells the CPU to use the syscall instruction.
void syscall_entry(void)
Located inside /interrupts/syscall-x86_64.asm.
Definition idt.h:30