arch.x86_64.ioports

module arch.x86_64.ioports;


fn inb(port: u16) u8;
fn inw(port: u16) u16;
fn inl(port: u16) u32;
fn outb(port: u16, val: u8);
fn outw(port: u16, val: u16);
fn outl(port: u16, val: u32);

arch.x86_64.interrupts

module arch.x86_64.interrupts;


alias IrqFn = fn (IrqState*, u64, void*) (void);

struct IrqState
{
public:
	ds: u64;
	r15: u64;
	r14: u64;
	r13: u64;
	r12: u64;
	r11: u64;
	r10: u64;
	r9: u64;
	r8: u64;
	rsi: u64;
	rdi: u64;
	rbp: u64;
	rdx: u64;
	rcx: u64;
	rbx: u64;
	rax: u64;
	errorCode: u64;
	rip: u64;
	cs: u64;
	rflags: u64;
	rsp: u64;
	ss: u64;
}

fn idt_init();
fn idt_enable();
fn idt_disable();
fn idt_get(vector: u64) u64*;
fn idt_set(offset: void*, vector: u64);
fn isr_stub_set(irqFunc: IrqFn, vec: u64);

core.exception

module core.exception;


//! Base class of all objects that can be thrown.
class Throwable
{
public:
	msg: string;
	throwLocation: string;
	location: string;


public:
	//! Construct a Throwable object.
	this(msg: string, location: string) { }
}

//! An error that can be handled.
class Exception : Throwable
{
public:
	//! Construct an Exception object.
	this(msg: string, location: string) { }
}

//! An error that cannot be handled.
class Error : Throwable
{
public:
	//! Construct an Error object.
	this(msg: string, location: string) { }
}

//! Thrown if an assert fails.
class AssertError : Error
{
public:
	//! Construct an AssertError object.
	this(msg: string, location: string) { }
}

//! Thrown by the UTF code upon a malformed UTF-8 string.
class MalformedUTF8Exception : Exception
{
public:
	//! Construct a MalformedUTF8Exception object.
	this(msg: string, location: string) { }
}

//! Thrown on an AA lookup failure.
class KeyNotFoundException : Exception
{
public:
	//! Construct a KeyNotFoundException object.
	this(msg: string) { }
}

core.compiler.llvm

//! LLVM intrinsic function definitions.
module core.compiler.llvm;


alias __llvm_memset = __llvm_memset_p0i8_i64;
alias __llvm_memcpy = __llvm_memcpy_p0i8_p0i8_i64;
alias __llvm_memmove = __llvm_memmove_p0i8_p0i8_i64;

//! http://llvm.org/docs/LangRef.html#llvm-trap-intrinsic>
fn __llvm_trap();
//! http://llvm.org/docs/LangRef.html#llvm-memset-element-unordered-atomic-intrinsic>
fn __llvm_memset_p0i8_i32(dest: void*, val: u8, len: u32, _align: i32, _volatile: bool);
//! http://llvm.org/docs/LangRef.html#llvm-memset-element-unordered-atomic-intrinsic>
fn __llvm_memset_p0i8_i64(dest: void*, val: u8, len: u64, _align: i32, _volatile: bool);
//! http://llvm.org/docs/LangRef.html#llvm-memcpy-intrinsic>
fn __llvm_memcpy_p0i8_p0i8_i32(dest: void*, src: void*, len: u32, _align: i32, _volatile: bool);
//! http://llvm.org/docs/LangRef.html#llvm-memcpy-intrinsic>
fn __llvm_memcpy_p0i8_p0i8_i64(dest: void*, src: void*, len: u64, _align: i32, _volatile: bool);
//! http://llvm.org/docs/LangRef.html#llvm-memmove-intrinsic>
fn __llvm_memmove_p0i8_p0i8_i32(dest: void*, src: void*, len: u32, _align: i32, _volatile: bool);
//! http://llvm.org/docs/LangRef.html#llvm-memmove-intrinsic>
fn __llvm_memmove_p0i8_p0i8_i64(dest: void*, src: void*, len: u64, _align: i32, _volatile: bool);
//! http://llvm.org/docs/ExceptionHandling.html#llvm-eh-typeid-for>
fn __llvm_typeid_for(void*) i32;

