mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
Imported Genode release 11.11
This commit is contained in:
committed by
Christian Helmuth
parent
6bcc9aef0e
commit
da4e1feaa5
67
base-codezero/patches/README
Normal file
67
base-codezero/patches/README
Normal file
@@ -0,0 +1,67 @@
|
||||
This directory contains patches of the Codezero kernel that are needed for the
|
||||
integration with Genode. Furthermore, some patches address issues with recent
|
||||
tool chains not yet supported by the official Codezero verison.
|
||||
|
||||
:binutils-2.21.patch:
|
||||
|
||||
The GNU assembler of binutils-2.21 complains with an error that was ignored
|
||||
by previous binutils versions:
|
||||
|
||||
"Error: .size expression for ... does not evaluate to a constant"
|
||||
|
||||
This error seems to occur if the argument of 'BEGIN_PROC' does not match
|
||||
the argument of 'END_PROC'. The patch fixes such inconsistencies in the
|
||||
code.
|
||||
|
||||
:gcc_shared_enabled.patch:
|
||||
|
||||
Codezero expect the tool chain to be used for the kernel to not support
|
||||
shared libraries. This is the case for Codesourcery's arm-non-eabi
|
||||
tool chain. Such tool chains use to incorporate both libgcc and libgcc_eh
|
||||
into the single libgcc.a library. In contrast, for tool chains built with
|
||||
'--enable-shared', libgcc does not contain the functions of libgcc_eh. Hence,
|
||||
one symbol called '__aeabi_unwind_cpp_pr0' referenced by libgcc and normally
|
||||
provided by libgcc_eh remains unresolved. There are two possible solutions
|
||||
for this problem: We could link libgcc_eh to the 'final.elf' image as
|
||||
expected by libgcc. However, this way, we will need to implement the
|
||||
the environment expected by libgcc_eh. For Codezero, this is pointless
|
||||
because no C++ is used. The second option is to provide a dummy symbol
|
||||
for '__aeabi_unwind_cpp_pr0' just to make the linker happy. This patch
|
||||
adds such a dummy symbol to 'loader/main.c'.
|
||||
|
||||
:libc_search_dir.patch:
|
||||
|
||||
The userlibs are build with w/o '-nostdinc'. Consequently, the standard
|
||||
search paths of the tool chain are used. Because the user land is
|
||||
normally build with the Codesourcery tool chain 'arm-none-linux-gnueabi',
|
||||
the complete glibc headers (that come with the tool chain) end up in
|
||||
the default search path. Coincidentally, the userlibs SConstruct file
|
||||
misses to supply the Codezero libc headers, which goes undetected because
|
||||
headers such as 'stdio.h' are silently taken from the tool chain's libc.
|
||||
This patch supplies Codezero's libc include-search path for building
|
||||
the userlibs. This enables the userlibs to be built with tool chains
|
||||
that do not come with a complete libc.
|
||||
|
||||
:scons-2.0.1.patch:
|
||||
|
||||
SCons 2.0.1 complains about the 'build_dir' argument being renamed to
|
||||
'variant_dir'. This patch renames the argument where needed for building
|
||||
the kernel and the default container.
|
||||
|
||||
:set_fixed_pager.patch:
|
||||
|
||||
At some point, Codezero abandoned the facility to define the pager for a
|
||||
given thread via the exregs system call. Instead, the kernel hard-wires the
|
||||
creator of the thread as the thread's pager. This is conflicting with
|
||||
Genode's way of creating and paging threads. On the current version of Genode
|
||||
for Codezero, all threads are paged by one thread (thread 3 happens to be the
|
||||
global pager) within core. As a work-around to Codezero's current limitation,
|
||||
we define thread 3 to be the pager of all threads.
|
||||
|
||||
:gcc_4_6_1_fixes.patch:
|
||||
|
||||
Version 4.6.1 of GCC is more picky about dead code than previous versions and
|
||||
warns about unused variables. Because Codezero is build with the '-Werror'
|
||||
flag, these warnings cause the kernel build to fail. The patch fixes those
|
||||
warnings by removing the variables in question.
|
||||
|
||||
33
base-codezero/patches/binutils-2.21.patch
Normal file
33
base-codezero/patches/binutils-2.21.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
diff --git a/src/arch/arm/vectors.S b/src/arch/arm/vectors.S
|
||||
index 0475389..62f3c38 100644
|
||||
--- a/src/arch/arm/vectors.S
|
||||
+++ b/src/arch/arm/vectors.S
|
||||
@@ -503,7 +503,7 @@ BEGIN_PROC(arm_irq_exception_basic)
|
||||
mov lr, pc
|
||||
ldr pc, =do_irq
|
||||
ldmfd sp!, {r0-r3, pc}^
|
||||
-END_PROC(arm_irq_exception)
|
||||
+END_PROC(arm_irq_exception_basic)
|
||||
|
||||
/* Minimal IRQ state saved on irq stack right after irq vector enters: */
|
||||
#define IRQ_R0 0
|
||||
diff --git a/conts/userlibs/libc/src/arch-arm/memcpy.S b/conts/userlibs/libc/src/arch-arm/memcpy.S
|
||||
index 383f5d2..b4df27f 100644
|
||||
--- a/conts/userlibs/libc/src/arch-arm/memcpy.S
|
||||
+++ b/conts/userlibs/libc/src/arch-arm/memcpy.S
|
||||
@@ -57,4 +57,4 @@ BEGIN_PROC(memcpy)
|
||||
bne last
|
||||
1:
|
||||
pop {r0, r4 - r11, pc}
|
||||
-END_PROC(_memcpy)
|
||||
+END_PROC(memcpy)
|
||||
diff --git a/conts/userlibs/libc/src/arch-arm/memset.S b/conts/userlibs/libc/src/arch-arm/memset.S
|
||||
index ce9b06c..3746955 100644
|
||||
--- a/conts/userlibs/libc/src/arch-arm/memset.S
|
||||
+++ b/conts/userlibs/libc/src/arch-arm/memset.S
|
||||
@@ -65,4 +65,4 @@ BEGIN_PROC(memset)
|
||||
bne end
|
||||
|
||||
ldmfd sp!, {r4 - r11, pc}
|
||||
-END_PROC(_memset)
|
||||
+END_PROC(memset)
|
||||
182
base-codezero/patches/gcc_4_6_1_fixes.patch
Normal file
182
base-codezero/patches/gcc_4_6_1_fixes.patch
Normal file
@@ -0,0 +1,182 @@
|
||||
diff --git a/src/api/map.c b/src/api/map.c
|
||||
index 1d15086..6139b4c 100644
|
||||
--- a/src/api/map.c
|
||||
+++ b/src/api/map.c
|
||||
@@ -78,6 +78,6 @@ int sys_unmap(unsigned long virtual, unsigned long npages, unsigned int tid)
|
||||
retval = ret;
|
||||
}
|
||||
|
||||
- return ret;
|
||||
+ return retval;
|
||||
}
|
||||
|
||||
diff --git a/src/api/thread.c b/src/api/thread.c
|
||||
index 985c425..579e4fb 100644
|
||||
--- a/src/api/thread.c
|
||||
+++ b/src/api/thread.c
|
||||
@@ -497,7 +497,7 @@ out_err:
|
||||
*/
|
||||
int sys_thread_control(unsigned int flags, struct task_ids *ids)
|
||||
{
|
||||
- struct ktcb *task = 0, *pager = 0;
|
||||
+ struct ktcb *task = 0;
|
||||
int err, ret = 0;
|
||||
|
||||
if ((err = check_access((unsigned long)ids, sizeof(*ids),
|
||||
@@ -508,8 +508,6 @@ int sys_thread_control(unsigned int flags, struct task_ids *ids)
|
||||
if (!(task = tcb_find(ids->tid)))
|
||||
return -ESRCH;
|
||||
|
||||
- pager = task->pager;
|
||||
-
|
||||
/*
|
||||
* Caller may operate on a thread if it shares
|
||||
* the same address space with that thread's pager
|
||||
diff --git a/src/arch/arm/mapping-common.c b/src/arch/arm/mapping-common.c
|
||||
index 385f7c2..55b4bea 100644
|
||||
--- a/src/arch/arm/mapping-common.c
|
||||
+++ b/src/arch/arm/mapping-common.c
|
||||
@@ -313,12 +313,11 @@ int check_mapping(unsigned long vaddr, unsigned long size,
|
||||
int remove_mapping_space(struct address_space *space, unsigned long vaddr)
|
||||
{
|
||||
pmd_table_t *pmd_table;
|
||||
- int pgd_i, pmd_i;
|
||||
+ int pmd_i;
|
||||
pmd_t *pmd;
|
||||
unsigned int pmd_type, pte_type;
|
||||
|
||||
vaddr = page_align(vaddr);
|
||||
- pgd_i = PGD_INDEX(vaddr);
|
||||
pmd_i = PMD_INDEX(vaddr);
|
||||
|
||||
/*
|
||||
diff --git a/src/glue/arm/init.c b/src/glue/arm/init.c
|
||||
index 2373c66..43c6fda 100644
|
||||
--- a/src/glue/arm/init.c
|
||||
+++ b/src/glue/arm/init.c
|
||||
@@ -68,8 +68,6 @@ void print_sections(void)
|
||||
/* The kip is non-standard, using 0xBB to indicate mine for now ;-) */
|
||||
void kip_init()
|
||||
{
|
||||
- struct utcb **utcb_ref;
|
||||
-
|
||||
/*
|
||||
* TODO: Adding utcb size might be useful
|
||||
*/
|
||||
@@ -86,9 +84,6 @@ void kip_init()
|
||||
|
||||
kip_init_syscalls();
|
||||
|
||||
- /* KIP + 0xFF0 is pointer to UTCB segment start address */
|
||||
- utcb_ref = (struct utcb **)((unsigned long)&kip + UTCB_KIP_OFFSET);
|
||||
-
|
||||
add_boot_mapping(virt_to_phys(&kip), USER_KIP_PAGE, PAGE_SIZE,
|
||||
MAP_USR_RO);
|
||||
printk("%s: Kernel built on %s, %s\n", __KERNELNAME__,
|
||||
diff --git a/loader/libs/elf/src/elf.c b/loader/libs/elf/src/elf.c
|
||||
index 4a1b5e0..f97273b 100644
|
||||
--- a/loader/libs/elf/src/elf.c
|
||||
+++ b/loader/libs/elf/src/elf.c
|
||||
@@ -339,16 +339,12 @@ elf_loadFile(void *elfFile, bool phys)
|
||||
{
|
||||
int i;
|
||||
int num_pheaders;
|
||||
- int pheader_offset;
|
||||
- int pheader_type;
|
||||
if (elf_checkFile(elfFile) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
num_pheaders = elf_getNumProgramHeaders(elfFile);
|
||||
- pheader_offset = elf_getProgramHeaderOffset(elfFile, 0);
|
||||
//printf("Number of program headers: %d\n", num_pheaders);
|
||||
- //printf("Program header offset of first header from file beginning: 0x%p\n",pheader_offset);
|
||||
|
||||
/*
|
||||
* FIXME:
|
||||
@@ -373,8 +369,6 @@ elf_loadFile(void *elfFile, bool phys)
|
||||
// printf("This section's size in file: %p\n", len);
|
||||
src = (uint64_t) (uintptr_t) elfFile + elf_getProgramHeaderOffset(elfFile, i);
|
||||
// printf("Elf program header offset: %p\n", src);
|
||||
- pheader_type = elf_getProgramHeaderType(elfFile, i);
|
||||
- // printf("Elf program header type: %p\n", pheader_type);
|
||||
// Comment
|
||||
printf("Copying to range from 0x%x to 0x%x of size: 0x%x\n", (unsigned int)dest, (unsigned int)dest + (unsigned int)len, (unsigned int)len);
|
||||
memcpy((void*) (uintptr_t) dest, (void*) (uintptr_t) src, len);
|
||||
diff --git a/loader/libs/elf/src/elf32.c b/loader/libs/elf/src/elf32.c
|
||||
index 2d13798..78bbf33 100644
|
||||
--- a/loader/libs/elf/src/elf32.c
|
||||
+++ b/loader/libs/elf/src/elf32.c
|
||||
@@ -248,7 +248,6 @@ elf32_fprintf(FILE *f, struct Elf32_Header *file, int size, const char *name, in
|
||||
struct Elf32_Shdr *sections;
|
||||
unsigned numSections;
|
||||
int i, r;
|
||||
- char *str_table;
|
||||
|
||||
fprintf(f, "Found an elf32 file called \"%s\" located "
|
||||
"at address 0x%p\n", name, file);
|
||||
@@ -307,7 +306,6 @@ elf32_fprintf(FILE *f, struct Elf32_Header *file, int size, const char *name, in
|
||||
}
|
||||
}
|
||||
if (flags & ELF_PRINT_SECTIONS) {
|
||||
- str_table = elf32_getSegmentStringTable(file);
|
||||
|
||||
printf("Section Headers:\n");
|
||||
printf(" [Nr] Name Type Addr Off\n");
|
||||
diff --git a/src/generic/capability.c b/src/generic/capability.c
|
||||
index 0860ea5..ef44445 100644
|
||||
--- a/src/generic/capability.c
|
||||
+++ b/src/generic/capability.c
|
||||
@@ -403,7 +403,7 @@ struct capability *cap_match_mem(struct capability *cap,
|
||||
{
|
||||
struct sys_map_args *args = args_ptr;
|
||||
struct ktcb *target = args->task;
|
||||
- unsigned long long start, end, pfn_point;
|
||||
+ unsigned long long start, pfn_point;
|
||||
unsigned long pfn;
|
||||
unsigned int perms;
|
||||
|
||||
@@ -415,7 +415,6 @@ struct capability *cap_match_mem(struct capability *cap,
|
||||
|
||||
/* Long long range check to avoid overflow */
|
||||
start = cap->start;
|
||||
- end = cap->end;
|
||||
pfn_point = pfn;
|
||||
if (start > pfn_point || cap->end < pfn_point + args->npages)
|
||||
return 0;
|
||||
diff --git a/loader/main.c b/loader/main.c
|
||||
index 7d21a4c..8d7d6db 100644
|
||||
--- a/loader/main.c
|
||||
+++ b/loader/main.c
|
||||
@@ -26,7 +26,6 @@ int load_elf_image(unsigned long **entry, void *filebuf);
|
||||
int load_container_image(void *cont_section)
|
||||
{
|
||||
struct Elf32_Header *elf_header = (struct Elf32_Header *)cont_section;
|
||||
- struct Elf32_Shdr *sect_header;
|
||||
int nsect;
|
||||
int nimgs = 0;
|
||||
unsigned long *image_entry;
|
||||
@@ -36,7 +35,6 @@ int load_container_image(void *cont_section)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- sect_header = elf32_getSectionTable(elf_header);
|
||||
nsect = elf32_getNumSections(elf_header);
|
||||
|
||||
for (int i = 0; i < nsect; i++) {
|
||||
@@ -59,7 +57,6 @@ int load_container_image(void *cont_section)
|
||||
int load_container_images(unsigned long start, unsigned long end)
|
||||
{
|
||||
struct Elf32_Header *elf_header = (struct Elf32_Header *)start;
|
||||
- struct Elf32_Shdr *sect_header;
|
||||
int nsect = 0;
|
||||
int nconts = 0;
|
||||
|
||||
@@ -68,7 +65,6 @@ int load_container_images(unsigned long start, unsigned long end)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- sect_header = elf32_getSectionTable(elf_header);
|
||||
nsect = elf32_getNumSections(elf_header);
|
||||
|
||||
for (int i = 0; i < nsect; i++) {
|
||||
10
base-codezero/patches/gcc_shared_enabled.patch
Normal file
10
base-codezero/patches/gcc_shared_enabled.patch
Normal file
@@ -0,0 +1,10 @@
|
||||
diff --git a/loader/main.c b/loader/main.c
|
||||
index 7d21a4c..ee03918 100644
|
||||
--- a/loader/main.c
|
||||
+++ b/loader/main.c
|
||||
@@ -135,3 +135,5 @@ int main(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
+
|
||||
+asm(".global __aeabi_unwind_cpp_pr0; __aeabi_unwind_cpp_pr0:");
|
||||
21
base-codezero/patches/libc_search_dir.patch
Normal file
21
base-codezero/patches/libc_search_dir.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
diff --git a/conts/userlibs/SConstruct b/conts/userlibs/SConstruct
|
||||
index 41c7913..421b563 100644
|
||||
--- a/conts/userlibs/SConstruct
|
||||
+++ b/conts/userlibs/SConstruct
|
||||
@@ -11,6 +11,7 @@ PROJRELROOT = '../..'
|
||||
sys.path.append(PROJRELROOT)
|
||||
|
||||
from scripts.config.config_invoke import *
|
||||
+from scripts.config.projpaths import *
|
||||
|
||||
config = configuration_retrieve()
|
||||
gcc_arch_flag = config.gcc_arch_flag
|
||||
@@ -28,7 +29,7 @@ env = Environment(CC = config.toolchain_userspace + 'gcc',
|
||||
ASFLAGS = ['-D__ASSEMBLY__', '-march=' + gcc_arch_flag],
|
||||
ENV = {'PATH' : os.environ['PATH']},
|
||||
LIBS = 'gcc', # libgcc.a - Required for division routines.
|
||||
- CPPPATH = KERNEL_HEADERS,
|
||||
+ CPPPATH = [KERNEL_HEADERS, LIBC_INCLUDE],
|
||||
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
|
||||
|
||||
# Set the build directory for this source tree
|
||||
97
base-codezero/patches/scons-2.0.1.patch
Normal file
97
base-codezero/patches/scons-2.0.1.patch
Normal file
@@ -0,0 +1,97 @@
|
||||
diff --git a/src/drivers/SConscript b/src/drivers/SConscript
|
||||
index eedb59f..8f5cd5d 100644
|
||||
--- a/src/drivers/SConscript
|
||||
+++ b/src/drivers/SConscript
|
||||
@@ -8,24 +8,24 @@ src_local = []
|
||||
objs = []
|
||||
|
||||
objs += SConscript("uart/pl011/SConscript", exports = { 'env' : env },
|
||||
- duplicate=0, build_dir = join(bdir, 'pl011'))
|
||||
+ duplicate=0, variant_dir = join(bdir, 'pl011'))
|
||||
|
||||
objs += SConscript("timer/sp804/SConscript", exports = { 'env' : env },
|
||||
- duplicate=0, build_dir = join(bdir, 'timer'))
|
||||
+ duplicate=0, variant_dir = join(bdir, 'timer'))
|
||||
|
||||
objs += SConscript("irq/pl190/SConscript", exports = { 'env' : env },
|
||||
- duplicate=0, build_dir = join(bdir, 'vic'))
|
||||
+ duplicate=0, variant_dir = join(bdir, 'vic'))
|
||||
|
||||
objs += SConscript("irq/gic/SConscript", exports = { 'env' : env },
|
||||
- duplicate=0, build_dir = join(bdir, 'gic'))
|
||||
+ duplicate=0, variant_dir = join(bdir, 'gic'))
|
||||
|
||||
objs += SConscript("irq/omap3/SConscript", exports = { 'env' : env },
|
||||
- duplicate=0, build_dir = join(bdir, 'omap/intc'))
|
||||
+ duplicate=0, variant_dir = join(bdir, 'omap/intc'))
|
||||
|
||||
objs += SConscript("uart/omap/SConscript", exports = { 'env' : env },
|
||||
- duplicate=0, build_dir = join(bdir, 'omap/uart'))
|
||||
+ duplicate=0, variant_dir = join(bdir, 'omap/uart'))
|
||||
|
||||
objs += SConscript("timer/omap/SConscript", exports = { 'env' : env },
|
||||
- duplicate=0, build_dir = join(bdir, 'omap/timer'))
|
||||
+ duplicate=0, variant_dir = join(bdir, 'omap/timer'))
|
||||
|
||||
Return('objs')
|
||||
diff --git a/conts/baremetal/empty/SConstruct b/conts/baremetal/empty/SConstruct
|
||||
index b70d69a..4889d8e 100644
|
||||
--- a/conts/baremetal/empty/SConstruct
|
||||
+++ b/conts/baremetal/empty/SConstruct
|
||||
@@ -48,7 +48,7 @@ env = Environment(CC = config.toolchain_userspace + 'gcc',
|
||||
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
|
||||
|
||||
objs = SConscript('SConscript', exports = { 'env' : env },
|
||||
- duplicate=0, build_dir = builddir)
|
||||
+ duplicate=0, variant_dir = builddir)
|
||||
|
||||
Depends(objs, join(PROJROOT, CONFIG_H))
|
||||
prog = env.Program(join(builddir, 'main.elf'), objs)
|
||||
diff --git a/SConstruct b/SConstruct
|
||||
index 2abc190..58c983d 100644
|
||||
--- a/SConstruct
|
||||
+++ b/SConstruct
|
||||
@@ -71,35 +71,35 @@ env = Environment(CC = config.toolchain_kernel + 'gcc',
|
||||
objects = []
|
||||
objects += SConscript('src/generic/SConscript',
|
||||
exports = { 'env' : env }, duplicate = 0,
|
||||
- build_dir = join(builddir, 'generic'))
|
||||
+ variant_dir = join(builddir, 'generic'))
|
||||
|
||||
objects += SConscript(join(join('src/glue', arch), 'SConscript'),
|
||||
exports = { 'env' : env }, duplicate = 0,
|
||||
- build_dir = join(builddir, join('glue',arch)))
|
||||
+ variant_dir = join(builddir, join('glue',arch)))
|
||||
|
||||
objects += SConscript(join(join('src/arch', arch), 'SConscript'),
|
||||
exports = { 'env' : env }, duplicate = 0,
|
||||
- build_dir = join(builddir, join('arch', arch)))
|
||||
+ variant_dir = join(builddir, join('arch', arch)))
|
||||
|
||||
objects += SConscript(join(join('src/arch', arch), join(subarch, 'SConscript')),
|
||||
exports = { 'env' : env }, duplicate = 0,
|
||||
- build_dir = join(builddir, join(join('arch',arch), subarch)))
|
||||
+ variant_dir = join(builddir, join(join('arch',arch), subarch)))
|
||||
|
||||
objects += SConscript('src/lib/SConscript',
|
||||
exports = { 'env' : env }, duplicate = 0,
|
||||
- build_dir = join(builddir, 'lib'))
|
||||
+ variant_dir = join(builddir, 'lib'))
|
||||
|
||||
objects += SConscript('src/api/SConscript',
|
||||
exports = { 'env' : env }, duplicate = 0,
|
||||
- build_dir = join(builddir, 'api'))
|
||||
+ variant_dir = join(builddir, 'api'))
|
||||
|
||||
objects += SConscript('src/drivers/SConscript',
|
||||
exports = { 'env' : env, 'bdir' : 'driver/'}, duplicate = 0,
|
||||
- build_dir = join(builddir, 'driver'))
|
||||
+ variant_dir = join(builddir, 'driver'))
|
||||
|
||||
objects += SConscript(join(join('src/platform', platform), 'SConscript'),
|
||||
exports = { 'env' : env }, duplicate = 0,
|
||||
- build_dir = join(builddir, join('platform', platform)))
|
||||
+ variant_dir = join(builddir, join('platform', platform)))
|
||||
|
||||
|
||||
# Add builders for generating kernel linker scripts
|
||||
13
base-codezero/patches/set_fixed_pager.patch
Normal file
13
base-codezero/patches/set_fixed_pager.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/include/l4/generic/tcb.h b/include/l4/generic/tcb.h
|
||||
index 7b315b8..ace38d8 100644
|
||||
--- a/include/l4/generic/tcb.h
|
||||
+++ b/include/l4/generic/tcb.h
|
||||
@@ -70,7 +70,7 @@ struct task_ids {
|
||||
|
||||
struct container;
|
||||
|
||||
-#define tcb_pagerid(tcb) ((tcb)->pager->tid)
|
||||
+#define tcb_pagerid(tcb) 3
|
||||
|
||||
#define space_is_pager(tcb) \
|
||||
((tcb)->space->spid == (tcb)->pager->space->spid)
|
||||
Reference in New Issue
Block a user