mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
parent
eb94f03416
commit
c7b2314d23
15
repos/base-foc/patches/0018-L4-enable-gcc_10.patch
Normal file
15
repos/base-foc/patches/0018-L4-enable-gcc_10.patch
Normal file
@ -0,0 +1,15 @@
|
||||
L4: enable GCC 10
|
||||
|
||||
diff --git a/l4/mk/Makeconf b/l4/mk/Makeconf
|
||||
index eb59b51..a7b5955 100644
|
||||
--- a/l4/mk/Makeconf
|
||||
+++ b/l4/mk/Makeconf
|
||||
@@ -52,7 +52,7 @@ L4_KIP_OFFS_SYS_DEBUGGER = 0x900
|
||||
L4_STACK_ADDR ?= $(L4_STACK_ADDR_$(ARCH))
|
||||
L4_STACK_SIZE ?= $(if $(L4_STACK_SIZE_MAIN_THREAD),$(L4_STACK_SIZE_MAIN_THREAD),0x8000)
|
||||
|
||||
-CC_WHITELIST-gcc := 4.7 4.8 4.9 5 6 7 8 9
|
||||
+CC_WHITELIST-gcc := 4.7 4.8 4.9 5 6 7 8 9 10
|
||||
CC_WHITELIST-clang := 3.5 3.6 3.7 3.8 3.9
|
||||
|
||||
# This is quite bad: There is no other chance to disable the page-alignedment
|
@ -0,0 +1,162 @@
|
||||
From dd8842dbdae2bb11d4f726f8a49a6ecb4d5d6870 Mon Sep 17 00:00:00 2001
|
||||
|
||||
From: Frank Mehnert <frank.mehnert@kernkonzept.com>
|
||||
|
||||
Subject: [PATCH] Do not depend on any libstdc++ feature
|
||||
|
||||
The libc_minimal library does not provide support for libstdc++ so use
|
||||
the normal libc headers instead and do not use any 'std' functions.
|
||||
|
||||
Change-Id: I9b4e04ddba0e3f366550265a2c30ef0f37df5534
|
||||
---
|
||||
server/src/boot_modules.cc | 2 +-
|
||||
server/src/multiboot2.cc | 24 ++++++++++++------------
|
||||
server/src/platform/exynos.cc | 2 +-
|
||||
server/src/platform/x86_pc-base.h | 4 ++--
|
||||
server/src/platform_common.cc | 2 +-
|
||||
server/src/support.h | 4 ++--
|
||||
6 files changed, 19 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/server/src/boot_modules.cc b/server/src/boot_modules.cc
|
||||
index 2446967..6100749 100644
|
||||
--- a/server/src/boot_modules.cc
|
||||
+++ b/server/src/boot_modules.cc
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "support.h"
|
||||
#include "panic.h"
|
||||
-#include <cassert>
|
||||
+#include <assert.h>
|
||||
#include "mod_info.h"
|
||||
#ifdef COMPRESS
|
||||
#include "uncompress.h"
|
||||
diff --git a/server/src/multiboot2.cc b/server/src/multiboot2.cc
|
||||
index c7255a3..17a2fdd 100644
|
||||
--- a/server/src/multiboot2.cc
|
||||
+++ b/server/src/multiboot2.cc
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <l4/sys/consts.h>
|
||||
#include <l4/cxx/minmax>
|
||||
|
||||
-#include <cstring>
|
||||
+#include <string.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
// by some other tag type)
|
||||
void process_modules(l4util_mb2_tag_t *tag)
|
||||
{
|
||||
- std::size_t cnt = 0;
|
||||
+ size_t cnt = 0;
|
||||
|
||||
while (tag->type == L4UTIL_MB2_MODULE_INFO_TAG)
|
||||
{
|
||||
@@ -146,8 +146,8 @@ public:
|
||||
void finalize()
|
||||
{
|
||||
assert(sizeof(_mbi) <= _size);
|
||||
- std::memcpy(_buf, &_mbi, sizeof(_mbi));
|
||||
- std::memset(_buf + sizeof(_mbi), 0, _size - sizeof(_mbi));
|
||||
+ memcpy(_buf, &_mbi, sizeof(_mbi));
|
||||
+ memset(_buf + sizeof(_mbi), 0, _size - sizeof(_mbi));
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -157,25 +157,25 @@ private:
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
- std::size_t size = l4_round_size(tag->size, L4UTIL_MB2_TAG_ALIGN_SHIFT);
|
||||
+ size_t size = l4_round_size(tag->size, L4UTIL_MB2_TAG_ALIGN_SHIFT);
|
||||
l4util_mb2_tag_t *dst_tag =
|
||||
reinterpret_cast<l4util_mb2_tag_t *>(end() - size);
|
||||
char *_src = reinterpret_cast<char *>(tag);
|
||||
|
||||
while (size)
|
||||
{
|
||||
- std::size_t copied = cxx::min(sizeof(buf), size);
|
||||
+ size_t copied = cxx::min(sizeof(buf), size);
|
||||
char *_dst = end() - copied;
|
||||
- std::memcpy(buf, _src, copied);
|
||||
- std::memmove(_src, _src + copied, (end() - _src) - copied);
|
||||
- std::memcpy(_dst, buf, copied);
|
||||
+ memcpy(buf, _src, copied);
|
||||
+ memmove(_src, _src + copied, (end() - _src) - copied);
|
||||
+ memcpy(_dst, buf, copied);
|
||||
size -= copied;
|
||||
}
|
||||
|
||||
return dst_tag;
|
||||
}
|
||||
|
||||
- void reserve_from_end(std::size_t size)
|
||||
+ void reserve_from_end(size_t size)
|
||||
{
|
||||
size = l4_round_size(size, L4UTIL_MB2_TAG_ALIGN_SHIFT);
|
||||
assert(_size >= size);
|
||||
@@ -183,8 +183,8 @@ private:
|
||||
}
|
||||
|
||||
char *_buf;
|
||||
- std::size_t _size;
|
||||
- const std::size_t _total_size;
|
||||
+ size_t _size;
|
||||
+ const size_t _total_size;
|
||||
|
||||
l4util_mb_info_t _mbi;
|
||||
};
|
||||
diff --git a/server/src/platform/exynos.cc b/server/src/platform/exynos.cc
|
||||
index d10d70d..bcd6d02 100644
|
||||
--- a/server/src/platform/exynos.cc
|
||||
+++ b/server/src/platform/exynos.cc
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "support.h"
|
||||
#include <l4/drivers/uart_s3c2410.h>
|
||||
|
||||
-#include <cstdio>
|
||||
+#include <stdio.h>
|
||||
|
||||
namespace {
|
||||
class Platform_arm_exynos : public Platform_single_region_ram
|
||||
diff --git a/server/src/platform/x86_pc-base.h b/server/src/platform/x86_pc-base.h
|
||||
index d5d53bf..fe0e0dd 100644
|
||||
--- a/server/src/platform/x86_pc-base.h
|
||||
+++ b/server/src/platform/x86_pc-base.h
|
||||
@@ -12,8 +12,8 @@
|
||||
#include <l4/util/port_io.h>
|
||||
#include <l4/cxx/static_container>
|
||||
|
||||
-#include <cassert>
|
||||
-#include <cstdio>
|
||||
+#include <assert.h>
|
||||
+#include <stdio.h>
|
||||
|
||||
/** VGA console output */
|
||||
|
||||
diff --git a/server/src/platform_common.cc b/server/src/platform_common.cc
|
||||
index 0503802..26ae0a9 100644
|
||||
--- a/server/src/platform_common.cc
|
||||
+++ b/server/src/platform_common.cc
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "support.h"
|
||||
#include <l4/cxx/minmax>
|
||||
-#include <cassert>
|
||||
+#include <assert.h>
|
||||
|
||||
#ifdef RAM_SIZE_MB
|
||||
|
||||
diff --git a/server/src/support.h b/server/src/support.h
|
||||
index 472e40e..20d2c04 100644
|
||||
--- a/server/src/support.h
|
||||
+++ b/server/src/support.h
|
||||
@@ -21,8 +21,8 @@
|
||||
#include <l4/util/mb_info.h>
|
||||
#include <stdio.h>
|
||||
#include "region.h"
|
||||
-#include <cstring>
|
||||
-#include <cstdlib>
|
||||
+#include <string.h>
|
||||
+#include <stdlib.h>
|
||||
|
||||
L4::Uart *uart();
|
||||
void set_stdio_uart(L4::Uart *uart);
|
@ -0,0 +1,25 @@
|
||||
From a4d6d7877c0050308a9c28308fa8a233c86902e1 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Warg <alexander.warg@kernkonzept.com>
|
||||
Date: Mon, 29 Jul 2019 00:00:00 +0000
|
||||
Subject: [PATCH] Fix amd64 build with binutils 2.32+
|
||||
|
||||
We have to make sure that a linker script is not given twice to ld.
|
||||
|
||||
Change-Id: Ibd0f8972083f665fb7824df2a65b319183d7b1e7
|
||||
---
|
||||
server/src/Make.rules | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/server/src/Make.rules b/server/src/Make.rules
|
||||
index 43e8775..c1bbfec 100644
|
||||
--- a/server/src/Make.rules
|
||||
+++ b/server/src/Make.rules
|
||||
@@ -439,7 +439,7 @@ $(OBJ_DIR)/ARCH-amd64/libc32/OBJ-$(ARCH)_$(CPU)/libc32.a: FORCE
|
||||
bootstrap32.elf: $(OBJ32) bootstrap32.bin $(SRC_DIR)/ARCH-amd64/boot32/bootstrap32.ld $(OBJ_DIR)/ARCH-amd64/libc32/OBJ-$(ARCH)_$(CPU)/libc32.a
|
||||
@$(LINK_MESSAGE)
|
||||
$(VERBOSE)$(CC32) -o $@ -nostdlib -static \
|
||||
- -Wl,-T,$(SRC_DIR)/ARCH-amd64/boot32/bootstrap32.ld,--gc-sections $^ -lgcc
|
||||
+ -Wl,-T,$(SRC_DIR)/ARCH-amd64/boot32/bootstrap32.ld,--gc-sections $(filter-out %/bootstrap32.ld,$^) -lgcc
|
||||
$(VERBOSE)chmod 755 $@
|
||||
|
||||
bootstrap: bootstrap32.elf
|
15
repos/base-foc/patches/0021-FOC-enable-gcc_10.patch
Normal file
15
repos/base-foc/patches/0021-FOC-enable-gcc_10.patch
Normal file
@ -0,0 +1,15 @@
|
||||
FOC: enable GCC 10
|
||||
|
||||
diff --git a/src/Makeconf b/src/Makeconf
|
||||
index de5b656..7660daa 100644
|
||||
--- a/src/Makeconf
|
||||
+++ b/src/Makeconf
|
||||
@@ -244,7 +244,7 @@ ifeq ($(CC_TYPE),gcc)
|
||||
endif
|
||||
|
||||
|
||||
-CC_WHITELIST-gcc := 4.7 4.8 4.9 5 6 7 8 9
|
||||
+CC_WHITELIST-gcc := 4.7 4.8 4.9 5 6 7 8 9 10
|
||||
CC_WHITELIST-clang := 3.6 3.7 3.8 3.9 4.0 5.0 6.0 7.0 8.0 9.0
|
||||
CC_WHITELIST := $(CC_WHITELIST-$(CC_TYPE))
|
||||
|
@ -0,0 +1,234 @@
|
||||
From f29031cdbe8cebf6c39d02a72dd50c736cec3a69 Mon Sep 17 00:00:00 2001
|
||||
|
||||
From: =?UTF-8?q?Jakub=20Jerm=C3=A1=C5=99?= <jakub.jermar@kernkonzept.com>
|
||||
|
||||
Subject: [PATCH] amd64: Split _syscall_entry into code and data
|
||||
|
||||
This change makes the entire syscall entry table smaller, sparing 32
|
||||
bytes per a statically configured CPU. Note that some padding is still
|
||||
used to achieve cacheline alignment of the per-CPU entries of the data
|
||||
part of the table.
|
||||
|
||||
Furthemore, by moving the two data members into a data section and
|
||||
allowing to modify the handler offset from JDB only, the amd64 kernel is
|
||||
easier to make completely W^X in the future. The handler entry offset
|
||||
remains a part of the jump instruction opcode (there is no data
|
||||
indirection) and JDB is enhanced to be able to patch it when needed.
|
||||
|
||||
Change-Id: I22b91f9fd2b108d99e3ceea6611a15ab3db26bb6
|
||||
|
||||
Edit for Genode: UX changes not included because of more dependencies
|
||||
---
|
||||
src/jdb/ia32/jdb_trace_set-ia32-ux.cpp | 4 +-
|
||||
src/kern/ia32/64/cpu-64.cpp | 31 +++++-------------
|
||||
src/kern/ia32/64/entry.S | 29 +++++++++++++++++
|
||||
src/kern/ia32/64/syscall_entry.cpp | 54 +++++---------------------------
|
||||
4 files changed, 48 insertions(+), 70 deletions(-)
|
||||
|
||||
diff --git a/src/jdb/ia32/jdb_trace_set-ia32-ux.cpp b/src/jdb/ia32/jdb_trace_set-ia32-ux.cpp
|
||||
index ec23322..0a2f309 100644
|
||||
--- a/src/jdb/ia32/jdb_trace_set-ia32-ux.cpp
|
||||
+++ b/src/jdb/ia32/jdb_trace_set-ia32-ux.cpp
|
||||
@@ -39,7 +39,7 @@ Jdb_set_trace::set_ipc_vector()
|
||||
|
||||
Idt::set_entry(0x30, (Address) int30_entry, true);
|
||||
Jdb::on_each_cpu([fast_entry](Cpu_number cpu){
|
||||
- Cpu::cpus.cpu(cpu).set_fast_entry(fast_entry);
|
||||
+ //Cpu::cpus.cpu(cpu).set_fast_entry(fast_entry);
|
||||
});
|
||||
|
||||
if (Jdb_ipc_trace::_trace)
|
||||
@@ -98,7 +98,7 @@ struct Jdb_ipc_log_pm : Pm_object
|
||||
else
|
||||
fast_entry = entry_sys_fast_ipc_c;
|
||||
|
||||
- Cpu::cpus.cpu(cpu).set_fast_entry(fast_entry);
|
||||
+ //Cpu::cpus.cpu(cpu).set_fast_entry(fast_entry);
|
||||
}
|
||||
|
||||
void pm_on_suspend(Cpu_number) override {}
|
||||
diff --git a/src/kern/ia32/64/cpu-64.cpp b/src/kern/ia32/64/cpu-64.cpp
|
||||
index 974c677..d18ad16 100644
|
||||
--- a/src/kern/ia32/64/cpu-64.cpp
|
||||
+++ b/src/kern/ia32/64/cpu-64.cpp
|
||||
@@ -4,7 +4,8 @@ INTERFACE [amd64 && !kernel_isolation]:
|
||||
|
||||
EXTENSION class Cpu
|
||||
{
|
||||
- static Per_cpu_array<Syscall_entry> _syscall_entry;
|
||||
+ static Per_cpu_array<Syscall_entry_data>
|
||||
+ _syscall_entry_data asm("syscall_entry_data");
|
||||
};
|
||||
|
||||
|
||||
@@ -13,14 +14,7 @@ IMPLEMENTATION[amd64 && !kernel_isolation]:
|
||||
#include "mem_layout.h"
|
||||
#include "tss.h"
|
||||
|
||||
-Per_cpu_array<Syscall_entry> Cpu::_syscall_entry;
|
||||
-
|
||||
-PUBLIC
|
||||
-void
|
||||
-Cpu::set_fast_entry(void (*func)())
|
||||
-{
|
||||
- _syscall_entry[id()].set_entry(func);
|
||||
-}
|
||||
+Per_cpu_array<Syscall_entry_data> Cpu::_syscall_entry_data;
|
||||
|
||||
IMPLEMENT inline NEEDS["tss.h"]
|
||||
Address volatile &
|
||||
@@ -31,11 +25,13 @@ PUBLIC inline
|
||||
void
|
||||
Cpu::setup_sysenter()
|
||||
{
|
||||
+ extern Per_cpu_array<Syscall_entry_text> syscall_entry_text;
|
||||
+
|
||||
wrmsr(0, GDT_CODE_KERNEL | ((GDT_CODE_USER32 | 3) << 16), MSR_STAR);
|
||||
- wrmsr((Unsigned64)&_syscall_entry[id()], MSR_LSTAR);
|
||||
- wrmsr((Unsigned64)&_syscall_entry[id()], MSR_CSTAR);
|
||||
+ wrmsr((Unsigned64)&syscall_entry_text[id()], MSR_LSTAR);
|
||||
+ wrmsr((Unsigned64)&syscall_entry_text[id()], MSR_CSTAR);
|
||||
wrmsr(~0U, MSR_SFMASK);
|
||||
- _syscall_entry[id()].set_rsp((Address)&kernel_sp());
|
||||
+ _syscall_entry_data[id()].set_rsp((Address)&kernel_sp());
|
||||
}
|
||||
|
||||
IMPLEMENTATION[amd64 && kernel_isolation]:
|
||||
@@ -43,16 +39,6 @@ IMPLEMENTATION[amd64 && kernel_isolation]:
|
||||
#include "mem_layout.h"
|
||||
#include "tss.h"
|
||||
|
||||
-PUBLIC
|
||||
-void
|
||||
-Cpu::set_fast_entry(void (*func)())
|
||||
-{
|
||||
- extern char const syscall_entry_code[];
|
||||
- extern char const syscall_entry_reloc[];
|
||||
- auto ofs = syscall_entry_reloc - syscall_entry_code + 3; // 3 byte movebas
|
||||
- *reinterpret_cast<Signed32 *>(Mem_layout::Mem_layout::Kentry_cpu_page + ofs + 0xa0) = (Signed32)(Signed64)func;
|
||||
-}
|
||||
-
|
||||
PUBLIC inline
|
||||
void
|
||||
Cpu::setup_sysenter() const
|
||||
@@ -78,7 +64,6 @@ Cpu::init_sysenter()
|
||||
{
|
||||
setup_sysenter();
|
||||
wrmsr(rdmsr(MSR_EFER) | 1, MSR_EFER);
|
||||
- set_fast_entry(entry_sys_fast_ipc_c);
|
||||
}
|
||||
|
||||
|
||||
diff --git a/src/kern/ia32/64/entry.S b/src/kern/ia32/64/entry.S
|
||||
index 1cb8137..ed5a04c 100644
|
||||
--- a/src/kern/ia32/64/entry.S
|
||||
+++ b/src/kern/ia32/64/entry.S
|
||||
@@ -372,7 +372,36 @@ entry_\name:
|
||||
jmp all_syscalls
|
||||
.endm
|
||||
|
||||
+#ifndef CONFIG_KERNEL_ISOLATION
|
||||
+#ifdef CONFIG_MP
|
||||
+MAX_NUM_CPUS = CONFIG_MP_MAX_CPUS
|
||||
+#else
|
||||
+MAX_NUM_CPUS = 1
|
||||
+#endif
|
||||
+
|
||||
+#define SYSCALL_ENTRY_DATA_SIZE 64
|
||||
+#define SYSCALL_ENTRY_TEXT_SIZE (0f - 0b)
|
||||
+#define SYSCALL_ENTRY_OFFSET ((0b - syscall_entry_text) / SYSCALL_ENTRY_TEXT_SIZE)
|
||||
+#define SYSCALL_ENTRY_DATA (syscall_entry_data + SYSCALL_ENTRY_OFFSET * SYSCALL_ENTRY_DATA_SIZE)
|
||||
+#define KERN_SP (SYSCALL_ENTRY_DATA + 0)
|
||||
+#define USER_SP (SYSCALL_ENTRY_DATA + 8)
|
||||
.section ".entry.text.syscalls", "ax", @progbits
|
||||
+ .global syscall_entry_text
|
||||
+ .align 64
|
||||
+syscall_entry_text:
|
||||
+.rept MAX_NUM_CPUS
|
||||
+0:
|
||||
+ mov %rsp, USER_SP(%rip)
|
||||
+ mov KERN_SP(%rip), %rsp
|
||||
+ mov (%rsp), %rsp
|
||||
+ pushq $GDT_DATA_USER | 3
|
||||
+ pushq USER_SP(%rip)
|
||||
+ jmp entry_sys_fast_ipc_c
|
||||
+ .align 32
|
||||
+0:
|
||||
+.endr
|
||||
+#endif /* !CONFIG_KERNEL_ISOLATION */
|
||||
+
|
||||
.p2align 4
|
||||
.type all_syscalls,@function
|
||||
all_syscalls:
|
||||
diff --git a/src/kern/ia32/64/syscall_entry.cpp b/src/kern/ia32/64/syscall_entry.cpp
|
||||
index b03d1ad..3dd7db3 100644
|
||||
--- a/src/kern/ia32/64/syscall_entry.cpp
|
||||
+++ b/src/kern/ia32/64/syscall_entry.cpp
|
||||
@@ -2,58 +2,22 @@ INTERFACE [amd64]:
|
||||
|
||||
#include "types.h"
|
||||
|
||||
-class Syscall_entry
|
||||
+class Syscall_entry_data
|
||||
{
|
||||
-private:
|
||||
- template<int INSN_LEN>
|
||||
- struct Mem_insn
|
||||
- {
|
||||
- Unsigned32 _insn:INSN_LEN * 8;
|
||||
- Unsigned32 _offset;
|
||||
- Mem_insn(Unsigned32 insn, void *mem)
|
||||
- : _insn(insn),
|
||||
- _offset((Address)mem - (Address)(&_offset + 1))
|
||||
- {}
|
||||
- } __attribute__((packed));
|
||||
-
|
||||
- Mem_insn<3> _mov_rsp_user_sp;
|
||||
- Mem_insn<3> _mov_kern_sp_rsp;
|
||||
- Unsigned32 _mov_rsp_rsp;
|
||||
- Unsigned8 _push_ss, _ss_value;
|
||||
- Mem_insn<2> _push_user_rsp;
|
||||
- Unsigned8 _jmp;
|
||||
- Signed32 _entry_offset;
|
||||
- Unsigned8 _pading[33]; // pad to the next 64 byte boundary
|
||||
- Unsigned64 _kern_sp;
|
||||
- Unsigned64 _user_sp;
|
||||
-} __attribute__((packed, aligned(64)));
|
||||
+ Unsigned64 _kern_sp = 0;
|
||||
+ Unsigned64 _user_sp = 0;
|
||||
+} __attribute__((packed, aligned(64))); // Enforce cacheline alignment
|
||||
|
||||
+struct Syscall_entry_text
|
||||
+{
|
||||
+ char _res[32]; // Keep this in sync with code in syscall_entry_text!
|
||||
+} __attribute__((packed, aligned(32)));
|
||||
|
||||
IMPLEMENTATION [amd64]:
|
||||
|
||||
-#include "config_gdt.h"
|
||||
-
|
||||
-PUBLIC inline NEEDS["config_gdt.h"]
|
||||
-Syscall_entry::Syscall_entry()
|
||||
-: /* mov %rsp, _user_sp(%rip) */ _mov_rsp_user_sp(0x258948, &_user_sp),
|
||||
- /* mov _kern_sp(%rip), %rsp */ _mov_kern_sp_rsp(0x258b48, &_kern_sp),
|
||||
- /* mov (%rsp), %rsp */ _mov_rsp_rsp(0x24248b48),
|
||||
- /* pushq GDT_DATA_USER | 3 */ _push_ss(0x6a), _ss_value(GDT_DATA_USER | 3),
|
||||
- /* pushq _user_sp(%rip) */ _push_user_rsp(0x35ff, &_user_sp),
|
||||
- /* jmp *_entry_offset */ _jmp(0xe9)
|
||||
-{}
|
||||
-
|
||||
-PUBLIC inline
|
||||
-void
|
||||
-Syscall_entry::set_entry(void (*func)(void))
|
||||
-{
|
||||
- _entry_offset = (Address)func
|
||||
- - ((Address)&_entry_offset + sizeof(_entry_offset));
|
||||
-}
|
||||
-
|
||||
PUBLIC inline
|
||||
void
|
||||
-Syscall_entry::set_rsp(Address rsp)
|
||||
+Syscall_entry_data::set_rsp(Address rsp)
|
||||
{
|
||||
_kern_sp = rsp;
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
ARM: link bootstrap as ET_REL not ET_EXEC
|
||||
|
||||
From: Frank Mehnert <frank.mehnert@kernkonzept.com>
|
||||
|
||||
Support for linking of ET_EXEC section was deprecated in binutils 2.35
|
||||
and dropped in binutils 2.36.
|
||||
|
||||
Instead, extract the raw section of the fully linked bootstrap object
|
||||
and create a relocatable object which can be linked to the kernel. The
|
||||
required symbols for the linker are extracted separately.
|
||||
|
||||
Fixes ticket #CD-301.
|
||||
|
||||
Change-Id: I0cdc2aacb5dbd01677d93e2bb1103940ac60e848
|
||||
|
||||
Edit: fixed merge error for Genode
|
||||
---
|
||||
src/Makeconf.arm | 6 ++++++
|
||||
src/kern/arm/Makerules.KERNEL | 20 ++++++++++++++++----
|
||||
src/kernel.arm.ld | 4 ++--
|
||||
3 files changed, 24 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/Makeconf.arm b/src/Makeconf.arm
|
||||
index 7c66a8d..89b9e7d 100644
|
||||
--- a/src/Makeconf.arm
|
||||
+++ b/src/Makeconf.arm
|
||||
@@ -31,3 +31,9 @@ LDFLAGS += $(LDFLAGS-y)
|
||||
LD_EMULATION_CHOICE-$(CONFIG_BIT32) := armelf armelf_linux_eabi armelf_fbsd
|
||||
LD_EMULATION_CHOICE-$(CONFIG_BIT64) := aarch64linux aarch64elf
|
||||
LD_EMULATION_CHOICE := $(LD_EMULATION_CHOICE-y)
|
||||
+OBJCOPY_BFDNAME-$(CONFIG_BIT32) := elf32-littlearm
|
||||
+OBJCOPY_BFDNAME-$(CONFIG_BIT64) := elf64-littleaarch64
|
||||
+OBJCOPY_BFDNAME := $(OBJCOPY_BFDNAME-y)
|
||||
+OBJCOPY_BFDARCH-$(CONFIG_BIT32) := arm
|
||||
+OBJCOPY_BFDARCH-$(CONFIG_BIT64) := aarch64
|
||||
+OBJCOPY_BFDARCH := $(OBJCOPY_BFDARCH-y)
|
||||
diff --git a/src/kern/arm/Makerules.KERNEL b/src/kern/arm/Makerules.KERNEL
|
||||
index d706444..fae3013 100644
|
||||
--- a/src/kern/arm/Makerules.KERNEL
|
||||
+++ b/src/kern/arm/Makerules.KERNEL
|
||||
@@ -21,16 +21,28 @@ bootstrap_ldflags += -T$(bootstrap_lds)
|
||||
|
||||
bootstrap_export = _start start_of_loader end_of_bootstrap_info
|
||||
bootstrap_strip = --strip-all $(addprefix --keep-symbol=,$(bootstrap_export))
|
||||
+bootstrap_syms = end_of_bootstrap_info|_start|start_of_loader
|
||||
+bootstrap_sed = 's/^0*([0-9a-f]*) [a-zA-Z] ($(bootstrap_syms))/\2 = 0x\1;/p'
|
||||
|
||||
bootstrap.$(KERNEL).pre.o: $(OBJ_BOOTSTRAP) $(LIBGCC) $(bootstrap_lds)
|
||||
$(LINK_MESSAGE)
|
||||
$(VERBOSE)$(LD) $(bootstrap_ldflags) $(OBJ_BOOTSTRAP) $(LIBGCC) -o $@
|
||||
|
||||
-bootstrap.$(KERNEL).o: bootstrap.$(KERNEL).pre.o
|
||||
- $(LINK_MESSAGE)
|
||||
- $(VERBOSE)$(OBJCOPY) $(bootstrap_strip) $< $@
|
||||
+bootstrap.$(KERNEL).bin: bootstrap.$(KERNEL).pre.o
|
||||
+ $(COMP_MESSAGE)
|
||||
+ $(VERBOSE)$(OBJCOPY) -O binary --only-section=.bootstrap.text $< $@
|
||||
+
|
||||
+bootstrap.$(KERNEL).rel: bootstrap.$(KERNEL).bin
|
||||
+ $(COMP_MESSAGE)
|
||||
+ $(VERBOSE)$(OBJCOPY) -I binary -O $(OBJCOPY_BFDNAME) -B $(OBJCOPY_BFDARCH) \
|
||||
+ --rename-section .data=.bootstrap.text $< $@
|
||||
+
|
||||
+# The linker will treat this file as linker script.
|
||||
+bootstrap.$(KERNEL).sym: bootstrap.$(KERNEL).pre.o
|
||||
+ $(COMP_MESSAGE)
|
||||
+ $(VERBOSE)$(NM) $< | sed -n -E $(bootstrap_sed) > $@
|
||||
|
||||
-$(KERNEL).image: kernel.arm.lds $(CRT0) bootstrap.$(KERNEL).o $(OBJ_KERNEL_noboot) $(JDB) $(LIBK) $(KERNEL_EXTRA_LIBS) $(LIBDISASM) $(ABI) libdrivers.a $(LIBUART) $(CXXLIB) $(MINILIBC) $(LIBGCC) $(MINILIBC) libgluedriverslibc.a
|
||||
+$(KERNEL).image: kernel.arm.lds $(CRT0) bootstrap.$(KERNEL).rel bootstrap.$(KERNEL).sym $(OBJ_KERNEL_noboot) $(JDB) $(LIBK) $(KERNEL_EXTRA_LIBS) $(LIBDISASM) $(ABI) libdrivers.a $(LIBUART) $(CXXLIB) $(MINILIBC) $(LIBGCC) $(MINILIBC) libgluedriverslibc.a
|
||||
$(LINK_MESSAGE)
|
||||
$(VERBOSE)$(LD) $(LDFLAGS) -m $(LD_EMULATION) $(KERNEL_LDFLAGS) -N -defsym kernel_load_addr=$(CONFIG_KERNEL_LOAD_ADDR) \
|
||||
-T $< -o $@ $(filter-out $<,$+)
|
||||
diff --git a/src/kernel.arm.ld b/src/kernel.arm.ld
|
||||
index 1e3ec75..86c16b3 100644
|
||||
--- a/src/kernel.arm.ld
|
||||
+++ b/src/kernel.arm.ld
|
||||
@@ -61,14 +61,14 @@ SECTIONS {
|
||||
|
||||
. = kernel_load_addr + 0x1000;
|
||||
|
||||
- .text : {
|
||||
+ .text kernel_load_addr + 0x1000 : {
|
||||
MWORD(_start_kernel)
|
||||
MWORD(my_kernel_info_page)
|
||||
KEEP(*(.bootstrap.info))
|
||||
ASSERT (ABSOLUTE(.) == end_of_bootstrap_info, "invalid size of bootstrap.info");
|
||||
|
||||
. = ABSOLUTE(start_of_loader);
|
||||
- *(.bootstrap.text)
|
||||
+ KEEP(*(.bootstrap.text))
|
||||
} :bstrap
|
||||
|
||||
. = ALIGN(4K);
|
@ -1 +1 @@
|
||||
2e8cbb44d4c009238d96b66a9fc085e038f22e61
|
||||
abe2de76835f33297ca4e4ac687e69bc04f83dc5
|
||||
|
@ -37,5 +37,11 @@ PATCH_OPT(patches/0014-Always-enable-user-mode-access-for-performance-monit.patc
|
||||
PATCH_OPT(patches/0015-VMX-disable-event-injection-if-requested-by-VMM.patch) := -p3 -d${DIR(foc)}
|
||||
PATCH_OPT(patches/0016-svm-provide-cr0-to-guest-if-np-enabled.patch) := -p3 -d${DIR(foc)}
|
||||
PATCH_OPT(patches/0017-svm-avoid-forceful-exit-on-task-switch.patch) := -p3 -d${DIR(foc)}
|
||||
PATCH_OPT(patches/0018-L4-enable-gcc_10.patch) := -p2 -d${DIR(mk)}
|
||||
PATCH_OPT(patches/0019-Bootstrap-do-not-depend-on-any-libstdcxx-feature.patch) := -p1 -d${DIR(bootstrap)}
|
||||
PATCH_OPT(patches/0020-Bootstrap-fix-amd64-build-with-binutils-2_32.patch) := -p1 -d${DIR(bootstrap)}
|
||||
PATCH_OPT(patches/0021-FOC-enable-gcc_10.patch) := -p1 -d${DIR(foc)}
|
||||
PATCH_OPT(patches/0022-FOC-amd64-split-_syscall_entry-into-code-and-data.patch) := -p1 -d${DIR(foc)}
|
||||
PATCH_OPT(patches/0023-FOC-arm-link-bootstrap-as-et_rel.patch) := -p1 -d${DIR(foc)}
|
||||
|
||||
$(call check_tool,gawk)
|
||||
|
Loading…
x
Reference in New Issue
Block a user