core.compiler.defaultsymbols

//! This file is included all modules (excluding this module).
module core.compiler.defaultsymbols;


//! These are two types are aliases to integer types that are large enough
//! to offset the entire available address space.
alias size_t = u64;
//! These are two types are aliases to integer types that are large enough
//! to offset the entire available address space.
alias ptrdiff_t = i64;
//! The string type.
alias string = immutable(char)[];

core.typeinfo

module core.typeinfo;


//! The types of Volt, the type field of TypeInfo.
enum Type
{
	Struct,
	Class,
	Interface,
	Union,
	Enum,
	Attribute,
	Void,
	U8,
	I8,
	Char,
	Bool,
	U16,
	I16,
	Wchar,
	U32,
	I32,
	Dchar,
	F32,
	U64,
	I64,
	F64,
	Real,
	Pointer,
	Array,
	StaticArray,
	AA,
	Function,
	Delegate,
}

//! Information for a type that can be retrieved at runtime.
class TypeInfo
{
public:
	//! The size of the type, in bytes.
	size: size_t;
	//! The specific type. A member of the Type enum.
	type: i32;
	//! The Volt mangled name (if any)
	mangledName: char[];
	//! Can this type mutate memory?
	mutableIndirection: bool;
	//! The class init struct, if this points at a class.
	classInit: void*;
	//! The size of the class, if this points at a class.
	classSize: size_t;
	//! The base type for arrays (dynamic and static), and pointers.
	base: TypeInfo;
	//! If this points at a static array, how long is it?
	staticArrayLength: size_t;
	key: TypeInfo;
	//! The key and value types for AAs.
	value: TypeInfo;
	//! For functions and delegates, what's the return type?
	ret: TypeInfo;
	//! For functions and delegates, what are the parameter types?
	args: TypeInfo[];


public:
	this() { }
}

//! A TypeInfo used by classes.
class ClassInfo : TypeInfo
{
public:
	//! The interfaces the class this refers to implements.
	interfaces: InterfaceInfo[];


public:
	this() { }
}

//! Type information for interfaces.
class InterfaceInfo
{
public:
	//! The tinfo for the pointed at interface.
	info: TypeInfo;
	//! How many bytes after the vtable does the information for this
	//! interface lie?
	offset: size_t;


public:
	this() { }
}

core.varargs

module core.varargs;


//! Represents the list of arguments given to variadic functions.
alias va_list = void*;

//! Prepare a va_list for use.
fn va_start(vl: va_list);
//! Stop working with a va_list.
fn va_end(vl: va_list);

core.rt.gc

module core.rt.gc;


alias AllocDg = void* delegate(TypeInfo, size_t);

//! Stats structs for the GC, may change often so no API/ABI stability.
struct Stats
{
public:
	//! Counters, always available.
	struct Num
	{
	public:
		collections: u64;
		allocs: u64;
		allocBytes: u64;
		arrayAllocs: u64;
		arrayBytes: u64;
		classAllocs: u64;
		classBytes: u64;
		zeroAllocs: u64;
	}

	//! Slots stats, may not be set for all GCs.
	struct Slot
	{
	public:
		//! Memory in large extents.
		memLarge: u64;
		//! Memory cached in slabs.
		memCached: u64;
		//! Memory used in slabs.
		memUsed: u64;
		//! Total memory: used or cached.
		memTotal: u64;
		free: u32[16];
		used: u32[16];
	}


public:
	//! Counters.
	num: Num;
	//! Slots stats.
	slots: Slot;
}

local allocDg: AllocDg;

