Compare commits

...

4 commits

Author SHA1 Message Date
tinkeros
0041534260
Merge 933a3f0ad7 into a95d5559de 2024-10-08 11:49:03 -05: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
tinkeros
933a3f0ad7 Fix compiler bug
Test case:
I64 Bug(I64 x)
{
  x&=~1;
  return x;
}

Bug(-200) should produce -200, but doesn't without this fix.
2024-08-08 10:43:15 -05:00
3 changed files with 33 additions and 40 deletions

View file

@ -170,16 +170,6 @@ in int<-->F64 conversions of function args.
tmpi->ic_flags |= ICF_USE_F64;
break;
case IC_COM:
if (tmpi1->ic_code == IC_IMM_I64)
{
tmpi->ic_data = ~tmpi1->ic_data;
tmpi->ic_code = IC_IMM_I64;
tmpi->ic_flags |= tmpi1->ic_flags;
OptSetNOP1(tmpi1);
}
tmpi_push->ic_class2 = cmp.internal_types[RT_I64];
break;
start:
case IC_NOT:
if (tmpc->raw_type == RT_F64)
@ -1533,6 +1523,7 @@ in int<-->F64 conversions of function args.
case IC_NOBOUND_SWITCH:
case IC_SWITCH:
case IC_ASM:
case IC_COM:
break;
default:

View file

@ -1,43 +1,40 @@
# Nuke built-in rules and variables.
override MAKEFLAGS += -rR
MAKEFLAGS += -rR
.SUFFIXES:
# This is the name that our final executable will have.
# Change as needed.
override OUTPUT := kernel
# Convenience macro to reliably declare user overridable variables.
define DEFAULT_VAR =
ifeq ($(origin $1),default)
override $(1) := $(2)
endif
ifeq ($(origin $1),undefined)
override $(1) := $(2)
endif
endef
override USER_VARIABLE = $(if $(filter $(origin $(1)),default undefined),$(eval override $(1) := $(2)))
# User controllable C compiler command.
override DEFAULT_KCC := cc
$(eval $(call DEFAULT_VAR,KCC,$(DEFAULT_KCC)))
$(call USER_VARIABLE,KCC,cc)
# User controllable linker command.
override DEFAULT_KLD := ld
$(eval $(call DEFAULT_VAR,KLD,$(DEFAULT_KLD)))
$(call USER_VARIABLE,KLD,ld)
# User controllable C flags.
override DEFAULT_KCFLAGS := -g -O2 -pipe
$(eval $(call DEFAULT_VAR,KCFLAGS,$(DEFAULT_KCFLAGS)))
$(call USER_VARIABLE,KCFLAGS,-g -O2 -pipe)
# User controllable C preprocessor flags. We set none by default.
override DEFAULT_KCPPFLAGS :=
$(eval $(call DEFAULT_VAR,KCPPFLAGS,$(DEFAULT_KCPPFLAGS)))
$(call USER_VARIABLE,KCPPFLAGS,)
# User controllable nasm flags.
override DEFAULT_KNASMFLAGS := -F dwarf -g
$(eval $(call DEFAULT_VAR,KNASMFLAGS,$(DEFAULT_KNASMFLAGS)))
$(call USER_VARIABLE,KNASMFLAGS,-F dwarf -g)
# User controllable linker flags. We set none by default.
override DEFAULT_KLDFLAGS :=
$(eval $(call DEFAULT_VAR,KLDFLAGS,$(DEFAULT_KLDFLAGS)))
$(call USER_VARIABLE,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.
override KCFLAGS += \

View file

@ -9,9 +9,10 @@ ENTRY(kmain)
/* process. */
PHDRS
{
text PT_LOAD;
rodata PT_LOAD;
data PT_LOAD;
requests PT_LOAD;
text PT_LOAD;
rodata PT_LOAD;
data PT_LOAD;
}
SECTIONS
@ -22,6 +23,16 @@ SECTIONS
/* that is the beginning of the region. */
. = 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
@ -38,12 +49,6 @@ SECTIONS
.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
/* NOTE: .bss needs to be the last thing mapped to :data, otherwise lots of */