From f58f65c30de315d4419f69a92a708cbed797ff37 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sat, 30 Jul 2016 23:17:12 +0200 Subject: Release mode (enables some optimizations) ; fix tests. --- src/kernel/bam.lua | 34 +++++++++++++++++++--------------- src/kernel/core/kmain.c | 8 ++++++-- src/kernel/user/syscall.c | 1 + 3 files changed, 26 insertions(+), 17 deletions(-) (limited to 'src/kernel') diff --git a/src/kernel/bam.lua b/src/kernel/bam.lua index 2dc724e..43328e6 100644 --- a/src/kernel/bam.lua +++ b/src/kernel/bam.lua @@ -1,19 +1,23 @@ -local kernel_settings = TableDeepCopy(common_settings) +return function(s, common) + local kernel_settings = TableDeepCopy(s.common_settings) -kernel_settings.cc.includes:Add("src/common/include/kogata", - "src/kernel/include") + kernel_settings.cc.includes:Add("src/common/include/kogata", + "src/kernel/include") -kernel_settings.link.flags:Add("-T src/kernel/linker.ld") + kernel_settings.link.flags:Add("-T src/kernel/linker.ld") -kernel_source = { - Collect('src/kernel/core/*.s'), - Collect('src/kernel/dev/*.s'), - Collect('src/kernel/core/*.c'), - Collect('src/kernel/dev/*.c'), - Collect('src/kernel/fs/*.c'), - Collect('src/kernel/user/*.c'), -} -kernel_obj = Compile(kernel_settings, kernel_source) - -kernel = Link(kernel_settings, "kernel", {kernel_obj, common_libc, common_libkogata}) + kernel_source = { + Collect('src/kernel/core/*.s'), + Collect('src/kernel/dev/*.s'), + Collect('src/kernel/core/*.c'), + Collect('src/kernel/dev/*.c'), + Collect('src/kernel/fs/*.c'), + Collect('src/kernel/user/*.c'), + } + obj = Compile(kernel_settings, kernel_source) + return { + obj = obj, + bin = Link(kernel_settings, "kernel", {obj, common.libc, common.libkogata}) + } +end diff --git a/src/kernel/core/kmain.c b/src/kernel/core/kmain.c index dd66805..8ce9f0a 100644 --- a/src/kernel/core/kmain.c +++ b/src/kernel/core/kmain.c @@ -69,8 +69,12 @@ void kmain(multiboot_info_t *mbd, int32_t mb_magic) { // to allocate memory ; they just increment it of the allocated quantity void* kernel_data_end = (void*)&k_end_addr; - elf_shdr_t *elf_sections = (elf_shdr_t*)(mbd->elf_sec.addr + K_HIGHHALF_ADDR); - ASSERT(sizeof(elf_shdr_t) == mbd->elf_sec.size); + + elf_shdr_t *elf_sections = 0; + if (mbd->elf_sec.size != 0) { + elf_sections = (elf_shdr_t*)(mbd->elf_sec.addr + K_HIGHHALF_ADDR); + ASSERT(mbd->elf_sec.size == 0 || sizeof(elf_shdr_t) == mbd->elf_sec.size); + } dbglog_setup(); diff --git a/src/kernel/user/syscall.c b/src/kernel/user/syscall.c index 9497bf2..e89f62d 100644 --- a/src/kernel/user/syscall.c +++ b/src/kernel/user/syscall.c @@ -325,6 +325,7 @@ uint32_t select_sc(sc_args_t args) { if (h) { fds[i].got_flags = file_poll(h, &wait_objs[n_wait_objs]); if (wait_objs[n_wait_objs]) n_wait_objs++; + dbg_printf("KERNEL fds[%d].got_flags = 0x%p (fd %d)\n", i, fds[i].got_flags,fds[i].fd); if (fds[i].got_flags & fds[i].req_flags) ret = true; } } -- cgit v1.2.3