//! Initialise the GC.
fn vrt_gc_init();
//! Get an instance of the AllocDg delegate.
fn vrt_gc_get_alloc_dg() AllocDg;
//! Perform a collection.
fn vrt_gc_collect();
//! Shutdown the GC, call all destructors, free all memory.
fn vrt_gc_shutdown();
//! Fill out a given Stats struct.
fn vrt_gc_get_stats(stats: Stats) Stats*;
fn vrt_gc_print_stats();

core.rt.aa

module core.rt.aa;


//! Creates a new associative array.
fn vrt_aa_new(value: TypeInfo, key: TypeInfo) void*;
//! Copies an existing associative array.
fn vrt_aa_dup(rbtv: void*) void*;
//! Check if a primitive key is in an associative array.
fn vrt_aa_in_primitive(rbtv: void*, key: u64, ret: void*) bool;
//! Check if an array key is in an associative array.
fn vrt_aa_in_array(rbtv: void*, key: void[], ret: void*) bool;
//! Check if a pointer key is in an associative array.
fn vrt_aa_in_ptr(rbtv: void*, key: void*, ret: void*) bool;
//! Insert a value in a primitive keyed associative array.
fn vrt_aa_insert_primitive(rbtv: void*, key: u64, value: void*);
//! Insert a value in an array keyed associative array.
fn vrt_aa_insert_array(rbtv: void*, key: void[], value: void*);
//! Insert a value in a pointer keyed associative array.
fn vrt_aa_insert_ptr(rbtv: void*, key: void*, value: void*);
//! Delete a value associated with a primitive key.
fn vrt_aa_delete_primitive(rbtv: void*, key: u64) bool;
//! Delete a value associated with an array key.
fn vrt_aa_delete_array(rbtv: void*, key: void[]) bool;
//! Delete a value associate with a pointer key.
fn vrt_aa_delete_ptr(rbtv: void*, key: void*) bool;
//! Get the keys array for a given associative array.
fn vrt_aa_get_keys(rbtv: void*) void[];
//! Get the values array for a given associative array.
fn vrt_aa_get_values(rbtv: void*) void[];
//! Get the number of pairs in a given associative array.
fn vrt_aa_get_length(rbtv: void*) size_t;
//! The in operator for an array keyed associative array.
fn vrt_aa_in_binop_array(rbtv: void*, key: void[]) void*;
//! The in operator for a primitive keyed associative array.
fn vrt_aa_in_binop_primitive(rbtv: void*, key: u64) void*;
//! The in operator for a pointer keyed associative array.
fn vrt_aa_in_binop_ptr(rbtv: void*, key: void*) void*;
//! Rehash an associative array to optimise performance.
fn vrt_aa_rehash(rbtv: void*);
//! The get method for a pointer keyed associative array.
fn vrt_aa_get_ptr(rbtv: void*, key: void*, _default: void*) void*;
//! The get method for a primitive key, primitive value associative array.
fn vrt_aa_get_pp(rbtv: void*, key: u64, _default: u64) u64;
//! The get method for an array key, array value associative array.
fn vrt_aa_get_aa(rbtv: void*, key: void[], _default: void[]) void*;
//! The get method for an array key, primitive value associative array.
fn vrt_aa_get_ap(rbtv: void*, key: void[], _default: u64) u64;
//! The get method for a primitive key, array value associative array.
fn vrt_aa_get_pa(rbtv: void*, key: u64, _default: void[]) void*;

core.rt.misc

module core.rt.misc;


alias VMain = fn (string[]) (i32);

