SayoriOS 0.3.3

apic_table.h
1 #pragma once
2
3 #include "common.h"
4
5 enum APIC_Type {
6 APIC_PLAPIC = 0,
7 APIC_IOAPIC = 1,
8 APIC_IOAPIC_ISO = 2,
9 APIC_IOAPIC_NMI = 3,
10 APIC_LAPIC_NMI = 4,
11 APIC_LAPIC_OVERRIDE = 5,
12 APIC_PLx2APIC = 9
13 };
14
15 struct APIC_Base_Table {
16 uint32_t lapic_addr;
17 uint32_t flags;
18 } __attribute__((packed));
19
20 // Entry Type 0: Processor Local APIC
21 struct APIC_PLAPIC {
22 uint8_t processor_id;
23 uint8_t apic_id;
24 uint32_t flags;
25 } __attribute__((packed));
26
27 // Entry Type 1: I/O APIC
28 struct APIC_IOAPIC {
29 uint8_t id;
30 uint8_t reserved; // Should be 0
31 uint32_t io_apic_address;
32 uint32_t global_system_interrupt_base;
33 } __attribute__((packed));
34
35 // Entry Type 2: IO/APIC Interrupt source override
36 struct APIC_IOAPIC_ISO {
37 uint8_t bus_source;
38 uint8_t irq_source;
39 uint32_t global_system_interrupt;
40 uint16_t flags;
41 } __attribute__((packed));
42
43 // Entry Type 3: IO/APIC NMI Source
44 struct APIC_IOAPIC_NMI {
45 uint8_t source;
46 uint8_t reserved; // Should be 0
47 uint16_t flags;
48 uint32_t global_system_interrupt;
49 } __attribute__((packed));
50
51 // Entry Type 4: Local APIC NMI Source
52 struct APIC_LAPIC_NMI {
53 uint8_t processor_id; // 0xFF = all processors
54 uint16_t flags;
55 uint8_t lint; // Local Interrupt? (0 or 1)
56 } __attribute__((packed));
57
58 // Entry Type 5: Local APIC Address Override
59 struct APIC_LAPIC_OVERRIDE {
60 uint16_t reserved;
61 uint32_t lapic_phys_addr_low;
62 uint32_t lapic_phys_addr_high;
63
64 // On 64-bit systems
65 // lapic_phys_addr = (lapic_phys_addr_low << 32) | lapic_phys_addr_high;
66 } __attribute__((packed));
67
68 // Entry Type 9: Processor Local x2APIC
69 struct APIC_PLx2APIC {
70 uint16_t reserved;
71 uint32_t processor_id;
72 uint32_t flags;
73 uint32_t acpi_id;
74 } __attribute__((packed));
75
76 struct APIC_Entry {
77 uint8_t type;
78 uint8_t record_length;
79
80 union {
81 struct APIC_PLAPIC plapic;
82 struct APIC_IOAPIC ioapic;
83 struct APIC_IOAPIC_ISO ioapic_iso;
84 struct APIC_IOAPIC_NMI ioapic_nmi;
85 struct APIC_LAPIC_NMI lapic_nmi;
86 struct APIC_LAPIC_OVERRIDE lapic_override;
87 struct APIC_PLx2APIC plx2apic;
88 } entry;
89 } __attribute__((packed));
common.h
Основные определения ядра
__attribute__
struct registers __attribute__((packed))
Структура данных пакета от мыши
Definition: psf.h:19
APIC_Base_Table
Definition: apic_table.h:15
APIC_Entry
Definition: apic_table.h:76
APIC_IOAPIC_ISO
Definition: apic_table.h:36
APIC_IOAPIC_NMI
Definition: apic_table.h:44
APIC_IOAPIC
Definition: apic_table.h:28
APIC_LAPIC_NMI
Definition: apic_table.h:52
APIC_LAPIC_OVERRIDE
Definition: apic_table.h:59
APIC_PLAPIC
Definition: apic_table.h:21
APIC_PLx2APIC
Definition: apic_table.h:69