From 9ec38e06c71c3eb3fad0f768ab2a148e5d371d01 Mon Sep 17 00:00:00 2001 From: Tulio A M Mendes Date: Sat, 7 Feb 2026 12:50:34 -0300 Subject: [PATCH] refactor: rename arch_start to arch_early_setup --- README.md | 2 +- include/arch/arch_early_setup.h | 8 ++++++++ include/arch/arch_start.h | 8 -------- src/arch/arm/{arch_start.c => arch_early_setup.c} | 4 ++-- src/arch/arm/boot.S | 4 ++-- src/arch/mips/{arch_start.c => arch_early_setup.c} | 4 ++-- src/arch/mips/boot.S | 4 ++-- src/arch/riscv/{arch_start.c => arch_early_setup.c} | 4 ++-- src/arch/riscv/boot.S | 4 ++-- src/arch/x86/{arch_start.c => arch_early_setup.c} | 4 ++-- src/arch/x86/boot.S | 6 +++--- 11 files changed, 26 insertions(+), 26 deletions(-) create mode 100644 include/arch/arch_early_setup.h delete mode 100644 include/arch/arch_start.h rename src/arch/arm/{arch_start.c => arch_early_setup.c} (81%) rename src/arch/mips/{arch_start.c => arch_early_setup.c} (81%) rename src/arch/riscv/{arch_start.c => arch_early_setup.c} (81%) rename src/arch/x86/{arch_start.c => arch_early_setup.c} (96%) diff --git a/README.md b/README.md index 018a03e..f7ab93e 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ QEMU debug helpers: ## TODO - **Multi-architecture kernel bring-up** - Implement VMM/interrupts/scheduler for ARM/RISC-V/MIPS - - Standardize arch entrypoint behavior (`arch_start`) across architectures + - Standardize arch entrypoint behavior (`arch_early_setup`) across architectures - **Userspace** - Process model (fork/exec/wait), per-process address spaces, and cleanup on `exit` - Syscall ABI expansion (read/open/close, file descriptors, etc.) diff --git a/include/arch/arch_early_setup.h b/include/arch/arch_early_setup.h new file mode 100644 index 0000000..17dfb77 --- /dev/null +++ b/include/arch/arch_early_setup.h @@ -0,0 +1,8 @@ + #ifndef ARCH_EARLY_SETUP_H + #define ARCH_EARLY_SETUP_H + + #include "arch/arch_boot_args.h" + + void arch_early_setup(const struct arch_boot_args* args); + + #endif diff --git a/include/arch/arch_start.h b/include/arch/arch_start.h deleted file mode 100644 index 10616da..0000000 --- a/include/arch/arch_start.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef ARCH_START_H -#define ARCH_START_H - -#include "arch/arch_boot_args.h" - -void arch_start(const struct arch_boot_args* args); - -#endif diff --git a/src/arch/arm/arch_start.c b/src/arch/arm/arch_early_setup.c similarity index 81% rename from src/arch/arm/arch_start.c rename to src/arch/arm/arch_early_setup.c index 3ecafa8..6db98ca 100644 --- a/src/arch/arm/arch_start.c +++ b/src/arch/arm/arch_early_setup.c @@ -1,11 +1,11 @@ -#include "arch/arch_start.h" + #include "arch/arch_early_setup.h" #include "kernel/boot_info.h" #include "uart_console.h" extern void kernel_main(const struct boot_info* bi); -void arch_start(const struct arch_boot_args* args) { + void arch_early_setup(const struct arch_boot_args* args) { (void)args; uart_init(); diff --git a/src/arch/arm/boot.S b/src/arch/arm/boot.S index e09d8fb..e2f04da 100644 --- a/src/arch/arm/boot.S +++ b/src/arch/arm/boot.S @@ -17,9 +17,9 @@ _start: ldr x0, =stack_top mov sp, x0 - /* Build arch_boot_args (in .bss) and call arch_start(args) */ + /* Build arch_boot_args (in .bss) and call arch_early_setup(args) */ ldr x0, =arch_boot_args - bl arch_start + bl arch_early_setup /* Hang */ 1: wfi diff --git a/src/arch/mips/arch_start.c b/src/arch/mips/arch_early_setup.c similarity index 81% rename from src/arch/mips/arch_start.c rename to src/arch/mips/arch_early_setup.c index a938356..441a432 100644 --- a/src/arch/mips/arch_start.c +++ b/src/arch/mips/arch_early_setup.c @@ -1,11 +1,11 @@ -#include "arch/arch_start.h" + #include "arch/arch_early_setup.h" #include "kernel/boot_info.h" #include "uart_console.h" extern void kernel_main(const struct boot_info* bi); -void arch_start(const struct arch_boot_args* args) { + void arch_early_setup(const struct arch_boot_args* args) { (void)args; uart_init(); diff --git a/src/arch/mips/boot.S b/src/arch/mips/boot.S index 50addc7..45cbe4c 100644 --- a/src/arch/mips/boot.S +++ b/src/arch/mips/boot.S @@ -13,14 +13,14 @@ _start: la $sp, stack_top - /* Build arch_boot_args (in .bss) and call arch_start(args) */ + /* Build arch_boot_args (in .bss) and call arch_early_setup(args) */ la $a0, arch_boot_args sw $zero, 0($a0) sw $zero, 4($a0) sw $zero, 8($a0) sw $zero, 12($a0) - jal arch_start + jal arch_early_setup nop 1: diff --git a/src/arch/riscv/arch_start.c b/src/arch/riscv/arch_early_setup.c similarity index 81% rename from src/arch/riscv/arch_start.c rename to src/arch/riscv/arch_early_setup.c index 3ecafa8..6db98ca 100644 --- a/src/arch/riscv/arch_start.c +++ b/src/arch/riscv/arch_early_setup.c @@ -1,11 +1,11 @@ -#include "arch/arch_start.h" + #include "arch/arch_early_setup.h" #include "kernel/boot_info.h" #include "uart_console.h" extern void kernel_main(const struct boot_info* bi); -void arch_start(const struct arch_boot_args* args) { + void arch_early_setup(const struct arch_boot_args* args) { (void)args; uart_init(); diff --git a/src/arch/riscv/boot.S b/src/arch/riscv/boot.S index 0ce1755..8f6bd24 100644 --- a/src/arch/riscv/boot.S +++ b/src/arch/riscv/boot.S @@ -15,9 +15,9 @@ _start: */ la sp, stack_top - /* Build arch_boot_args (in .bss) and call arch_start(args) */ + /* Build arch_boot_args (in .bss) and call arch_early_setup(args) */ la a0, arch_boot_args - call arch_start + call arch_early_setup /* Hang if return */ 1: wfi diff --git a/src/arch/x86/arch_start.c b/src/arch/x86/arch_early_setup.c similarity index 96% rename from src/arch/x86/arch_start.c rename to src/arch/x86/arch_early_setup.c index 5c745fd..10eae7a 100644 --- a/src/arch/x86/arch_start.c +++ b/src/arch/x86/arch_early_setup.c @@ -1,4 +1,4 @@ -#include "arch/arch_start.h" + #include "arch/arch_early_setup.h" #include "kernel/boot_info.h" @@ -13,7 +13,7 @@ extern void kernel_main(const struct boot_info* bi); static uint8_t multiboot_copy[65536]; static uint32_t multiboot_copy_size; -void arch_start(const struct arch_boot_args* args) { + void arch_early_setup(const struct arch_boot_args* args) { uart_init(); uart_print("\n[AdrOS] Booting...\n"); diff --git a/src/arch/x86/boot.S b/src/arch/x86/boot.S index f8aa345..f7db75a 100644 --- a/src/arch/x86/boot.S +++ b/src/arch/x86/boot.S @@ -62,7 +62,7 @@ _start: /* * Map 0-16MB using 4 page tables. - * With Multiboot2 info copied in arch_start and initrd mapped via VMM, + * With Multiboot2 info copied in arch_early_setup and initrd mapped via VMM, * we only need a small identity window for early bring-up. */ @@ -153,7 +153,7 @@ higher_half_start: pop %ebx /* EBX now has the Multiboot Info address */ pop %eax /* EAX now has the Magic Number */ - /* Build arch_boot_args (in .bss) and call arch_start(args) */ + /* Build arch_boot_args (in .bss) and call arch_early_setup(args) */ mov $arch_boot_args, %ecx mov %eax, 0(%ecx) /* args->a0 = multiboot magic */ mov %ebx, 4(%ecx) /* args->a1 = multiboot info phys */ @@ -161,7 +161,7 @@ higher_half_start: movl $0, 12(%ecx) /* args->a3 = 0 */ push %ecx - call arch_start + call arch_early_setup add $4, %esp /* Hang */ -- 2.43.0