//! Perform a throw of the given Throwable object.
fn vrt_eh_throw(t: Throwable, location: string);
//! Throw an error for an invalid slice.
fn vrt_eh_throw_slice_error(location: string);
//! Throw an assert for an assert failure.
fn vrt_eh_throw_assert_error(location: string, msg: string);
//! Throw an AA key lookup failure error.
fn vrt_eh_throw_key_not_found_error(location: string);
//! The personality function makes stack unwinding work.
fn vrt_eh_personality_v0() i32;
//! Initialise the monotonic code.
fn vrt_monotonic_init();
//! Get the ticks count.
fn vrt_monotonic_ticks() i64;
//! Get the runtime's initial ticks value.
fn vrt_monotonic_ticks_at_init() i64;
//! Get how many ticks make up a second.
fn vrt_monotonic_ticks_per_second() i64;
fn vrt_panic(msg: scope (scope (const(scope (char)[])[]), location: scope (const(scope (char)[]));
//! Perform a runtime cast.
fn vrt_handle_cast(obj: void*, ti: TypeInfo) void*;
//! Get the hash for size bytes of data.
fn vrt_hash(data: void*, size: size_t) u32;
//! Perform a memcmp between size bytes of d1 and d2.
fn vrt_memcmp(d1: void*, d2: void*, size: size_t) i32;
//! Run global constructors for linked modules.
fn vrt_run_global_ctors() i32;
//! Run the given main function with the given arguments.
fn vrt_run_main(argc: i32, argv: char**, vMain: VMain) i32;
//! Run global destructors for linked modules.
fn vrt_run_global_dtors() i32;
//! Encode c as a string in buf.
fn vrt_encode_static_u8(buf: char[6], c: dchar) size_t;
//! Decode a single codepoint of str, starting from index.
fn vrt_decode_u8_d(str: string, index: size_t) dchar;
//! Decode a single codepoint of str, starting from index.
fn vrt_reverse_decode_u8_d(str: string, index: size_t) dchar;

core.rt.format

module core.rt.format;


alias SinkArg = scope (const(scope (char)[]);
alias Sink = scope (void delegate(scope (SinkArg)));
//! These are the sink store that the compiler uses for composable
//! strings.
alias SinkStore = SinkStore1024;
//! These are the sink store that the compiler uses for composable
//! strings.
alias vrt_sink_init = vrt_sink_init_1024;
//! Default implementation of SinkStore used by the compiler.
alias SinkStore1024 = void[1024];

//! Format a given u64 as a string, and pass it to sink.
fn vrt_format_u64(sink: scope (Sink), i: u64);
//! Format a given i64 as a string, and pass it to sink.
fn vrt_format_i64(sink: scope (Sink), i: i64);
//! Format a given f32 as a string, and pass it to sink.
fn vrt_format_f32(sink: scope (Sink), i: f32, width: i32);
//! Format a given f64 as a string, and pass it to sink.
fn vrt_format_f64(sink: scope (Sink), i: f64, width: i32);
//! Format a given integer as a hex string, and pass it to sink.
fn vrt_format_hex(sink: scope (Sink), i: u64, padding: size_t);
//! Format a given u64 and pass it to sink.
fn vrt_format_readable_size(sink: scope (Sink), size: u64);
//! Format a given dchar as a string (surrounded with ') and pass it to 
//! sink.
fn vrt_format_dchar(sink: scope (Sink), c: dchar);
//! Default implementation of SinkStore used by the compiler.
fn vrt_sink_init_1024(sink: SinkStore1024) scope (Sink);
//! Default implementation of SinkStore used by the compiler.
fn vrt_sink_getstr_1024(sink: SinkStore1024) string;

core.object

//! Root object for classes.
module core.object;


//! Root object for all classes.
class Object
{
public:
	this() { }
	fn toString() string { }
}

metal.gfx

module metal.gfx;


enum Width;
enum Height;
enum GlyphWidth;
enum GlyphHeight;

struct Info
{
public:
	w: u32;
	h: u32;
	pitch: u32;
	bytesPerPixel: u32;
	ptr: void*;
	pixelOffX: u32;
	pixelOffY: u32;
	x: u32;
	y: u32;
	loaded: bool;


public:
	fn installSink() { }
	fn sink(str: scope (const(scope (char)[])) { }
}

global info: Info;
global glyphData: immutable(u8)[2560];

fn putGlyph(x: u32, y: u32, glyph: u8) { }
fn clearLine(y: size_t, color: u32) { }

metal.drivers.serial

module metal.drivers.serial;


struct Serial
{
public:
	alias write = sink;


public:
	port: u16;


public:
	fn off(off: u16) u16 { }
	fn setup(port: u16) { }
	fn writeEmpty() bool { }
	fn sink(str: scope (const(scope (char)[])) { }
	fn write(a: char) { }
	fn writeln() { }
	fn writeln(str: scope (const(scope (char)[])) { }
}

global com1: Serial;

metal.drivers.bochs

module metal.drivers.bochs;


enum BGA_DISPI_IOPORT_INDEX;
enum BGA_DISPI_IOPORT_DATA;
enum BGA_DISPI_INDEX_ID;
enum BGA_DISPI_INDEX_XRES;
enum BGA_DISPI_INDEX_YRES;
enum BGA_DISPI_INDEX_BPP;
enum BGA_DISPI_INDEX_ENABLE;
enum BGA_DISPI_INDEX_BANK;
enum BGA_DISPI_INDEX_VIRT_WIDTH;
enum BGA_DISPI_INDEX_VIRT_HEIGHT;
enum BGA_DISPI_INDEX_X_OFFSET;
enum BGA_DISPI_INDEX_Y_OFFSET;
enum BGA_DISPI_INDEX_VIDEO_MEMORY_64K;
enum BGA_DISPI_ID0;
enum BGA_DISPI_ID1;
enum BGA_DISPI_ID2;
enum BGA_DISPI_ID3;
enum BGA_DISPI_ID4;
enum BGA_DISPI_ID5;
enum BGA_DISPI_DISABLED;
enum BGA_DISPI_ENABLED;
enum BGA_DISPI_GETCAPS;
enum BGA_DISPI_8BIT_DAC;
enum BGA_DISPI_LFB_ENABLED;
enum BGA_DISPI_NOCLEARMEM;

struct Bochs
{
public:
	ptr: void*;
	w: u16;
	h: u16;
	pitch: u16;
	bpp: u16;
	loaded: bool;
	pci: pci.Device*;
}

global dev: Bochs;

fn loadFromPCI(pciDev: pci.Device*) { }
fn readLayout(dev: Bochs*) { }
fn setLayout(dev: Bochs*, w: u16, h: u16, bpp: u16) { }
fn read(reg: u16) u16 { }
fn write(reg: u16, val: u16) { }

metal.pci

module metal.pci;


enum CapNames;

enum Offset
{
	VENDOR,
	DEVICE,
	CLASS,
	SUBCLASS,
	HEADER,
	SECONDARY_BUS,
	CAPABILITY_LIST,
}

enum CapId
{
	PM,
	AGP,
	VPD,
	SLOT_ID,
	MSI,
	CHSWP,
	PCIX,
	HT,
	VNDR,
	DBG,
	CCRC,
	SHPC,
	SSVID,
	AGP3,
	SECDEV,
	EXP,
	MSIX,
	SATA,
	AF,
	EA,
}

enum CapOffset
{
	LIST_ID,
	LIST_NEXT,
	FLAGS,
	SIZEOF,
}

struct Header
{
public:
	vendor: u16;
	device: u16;
	command: u16;
	status: u16;
	rev: u8;
	progIF: u8;
	subClass: u8;
	baseClass: u8;
	cacheLineSize: u8;
	latencyTimer: u8;
	headerType: u8;
	BIST: u8;
}

struct Device
{
public:
	bus: u8;
	slot: u8;
	func: u8;
	headerType: u8;
	vendor: u16;
	device: u16;
	rev: u8;
	progIF: u8;
	subClass: u8;
	baseClass: u8;
	cap: u32;
}

struct Info
{
public:
	devs: Device[256];
	num: u32;
}

global info: Info;

fn loadDevice(dev: Device*) { }
fn isValidDevice(bus: u8, slot: u8, func: u8) bool { }
fn checkFunction(bus: u8, slot: u8, func: u8) { }
fn checkDevice(bus: u8, slot: u8) { }
fn checkBus(bus: u8) { }
fn checkAllBuses() { }
fn readHeader(bus: u8, slot: u8, func: u8, h: Header) { }
fn readU32(bus: u8, slot: u8, func: u8, offset: u8) u32 { }
fn readU16(bus: u8, slot: u8, func: u8, offset: u8) u16 { }
fn readU8(bus: u8, slot: u8, func: u8, offset: u8) u8 { }
fn dumpDevices() { }

metal.boot.multiboot1

module metal.boot.multiboot1;


enum MAGIC;

struct Info
{
public:
	enum Flags
	{
		Mem,
		BootDevice,
		CmdLine,
		Mmap,
	}


public:
	flags: Flags;
	mem_lower: u32;
	mem_upper: u32;
	boot_device: u32;
	cmdline: u32;
	mods_count: u32;
	mods_addr: u32;
	syms0: u32;
	syms1: u32;
	syms2: u32;
	syms3: u32;
	mmap_length: u32;
	mmap_addr: u32;
	drivers_length: u32;
	drivers_addr: u32;
	config_table: u32;
	boot_loder_name: u32;
	apm_table: u32;
	vbe_control_info: u32;
	vbe_mode_info: u32;
	vbe_mode: u32;
	vbe_interface_seg: u32;
	vbe_interace_len: u32;
}

metal.boot.multiboot2

module metal.boot.multiboot2;


enum MAGIC;

enum TagType
{
	END,
	CMDLINE,
	BOOT_LOADER_NAME,
	MODULE,
	BASIC_MEMINFO,
	BOOTDEV,
	MMAP,
	VBE,
	FRAMEBUFFER,
	ELF_SECTIONS,
	APM,
	EFI32,
	EFI64,
	SMBIOS,
	ACPI_OLD,
	ACPI_NEW,
	NETWORK,
	EFI_MMAP,
	EFI_BS,
}

enum Memory
{
	AVAILABLE,
	RESERVED,
	ACPI_RECLAIMABLE,
	NVS,
	BADRAM,
}

enum FramebufferType
{
	INDEXED,
	RGB,
	VGA,
}

struct Info
{
public:
	total_size: u32;
	reserved: u32;
}

struct Tag
{
public:
	type: TagType;
	size: u32;
}

struct TagMmap
{
public:
	type: TagType;
	size: u32;
	entry_size: u32;
	entry_version: u32;
}

struct MmapEntry
{
public:
	base_addr: u64;
	length: u64;
	type: Memory;
	zero: u32;
}

struct TagFramebuffer
{
public:
	type: TagType;
	size: u32;
	framebuffer_addr: u64;
	framebuffer_pitch: u32;
	framebuffer_width: u32;
	framebuffer_height: u32;
	framebuffer_bpp: u8;
	framebuffer_type: u8;
	reserved: u8;
}

struct TagEFI32
{
public:
	type: TagType;
	size: u32;
	pointer: u32;
}

struct TagEFI64
{
public:
	type: TagType;
	size: u32;
	pointer: u64;
}

struct TagOldACPI
{
public:
	type: TagType;
	size: u32;


public:
	fn rsdp() RSDPDescriptor* { }
}

struct TagNewACPI
{
public:
	type: TagType;
	size: u32;


public:
	fn rsdp() RSDPDescriptor20* { }
}

struct TagEFIMMAP
{
public:
	type: TagType;
	size: u32;
	descr_size: u32;
	descr_vers: u32;


public:
	fn mmap() void* { }
}

global tagNames: immutable(immutable(string)[20]);

fn dump(magic: u32, info: Info*) { }

metal.stdc

module metal.stdc;


fn memcpy(dst: void*, src: const(void)*, n: size_t) void* { }
fn memmove(dst: void*, src: const(void)*, n: size_t) void* { }
fn memcmp(ptr1: const(void)*, ptr2: const(void)*, n: size_t) i32 { }
fn memset(ptr: void*, val: const(i32), n: size_t) void* { }

metal.printer

module metal.printer;


alias Sink = void delegate(scope (const(scope (char)[]));

struct Ring
{
public:
	buf: char[10258];
	sinks: Sink[4];
	writePos: u32;
	numSinks: u32;


public:
	fn put(str: scope (const(scope (char)[])) { }
	fn addSink(sink: Sink) { }
	fn print(sink: Sink) { }
}

global ring: Ring;

fn valToHex(v: u64) char { }
fn write(a: scope (const(scope (char)[])) { }
fn writeln() { }
fn writeln(a: scope (const(scope (char)[])) { }
fn writeHex(v: u8) { }
fn writeHex(v: u16) { }
fn writeHex(hex: u32) { }
fn writeHex(hex: u64) { }

metal.vrt

module metal.vrt;


fn vrt_hash(ptr: void*, length: size_t) u32 { }

metal.e820

module metal.e820;


struct Map
{
public:
	entries: Entry[128];
	num: size_t;
}

struct Entry
{
public:
	address: u64;
	size: u64;
	type: u64;
}

global map: Map;

fn fromMultiboot1(info: mb1.Info*) { }
fn fromMultiboot2(mmap: mb2.TagMmap*) { }
fn dumpMap() { }

metal.acpi

module metal.acpi;


struct RSDPDescriptor
{
public:
	signature: char[8];
	checksum: u8;
	OEMID: char[6];
	revision: u8;
	rsdtAddress: u32;
}

struct RSDPDescriptor20
{
public:
	v1: RSDPDescriptor;
	length: u32;
	xsdtAddress: u64;
	extendedChecksum: u8;
	reserved: u8[3];
}

struct Header
{
public:
	signature: char[4];
	length: u32;
	revision: u8;
	checksum: u8;
	OEMID: char[6];
	OEMTableID: char[6];
	OEMRevision: u32;
	creatorID: u32;
	creatorRevision: u32;
}

struct RSDT
{
public:
	h: Header;


public:
	fn length() size_t { }
	fn ptr() u32* { }
	fn array() u32[] { }
}

struct XSDT
{
public:
	h: Header;


public:
	fn length() size_t { }
	fn ptr() u64* { }
	fn array() u64[] { }
}

fn findX86(rsdt: RSDT*, xsdt: XSDT*) { }
fn dump(h: Header*) { }

metal.hal.pc

module metal.hal.pc;


struct Hal
{
public:
	rsdt: acpi.RSDT*;
	xsdt: acpi.XSDT*;
	multibootMagic: u32;
	multibootInfo: mb2.Info*;
	lAPIC: lAPICInfo;
	ioAPICnum: u32;
	ioAPIC: ioAPICInfo[4];
}

global hal: Hal;

fn halInit(magic: u32, ptr: void*) { }
fn initAPIC() { }
fn maskIOAPIC(ioAPIC: ioAPICInfo) { }
fn testAPIC(state: IrqState*, vector: u64, void*) { }
fn parseMultiboot(magic: u32, ptr: void*) { }
fn parseMultiboot1(info: mb1.Info*) { }
fn parseMultiboot2(info: mb2.Info*) { }
fn parseACPI() { }
fn parseMADT(mdat: acpi.Header*) { }

metal.hal.apic

module metal.hal.apic;


struct lAPICInfo
{
public:
	address: u32;
	hasPCAT: bool;
}

struct ioAPICInfo
{
public:
	address: u32;
	gsiBase: u32;
}

fn ioAPICWrite(apic_base: const(size_t), offset: const(u8), val: const(u32)) { }
fn ioAPICRead(apic_base: const(size_t), offset: const(u8)) u32 { }

metal.hal

module metal.hal;

public import metal.hal.pc;

metal.main

module metal.main;


fn metal_main(magic: u32, multibootInfo: void*) { }