{.link: "../boot.o".} {.passL: "-ffreestanding -target i386 -nostdlib -T arch/i386/linker.ld".} {.passC: "-ffreestanding -nostdlib --target=i386-pc-none-elf -march=i386".} import tty, gdt, interrupts, serial, multiboot, paging const version {.strdefine.} = "UNKNOWN" type MemoryPointer{.unchecked.} = ptr array[0, char] proc memcpy*(dest: ByteAddress, src: ByteAddress, count: int){.exportc.} = var destMem = cast[MemoryPointer](dest) var srcMem = cast[MemoryPointer](src) for i in 0..count-1: destMem[i] = srcMem[i] proc memset*(dest: ByteAddress, value: char, count: int){.exportc.} = var destMem = cast[MemoryPointer](dest) for i in 0..count-1: destMem[i] = value proc getMemoryMap(mbd: multiboot_info) = discard # Use this if we need to do anything with the GRUB memory map proc kernelMain(mbd: multiboot_info, magic: uint) {.exportc: "kernel_main"}= #proc kernelMain() {.exportc: "kernel_main"}= getMemoryMap(mbd) paging.init() serial.init() serial.writeLine("Version:" & (version)) serial.writeLine("Booting OS") gdt.gdtInstall() serial.writeLine("GDT installed") interrupts.idtInstall() serial.writeLine("IDT installed") tty.init() serial.writeLine("TTY initialised") tty.writeLine("Version:" & version) tty.writeLine("Hello World!") tty.write("MAX_INT:") tty.writeLine(high(int)) tty.write("MIN_INT:") tty.writeLine((low(int)+1)) tty.write("MAX_UINT:") tty.writeLine(high(uint32)) asm """int $0x3"""