Compare commits

...

5 commits

Author SHA1 Message Date
Michael Mikonos
2c2bcd672e
Merge 8f29039141 into a95d5559de 2024-11-21 12:54:11 +00:00
Gunch
a95d5559de
Merge pull request #164 from Zeal-Operating-System/zealbooter-updates
Some checks failed
Build ZealOS ISOs / Build (push) Has been cancelled
Update Zealbooter build system from Limine template
2024-10-04 02:21:08 -04:00
mintsuki
5bd76304ec Update Zealbooter build system from Limine template 2024-09-30 20:07:33 +02:00
Arsenic Blood
8f29039141
Merge branch 'master' into fault2_sav2 2024-03-07 00:00:00 -05:00
Michael Mikonos
19c082984c save and restore text.raw_flags conditionally 2023-11-01 15:02:50 +08:00
3 changed files with 34 additions and 31 deletions

View file

@ -711,7 +711,7 @@ U0 Fault2(I64 fault_num, I64 fault_err_code)
{//Called from $LK,"Fault2",A="FF:::/Kernel/KInterrupts.ZC,Fault2"$. {//Called from $LK,"Fault2",A="FF:::/Kernel/KInterrupts.ZC,Fault2"$.
//$BK,1$Be careful not to swap-out and ruin the saved context$BK,0$ //$BK,1$Be careful not to swap-out and ruin the saved context$BK,0$
Bool was_raw, was_single_user, was_silent, was_in_debug, was_mouse_enabled; Bool was_raw, was_single_user, was_silent, was_in_debug, was_mouse_enabled;
I64 i, old_raw_flags = text.raw_flags; I64 i, old_raw_flags;
was_single_user = SingleUser(ON); was_single_user = SingleUser(ON);
if (!IsDebugMode) if (!IsDebugMode)
@ -723,6 +723,7 @@ U0 Fault2(I64 fault_num, I64 fault_err_code)
CallExtNum(EXT_DEBUG_RESUME, fault_num, fault_err_code); CallExtNum(EXT_DEBUG_RESUME, fault_num, fault_err_code);
else else
{ {
old_raw_flags = text.raw_flags;
was_mouse_enabled = CallExtStr("MouseHardEnable", FALSE); was_mouse_enabled = CallExtStr("MouseHardEnable", FALSE);
was_raw = Raw(ON); was_raw = Raw(ON);
was_silent = Silent(OFF); was_silent = Silent(OFF);

View file

@ -1,43 +1,40 @@
# Nuke built-in rules and variables. # Nuke built-in rules and variables.
override MAKEFLAGS += -rR MAKEFLAGS += -rR
.SUFFIXES:
# This is the name that our final executable will have. # This is the name that our final executable will have.
# Change as needed. # Change as needed.
override OUTPUT := kernel override OUTPUT := kernel
# Convenience macro to reliably declare user overridable variables. # Convenience macro to reliably declare user overridable variables.
define DEFAULT_VAR = override USER_VARIABLE = $(if $(filter $(origin $(1)),default undefined),$(eval override $(1) := $(2)))
ifeq ($(origin $1),default)
override $(1) := $(2)
endif
ifeq ($(origin $1),undefined)
override $(1) := $(2)
endif
endef
# User controllable C compiler command. # User controllable C compiler command.
override DEFAULT_KCC := cc $(call USER_VARIABLE,KCC,cc)
$(eval $(call DEFAULT_VAR,KCC,$(DEFAULT_KCC)))
# User controllable linker command. # User controllable linker command.
override DEFAULT_KLD := ld $(call USER_VARIABLE,KLD,ld)
$(eval $(call DEFAULT_VAR,KLD,$(DEFAULT_KLD)))
# User controllable C flags. # User controllable C flags.
override DEFAULT_KCFLAGS := -g -O2 -pipe $(call USER_VARIABLE,KCFLAGS,-g -O2 -pipe)
$(eval $(call DEFAULT_VAR,KCFLAGS,$(DEFAULT_KCFLAGS)))
# User controllable C preprocessor flags. We set none by default. # User controllable C preprocessor flags. We set none by default.
override DEFAULT_KCPPFLAGS := $(call USER_VARIABLE,KCPPFLAGS,)
$(eval $(call DEFAULT_VAR,KCPPFLAGS,$(DEFAULT_KCPPFLAGS)))
# User controllable nasm flags. # User controllable nasm flags.
override DEFAULT_KNASMFLAGS := -F dwarf -g $(call USER_VARIABLE,KNASMFLAGS,-F dwarf -g)
$(eval $(call DEFAULT_VAR,KNASMFLAGS,$(DEFAULT_KNASMFLAGS)))
# User controllable linker flags. We set none by default. # User controllable linker flags. We set none by default.
override DEFAULT_KLDFLAGS := $(call USER_VARIABLE,KLDFLAGS,)
$(eval $(call DEFAULT_VAR,KLDFLAGS,$(DEFAULT_KLDFLAGS)))
# Check if KCC is Clang.
override KCC_IS_CLANG := $(shell ! $(KCC) --version 2>/dev/null | grep 'clang' >/dev/null 2>&1; echo $$?)
# If the C compiler is Clang, set the target as needed.
ifeq ($(KCC_IS_CLANG),1)
override KCC += \
-target x86_64-unknown-none
endif
# Internal C flags that should not be changed by the user. # Internal C flags that should not be changed by the user.
override KCFLAGS += \ override KCFLAGS += \

View file

@ -9,9 +9,10 @@ ENTRY(kmain)
/* process. */ /* process. */
PHDRS PHDRS
{ {
text PT_LOAD; requests PT_LOAD;
rodata PT_LOAD; text PT_LOAD;
data PT_LOAD; rodata PT_LOAD;
data PT_LOAD;
} }
SECTIONS SECTIONS
@ -22,6 +23,16 @@ SECTIONS
/* that is the beginning of the region. */ /* that is the beginning of the region. */
. = 0xffffffff80000000; . = 0xffffffff80000000;
/* Define a section to contain the Limine requests and assign it to its own PHDR */
.requests : {
KEEP(*(.requests_start_marker))
KEEP(*(.requests))
KEEP(*(.requests_end_marker))
} :requests
/* Move to the next memory page for .text */
. = ALIGN(CONSTANT(MAXPAGESIZE));
.text : { .text : {
*(.text .text.*) *(.text .text.*)
} :text } :text
@ -38,12 +49,6 @@ SECTIONS
.data : { .data : {
*(.data .data.*) *(.data .data.*)
/* Place the sections that contain the Limine requests as part of the .data */
/* output section. */
KEEP(*(.requests_start_marker))
KEEP(*(.requests))
KEEP(*(.requests_end_marker))
} :data } :data
/* NOTE: .bss needs to be the last thing mapped to :data, otherwise lots of */ /* NOTE: .bss needs to be the last thing mapped to :data, otherwise lots of */