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,
12  APIC_PLx2APIC = 9
13 };
14 
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
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
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
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
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));
Основные определения ядра
struct registers __attribute__((packed))
Структура данных пакета от мыши
Definition: psf.h:19
Definition: apic_table.h:76