Sixty-five headers sat side by side in include/, so `#include "irq.h"` said nothing about where irq.h was or what it belonged to, and errno.h, stat.h and fcntl.h at the top shadowed the system's for any host tool built with -I./include. They are in folders now -- arch/ core/ fs/ dev/ gfx/ net/ uapi/ (and ldls/ for the Linux driver layer) -- and every include names the folder, as Linux's do: "core/proc.h". Done mechanically and checked the hard way: the kernel built from this tree disassembles identically to the one built from the tree before it. The full image boots, and userland is the same set of programs. Paths in docs and comments follow; docs/guides/layout.md has a table of what is where, and tools/fix-includes.py rewrites old-style includes from the folders in the tree, for code written before this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
59 lines
2.3 KiB
C
59 lines
2.3 KiB
C
// See MultiProcessor Specification Version 1.[14]
|
|
|
|
struct mp { // floating pointer
|
|
uchar signature[4]; // "_MP_"
|
|
uint32 physaddr; // 32-bit phys addr of MP config table
|
|
uchar length; // 1
|
|
uchar specrev; // [14]
|
|
uchar checksum; // all bytes must add up to 0
|
|
uchar type; // MP system config type
|
|
uchar imcrp;
|
|
uchar reserved[3];
|
|
};
|
|
|
|
struct mpconf { // configuration table header
|
|
uchar signature[4]; // "PCMP"
|
|
ushort length; // total table length
|
|
uchar version; // [14]
|
|
uchar checksum; // all bytes must add up to 0
|
|
uchar product[20]; // product id
|
|
uint32 oemtable_p; // OEM table pointer
|
|
ushort oemlength; // OEM table length
|
|
ushort entry; // entry count
|
|
uint32 lapicaddr_p; // address of local APIC
|
|
ushort xlength; // extended table length
|
|
uchar xchecksum; // extended table checksum
|
|
uchar reserved;
|
|
};
|
|
|
|
struct mpproc { // processor table entry
|
|
uchar type; // entry type (0)
|
|
uchar apicid; // local APIC id
|
|
uchar version; // local APIC verison
|
|
uchar flags; // CPU flags
|
|
#define MPBOOT 0x02 // This proc is the bootstrap processor.
|
|
uchar signature[4]; // CPU signature
|
|
uint feature; // feature flags from CPUID instruction
|
|
uchar reserved[8];
|
|
};
|
|
|
|
struct mpioapic { // I/O APIC table entry
|
|
uchar type; // entry type (2)
|
|
uchar apicno; // I/O APIC id
|
|
uchar version; // I/O APIC version
|
|
uchar flags; // I/O APIC flags
|
|
uint32 addr_p; // I/O APIC address
|
|
};
|
|
|
|
// Table entry types
|
|
#define MPPROC 0x00 // One per processor
|
|
#define MPBUS 0x01 // One per bus
|
|
#define MPIOAPIC 0x02 // One per I/O APIC
|
|
#define MPIOINTR 0x03 // One per bus interrupt source
|
|
#define MPLINTR 0x04 // One per system interrupt source
|
|
|
|
|
|
// The I/O APIC's registers, as the firmware described them. 0xFEC00000 is
|
|
// only where they usually are; see kernel/arch/x86_64/mp.c.
|
|
#define IOAPIC_DEFAULT_PHYS 0xFEC00000ULL
|
|
extern uint64 ioapic_phys;
|