]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commitdiff
arch/mips: add minimal boot and linker script
authorTulio A M Mendes <[email protected]>
Thu, 5 Feb 2026 19:41:17 +0000 (16:41 -0300)
committerTulio A M Mendes <[email protected]>
Thu, 5 Feb 2026 19:41:17 +0000 (16:41 -0300)
src/arch/mips/boot.S [new file with mode: 0644]
src/arch/mips/linker.ld [new file with mode: 0644]

diff --git a/src/arch/mips/boot.S b/src/arch/mips/boot.S
new file mode 100644 (file)
index 0000000..ef79e42
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * AdrOS - MIPS32 Bootstrap
+ * Minimal entry point that sets up a stack and calls kernel_main.
+ */
+
+    .set noreorder
+    .set noat
+
+    .section .text
+    .globl _start
+    .ent _start
+
+_start:
+    la   $sp, stack_top
+
+    /* kernel_main(unsigned long magic, unsigned long addr)
+     * For now, pass 0, 0 (no multiboot on MIPS)
+     */
+    move $a0, $zero
+    move $a1, $zero
+
+    jal  kernel_main
+    nop
+
+1:
+    j    1b
+    nop
+
+    .end _start
+
+    .section .bss
+    .align 16
+stack_bottom:
+    .space 16384
+stack_top:
diff --git a/src/arch/mips/linker.ld b/src/arch/mips/linker.ld
new file mode 100644 (file)
index 0000000..babb9cc
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * AdrOS - MIPS32 Linker Script
+ * Target: QEMU malta (RAM typically starts at 0x80000000, KSEG0)
+ */
+
+ENTRY(_start)
+
+SECTIONS
+{
+    . = 0x80000000;
+
+    _start = .;
+
+    .text : {
+        *(.text)
+    }
+
+    .rodata : {
+        *(.rodata)
+    }
+
+    .data : {
+        *(.data)
+    }
+
+    .bss : {
+        *(.bss)
+        *(COMMON)
+    }
+
+    _end = .;
+}