From 98abe576a812c5a1710dd6d6f1680042bd1296d6 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Sun, 8 Nov 2026 01:56:58 +0800 Subject: [mubios] Building a 32-bit C entry in protected mode Signed-off-by: Richard Qin --- mubios/arch/mode_switch.S | 4 ++++ mubios/core/post.c | 26 ++++++++++++++++++++++++++ mubios/include/bios.h | 27 +++++++++++++++++++++++++++ mubios/linker.ld | 1 + 4 files changed, 58 insertions(+) create mode 100644 mubios/core/post.c create mode 100644 mubios/include/bios.h (limited to 'mubios') diff --git a/mubios/arch/mode_switch.S b/mubios/arch/mode_switch.S index 17fbe72..f114870 100644 --- a/mubios/arch/mode_switch.S +++ b/mubios/arch/mode_switch.S @@ -22,6 +22,8 @@ .section .text16, "ax" + .extern post_main + .global enter_protected_mode .type enter_protected_mode, @function @@ -101,6 +103,8 @@ protected_mode_entry: mov esp, 0x00008000 + call post_main + protected_mode_halt: hlt jmp protected_mode_halt diff --git a/mubios/core/post.c b/mubios/core/post.c new file mode 100644 index 0000000..d8ae85c --- /dev/null +++ b/mubios/core/post.c @@ -0,0 +1,26 @@ +/* + RCC-Project + + Copyright (C) 2026 Richard Qin + + This file is part of RCC-Project. + + RCC-Project is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your option) any + later version. + + RCC-Project is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + RCC-Project; see the file COPYING. If not see + . + */ + +#include "bios.h" + +void post_main(void) +{ +} diff --git a/mubios/include/bios.h b/mubios/include/bios.h new file mode 100644 index 0000000..1f51244 --- /dev/null +++ b/mubios/include/bios.h @@ -0,0 +1,27 @@ +/* + RCC-Project + + Copyright (C) 2026 Richard Qin + + This file is part of RCC-Project. + + RCC-Project is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your option) any + later version. + + RCC-Project is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + RCC-Project; see the file COPYING. If not see + . + */ + +#ifndef MUBIOS_BIOS_H +#define MUBIOS_BIOS_H + +void post_main(void); + +#endif // MUBIOS_BIOS_H diff --git a/mubios/linker.ld b/mubios/linker.ld index 003c29b..85545d3 100644 --- a/mubios/linker.ld +++ b/mubios/linker.ld @@ -44,6 +44,7 @@ SECTIONS .text32 : { *(.text32 .text32.*) + *(.text .text.*) } > ROM . = ALIGN(4); -- cgit v1.2.3