summaryrefslogtreecommitdiff
path: root/src/init
diff options
context:
space:
mode:
Diffstat (limited to 'src/init')
-rw-r--r--src/init/linker.ld24
-rw-r--r--src/init/main.c10
2 files changed, 34 insertions, 0 deletions
diff --git a/src/init/linker.ld b/src/init/linker.ld
new file mode 100644
index 0000000..9f3f4b5
--- /dev/null
+++ b/src/init/linker.ld
@@ -0,0 +1,24 @@
+ENTRY(main)
+OUTPUT_FORMAT("binary")
+
+SECTIONS
+{
+ . = 2M;
+ .text BLOCK(4K) : ALIGN(4K)
+ {
+ *(.text)
+ }
+ .rodata BLOCK(4K) : ALIGN(4K)
+ {
+ *(.rodata)
+ }
+ .data BLOCK(4K) : ALIGN(4K)
+ {
+ *(.data)
+ }
+ .bss BLOCK(4K) : ALIGN(4K)
+ {
+ *(COMMON)
+ *(.bss)
+ }
+}
diff --git a/src/init/main.c b/src/init/main.c
new file mode 100644
index 0000000..e6188ac
--- /dev/null
+++ b/src/init/main.c
@@ -0,0 +1,10 @@
+#include <stdint.h>
+
+int main() {
+ // change the colors of VGA text
+ // doesn't require a lot of code, but still shows that it's working
+ uint8_t *vga = (void*) 0xB8000;
+ for (int i = 0; i < 80 * 25; i++)
+ vga[(i << 1) + 1] = 0x4e;
+ for (;;);
+}