972
edits
[unchecked revision] | [unchecked revision] |
(Fix D Bare bones: you can't pass non-standard arguments to void main()) |
m (Bot: Replace deprecated source tag with syntaxhighlight) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 20:
==start.asm==
<
global start
Line 81:
resb STACKSIZE
</syntaxhighlight>
Assemble that with:
<
==kernel.main.d==
<
module kernel.main;
import core.
extern(C) void kmain(uint magic, uint addr) {
Line 107:
}
}
</syntaxhighlight>
You then compile that with:
<
==linker.ld==
<
OUTPUT_FORMAT(elf32-i386)
ENTRY (start)
Line 147:
end = .; _end = .; __end = .;
}
</syntaxhighlight>
Now finally you can link all of that with:
<
Your kernel is now kernel.bin, and can now be booted by grub, or run in qemu:
<
Note the "-fno-druntime" argument above. This is how gdc spells the -betterC flag from other D compilers, and the "Better C" page of the D language reference explains how this limits the language. If you want to drop that you'll have to add the D runtime to your kernel.
|