From 31d801c5f244dcafdb0f6173a003789a31f55919 Mon Sep 17 00:00:00 2001 From: Tulio A M Mendes Date: Thu, 5 Feb 2026 16:41:17 -0300 Subject: [PATCH] arch/mips: add minimal boot and linker script --- src/arch/mips/boot.S | 44 +++++++++++++++++++++++++++++++++++++++++ src/arch/mips/linker.ld | 41 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 src/arch/mips/boot.S create mode 100644 src/arch/mips/linker.ld diff --git a/src/arch/mips/boot.S b/src/arch/mips/boot.S new file mode 100644 index 00000000..cf56a3a2 --- /dev/null +++ b/src/arch/mips/boot.S @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: BSD-3-Clause +/* + * Copyright (c) 2018, Tulio A M Mendes + * All rights reserved. + * See LICENSE for details. + * + * Source: https://github.com/tadryanom/AdrOS + */ + +/* + * 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 index 00000000..613fc4fc --- /dev/null +++ b/src/arch/mips/linker.ld @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * Copyright (c) 2018, Tulio A M Mendes + * All rights reserved. + * See LICENSE for details. + * + * Source: https://github.com/tadryanom/AdrOS + */ + +/* + * 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 = .; +} -- 2.43.0