Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ include ../phoenix-rtos-build/Makefile.common

LDGEN ?= $(CC)

CFLAGS += -I.
CFLAGS += -I. -ffreestanding
CPPFLAGS += -DVERSION=\"$(VERSION)\"

OBJS :=
Expand Down
18 changes: 10 additions & 8 deletions _startc.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,31 @@ void _startc(int argc, char **argv, char **env)
size_t i, size;

/* Load .fastram.text, .data and .rodata sections */
if (__ramtext_start != __ramtext_load) {
if (&__ramtext_start[0] != &__ramtext_load[0]) {
/* hal_memcpy may reside in fastram. */
for (i = 0; i <= __ramtext_end - __ramtext_start; i++) {
for (i = 0; i <= (__ramtext_end - __ramtext_start); i++) {
__ramtext_start[i] = __ramtext_load[i];
}
}

if (__data_start != __data_load)
if (&__data_start[0] != &__data_load[0]) {
hal_memcpy(__data_start, __data_load, __data_end - __data_start);

if (__rodata_start != __rodata_load)
}
if (&__rodata_start[0] != &__rodata_load[0]) {
hal_memcpy(__rodata_start, __rodata_load, __rodata_end - __rodata_start);

}
/* Clear the .bss section */
hal_memset(__bss_start, 0, __bss_end - __bss_start);

size = __init_array_end - __init_array_start;
for (i = 0; i < size; i++)
for (i = 0; i < size; i++) {
(*__init_array_start[i])();
}

main();

size = __fini_array_end - __fini_array_start;
for (i = size; i > 0; i--)
for (i = size; i > 0; i--) {
(*__fini_array_start[i - 1])();
}
}
6 changes: 6 additions & 0 deletions hal/ia32/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,13 @@ static rsdp_t *_hal_acpiLookForRsdp(hal_syspage_t *hs, void *start, void *end)
static rsdp_t *_hal_acpiFindRsdp(hal_syspage_t *hs)
{
/* Search EBDA */

/* FIXME: pragmas are needed as a result of a bug in GCC -Warray-bounds */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
unsigned int ebda = ((*(u16 *)0x40eu) << 4) & ~(SIZE_PAGE - 1);
#pragma GCC diagnostic pop

rsdp_t *result;
if ((ebda < 0x00080000u) || (ebda > 0x0009ffffu)) {
ebda = 0x00080000u;
Expand Down
2 changes: 1 addition & 1 deletion riscv-sbi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ endif

LDGEN ?= $(CC)

CFLAGS += -I. -Iinclude
CFLAGS += -I. -Iinclude -ffreestanding
CPPFLAGS += -DPAYLOAD_PATH=\"$(PAYLOAD_PATH)\"

ifneq ($(FDT_PATH),)
Expand Down
Loading