Browse Source

codezero: remove support from Genode (fix #1668)

devel
Stefan Kalkowski 7 years ago committed by Christian Helmuth
parent
commit
acc46f70b7
  1. 2
      README
  2. 4
      doc/challenges.txt
  3. 1
      doc/components.txt
  4. 4
      repos/README
  5. 25
      repos/base-codezero/Makefile
  6. 3
      repos/base-codezero/README
  7. 240
      repos/base-codezero/config/vpb926.cml
  8. 274
      repos/base-codezero/doc/codezero.txt
  9. 1
      repos/base-codezero/etc/specs.conf
  10. 33
      repos/base-codezero/include/arm/cpu/atomic.h
  11. 63
      repos/base-codezero/include/base/ipc_msgbuf.h
  12. 113
      repos/base-codezero/include/base/native_types.h
  13. 0
      repos/base-codezero/include/codezero/dummies/stdio.h
  14. 0
      repos/base-codezero/include/codezero/dummies/string.h
  15. 85
      repos/base-codezero/include/codezero/syscalls.h
  16. 1
      repos/base-codezero/lib/import/import-syscall.mk
  17. 11
      repos/base-codezero/lib/mk/arm_v5/l4_arm_v5.mk
  18. 3
      repos/base-codezero/lib/mk/arm_v5/syscall.mk
  19. 33
      repos/base-codezero/lib/mk/base-common.mk
  20. 14
      repos/base-codezero/lib/mk/base.mk
  21. 3
      repos/base-codezero/lib/mk/codezero_cml.inc
  22. 51
      repos/base-codezero/lib/mk/l4.inc
  23. 5
      repos/base-codezero/lib/mk/pl011/core_printf.mk
  24. 33
      repos/base-codezero/lib/mk/platform.mk
  25. 5
      repos/base-codezero/lib/mk/startup.mk
  26. 39
      repos/base-codezero/mk/spec-codezero.mk
  27. 13
      repos/base-codezero/mk/spec-codezero_arm.mk
  28. 9
      repos/base-codezero/mk/spec-codezero_arm_v5.mk
  29. 6
      repos/base-codezero/mk/spec-codezero_platform_vpb926.mk
  30. 67
      repos/base-codezero/patches/README
  31. 27
      repos/base-codezero/patches/binutils-2.21.patch
  32. 166
      repos/base-codezero/patches/gcc_4_6_1_fixes.patch
  33. 8
      repos/base-codezero/patches/gcc_shared_enabled.patch
  34. 19
      repos/base-codezero/patches/libc_search_dir.patch
  35. 91
      repos/base-codezero/patches/scons-2.0.1.patch
  36. 11
      repos/base-codezero/patches/set_fixed_pager.patch
  37. 1
      repos/base-codezero/ports/codezero.hash
  38. 9
      repos/base-codezero/ports/codezero.port
  39. 78
      repos/base-codezero/src/base/console/pl011/core_console.h
  40. 53
      repos/base-codezero/src/base/cxx/exception.cc
  41. 24
      repos/base-codezero/src/base/cxx/memcmp.cc
  42. 30
      repos/base-codezero/src/base/env/utcb.cc
  43. 175
      repos/base-codezero/src/base/ipc/ipc.cc
  44. 48
      repos/base-codezero/src/base/lock/cmpxchg.cc
  45. 61
      repos/base-codezero/src/base/lock/lock_helper.h
  46. 96
      repos/base-codezero/src/base/thread/thread_bootstrap.cc
  47. 77
      repos/base-codezero/src/base/thread/thread_start.cc
  48. 70
      repos/base-codezero/src/core/core_rm_session.cc
  49. 30
      repos/base-codezero/src/core/cpu_session_support.cc
  50. 55
      repos/base-codezero/src/core/include/core_rm_session.h
  51. 166
      repos/base-codezero/src/core/include/ipc_pager.h
  52. 66
      repos/base-codezero/src/core/include/map_local.h
  53. 72
      repos/base-codezero/src/core/include/platform.h
  54. 90
      repos/base-codezero/src/core/include/platform_pd.h
  55. 168
      repos/base-codezero/src/core/include/platform_thread.h
  56. 46
      repos/base-codezero/src/core/include/util.h
  57. 27
      repos/base-codezero/src/core/io_mem_session_support.cc
  58. 134
      repos/base-codezero/src/core/irq_session_component.cc
  59. 182
      repos/base-codezero/src/core/pager.cc
  60. 302
      repos/base-codezero/src/core/platform.cc
  61. 130
      repos/base-codezero/src/core/platform_pd.cc
  62. 112
      repos/base-codezero/src/core/platform_thread.cc
  63. 65
      repos/base-codezero/src/core/ram_session_support.cc
  64. 28
      repos/base-codezero/src/core/rm_session_support.cc
  65. 63
      repos/base-codezero/src/core/target.inc
  66. 4
      repos/base-codezero/src/core/target.mk
  67. 121
      repos/base-codezero/src/core/thread_start.cc
  68. 71
      repos/base-codezero/src/kernel/target.mk
  69. 22
      repos/base-codezero/src/lib/syscall/dummy.c
  70. 131
      repos/base-codezero/src/platform/genode.ld
  71. 202
      repos/base-codezero/tool/gen_romfs
  72. 2
      repos/base-sel4/src/core/include/ipc_pager.h
  73. 32
      repos/base/include/arm_v5/cpu/memory_barrier.h
  74. 2
      repos/base/include/base/native_capability.h
  75. 11
      repos/base/mk/spec-arm_v5.mk
  76. 18
      repos/base/mk/spec-platform_vpb926.mk
  77. 2
      repos/base/src/core/rm_session_component.cc
  78. 69
      repos/os/include/platform/vpb926/pl011_defs.h
  79. 32
      repos/os/include/platform/vpb926/pl050_defs.h
  80. 34
      repos/os/include/platform/vpb926/pl11x_defs.h
  81. 28
      repos/os/include/platform/vpb926/sp810_defs.h
  82. 13
      repos/os/lib/mk/codezero/timer.mk
  83. 7
      repos/os/src/drivers/framebuffer/pl11x/vpb926/target.mk
  84. 8
      repos/os/src/drivers/input/ps2/pl050/irq_handler.h
  85. 1
      repos/os/src/drivers/input/ps2/pl050/stdio.h
  86. 1
      repos/os/src/drivers/input/ps2/pl050/string.h
  87. 41
      repos/os/src/drivers/timer/codezero/platform_timer.cc
  88. 8
      tool/builddir/etc/build.conf.codezero_vpb926
  89. 4
      tool/create_builddir
  90. 65
      tool/run/boot_dir/codezero

2
README

@ -13,7 +13,7 @@ the project's official website:
[http://genode.org/documentation/general-overview]
The current implementation can be compiled for 8 different kernels: Linux,
L4ka::Pistachio, L4/Fiasco, OKL4, NOVA, Fiasco.OC, Codezero, and a custom
L4ka::Pistachio, L4/Fiasco, OKL4, NOVA, Fiasco.OC, seL4, and a custom
kernel for running Genode directly on ARM-based hardware. Whereas the Linux
version serves us as development vehicle and enables us to rapidly develop the
generic parts of the system, the actual target platforms of the framework are

4
doc/challenges.txt

@ -359,9 +359,9 @@ Platforms
:Evaluation of MP scheduling models on different Genode base platforms:
Several of Genode's supported base platforms come with multi-processor
support, i.e., Linux, NOVA, L4ka::Pistachio, Codezero, and Fiasco.OC. Each of
support, i.e., Linux, NOVA, L4ka::Pistachio, and Fiasco.OC. Each of
these kernels follows a different approach for utilizing multiple CPUs. For
example, Linux and Codezero manage the association of threads with CPUs
example, Linux manages the association of threads with CPUs
largely transparent for user-level programs. In contrast, NOVA makes the use
of multiple CPUs explicit and constraints the modes of IPC interaction of
threads running on different CPUs. Furthermore, kernels differ with regard to

1
doc/components.txt

@ -169,7 +169,6 @@ different time sources. Time sources are either hardware timers, a time source
provided by the kernel, or a pseudo time source (busy):
:'nova': NOVA kernel semaphores as time source
:'codezero': busy time source
:'okl4_x86': PIT as time source
:'foc': IPC timeout as time source
:'fiasco': IPC timeout as time source

4
repos/README

@ -57,10 +57,6 @@ but build upon of each other:
L4/Fiasco kernel developed at University of Technology Dresden.
See [http://genode.org/documentation/platforms/fiasco]
:'codezero':
Codezero microkernel developed by B-Labs
See [http://genode.org/documentation/platforms/codezero]
:'sel4':
seL4 microkernel developed at NICTA/General Dynamics
See[https://sel4.systems/]

25
repos/base-codezero/Makefile

@ -1,25 +0,0 @@
#
# \brief Download and prepare the Codezero kernel
# \author Norman Feske
# \date 2011-08-05
#
VERBOSE ?= @
ECHO := @echo
#
# Print help information by default
#
help::
prepare:
$(VERBOSE)../../tool/ports/prepare_port codezero
help::
$(ECHO)
$(ECHO) "Prepare the codezero base repository"
$(ECHO)
$(ECHO) "--- available commands ---"
$(ECHO) "prepare - checkout upstream source codes"
$(ECHO) "clean - remove upstream source codes"
$(ECHO)

3
repos/base-codezero/README

@ -1,3 +0,0 @@
This repository contains the port of Genode to the Codezero microkernel
For instructions about using Genode with Codezero, please refer to
'doc/codezero.txt'.

240
repos/base-codezero/config/vpb926.cml

@ -1,240 +0,0 @@
#
# Automatically generated, don't edit
#
# Generated on: furnace
# At: Fri, 05 Aug 2011 21:48:00 +0000
# Linux version 2.6.32-33-generic (buildd@rothera) (gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) ) #70-Ubuntu SMP Thu Jul 7 21:09:46 UTC 2011
#
# Codezero Microkernel Configurator
#
#
# Main architecture
#
CONFIG_ARCH_ARM=y
#
# ARM Architecture Configuration
#
#
# ARM Platform Type
#
CONFIG_PLATFORM_PB926=y
CONFIG_PLATFORM_PBA9=n
CONFIG_PLATFORM_BEAGLE=n
CONFIG_PLATFORM_EB=n
#
# ARM Processor Type
#
CONFIG_CPU_ARM926=y
#
# Generic Processor Properties
#
CONFIG_ICACHE_DISABLE=n
CONFIG_DCACHE_DISABLE=n
#
# Generic Kernel Properties
#
CONFIG_PREEMPT_DISABLE=n
CONFIG_DEBUG_ACCOUNTING=n
CONFIG_DEBUG_SPINLOCKS=n
CONFIG_SCHED_TICKS=1000
#
# Toolchain Prefix
#
CONFIG_TOOLCHAIN_USERSPACE="arm-none-linux-gnueabi-"
CONFIG_TOOLCHAIN_KERNEL="arm-none-eabi-"
#
# Container Setup
#
CONFIG_CAPABILITIES=n
CONFIG_CONTAINERS=1
#
# Container 0 Parameters
#
#
# Container 0 Type
#
CONFIG_CONT0_TYPE_BAREMETAL=y
CONFIG_CONT0_TYPE_POSIX=n
CONFIG_CONT0_TYPE_LINUX=n
#
# Container 0 Options
#
CONFIG_CONT0_OPT_NAME="empty0"
#
# Baremetal Project Type
#
CONFIG_CONT0_BAREMETAL_PROJ_EMPTY=y
CONFIG_CONT0_BAREMETAL_PROJ_HELLO_WORLD=n
CONFIG_CONT0_BAREMETAL_PROJ_THREADS_DEMO=n
CONFIG_CONT0_BAREMETAL_PROJ_TEST_SUITE=n
CONFIG_CONT0_BAREMETAL_PROJ_UART_SERVICE=n
CONFIG_CONT0_BAREMETAL_PROJ_TIMER_SERVICE=n
CONFIG_CONT0_BAREMETAL_PROJ_KMI_SERVICE=n
CONFIG_CONT0_BAREMETAL_PROJ_MUTEX_DEMO=n
CONFIG_CONT0_BAREMETAL_PROJ_IPC_DEMO=n
#
# Container 0 Pager Linker Parameters
#
CONFIG_CONT0_PAGER_LMA=0x41000
CONFIG_CONT0_PAGER_VMA=0x100000
#
# Container 0 Pager Physical Memory Regions (Capabilities)
#
CONFIG_CONT0_PAGER_PHYSMEM_REGIONS=1
CONFIG_CONT0_PAGER_PHYS0_START=0x41000
CONFIG_CONT0_PAGER_PHYS0_END=0x4000000
#
# Container 0 Pager Virtual Memory Regions (Capabilities)
#
CONFIG_CONT0_PAGER_VIRTMEM_REGIONS=1
CONFIG_CONT0_PAGER_VIRT0_START=0x0
CONFIG_CONT0_PAGER_VIRT0_END=0x50000000
#
# Container 0 Pager Capabilities
#
#
# Container 0 Thread Pool Capability
#
CONFIG_CONT0_PAGER_CAP_THREADPOOL_USE=y
CONFIG_CONT0_PAGER_CAP_THREADPOOL_SIZE=64
#
# Container 0 Space Pool Capability
#
CONFIG_CONT0_PAGER_CAP_SPACEPOOL_USE=y
CONFIG_CONT0_PAGER_CAP_SPACEPOOL_SIZE=64
#
# Container 0 Mutex Pool Capability
#
CONFIG_CONT0_PAGER_CAP_MUTEXPOOL_USE=y
CONFIG_CONT0_PAGER_CAP_MUTEXPOOL_SIZE=100
#
# Container 0 Map Pool Capability
#
CONFIG_CONT0_PAGER_CAP_MAPPOOL_USE=y
CONFIG_CONT0_PAGER_CAP_MAPPOOL_SIZE=800
#
# Container 0 IPC Capability
#
CONFIG_CONT0_PAGER_CAP_IPC_USE=y
CONFIG_CONT0_PAGER_CAP_IPC_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_PAGER_CAP_IPC_TARGET_CURRENT_PAGER_SPACE=n
CONFIG_CONT0_PAGER_CAP_IPC_TARGET_OTHER_CONTAINER=n
CONFIG_CONT0_PAGER_CAP_IPC_TARGET_OTHER_PAGER=n
#
# Container 0 IRQ Control Capability
#
CONFIG_CONT0_PAGER_CAP_IRQCTRL_USE=y
#
# Container 0 Custom Capability 0 Parameters
#
CONFIG_CONT0_PAGER_CAP_CUSTOM0_USE=n
#
# Container 0 Custom Capability 1 Parameters
#
CONFIG_CONT0_PAGER_CAP_CUSTOM1_USE=n
#
# Container 0 Custom Capability 2 Parameters
#
CONFIG_CONT0_PAGER_CAP_CUSTOM2_USE=n
#
# Container 0 Custom Capability 3 Parameters
#
CONFIG_CONT0_PAGER_CAP_CUSTOM3_USE=n
#
# Container 0 Global Capabilities
#
#
# Container 0 IPC Capability
#
CONFIG_CONT0_CAP_IPC_USE=y
CONFIG_CONT0_CAP_IPC_TARGET_CURRENT_CONTAINER=y
CONFIG_CONT0_CAP_IPC_TARGET_CURRENT_PAGER_SPACE=n
CONFIG_CONT0_CAP_IPC_TARGET_OTHER_CONTAINER=n
CONFIG_CONT0_CAP_IPC_TARGET_OTHER_PAGER=n
#
# Container 0 Mutex Pool Capability
#
CONFIG_CONT0_CAP_MUTEXPOOL_USE=y
CONFIG_CONT0_CAP_MUTEXPOOL_SIZE=100
#
# Derived symbols
#
CONFIG_CONT3_START_PC_ADDR=0xd0000000
CONFIG_DEBUG_PERFMON_KERNEL=n
CONFIG_CONT1_PAGER_LOAD_ADDR=0x1100000
CONFIG_CONT2_START_PC_ADDR=0xc0000000
CONFIG_CONT2_PAGER_VIRT_ADDR=0xc0000000
CONFIG_RAM_BASE_PLAT=0
CONFIG_CONT2_PAGER_LOAD_ADDR=0x2100000
CONFIG_CONT1_PAGER_VIRT_ADDR=0xb0000000
CONFIG_CONT3_PAGER_LOAD_ADDR=0x3100000
CONFIG_SUBARCH_V5=y
CONFIG_SUBARCH_V7=n
CONFIG_SUBARCH_V6=n
CONFIG_CONT0_PAGER_LOAD_ADDR=0x41000
CONFIG_CONT0_PAGER_VIRT_ADDR=0x100000
CONFIG_CONT3_PAGER_VIRT_ADDR=0xd0000000
CONFIG_CONT0_START_PC_ADDR=0x100000
CONFIG_CONT1_START_PC_ADDR=0xb0000000
#
# That's all, folks!

274
repos/base-codezero/doc/codezero.txt

@ -1,274 +0,0 @@
==================================
Genode on the Codezero microkernel
==================================
Norman Feske
Codezero is a microkernel primarily targeted at ARM-based embedded systems.
It is developed by the British company B-Labs.
:B-Labs website:
[http://b-labs.com]
The Codezero kernel was first made publicly available in summer 2009. The
latest version, documentation, and community resources are available at the
project website:
:Codezero project website:
[http://l4dev.org]
As highlighted by the name of the project website, the design of the kernel is
closely related to the family of L4 microkernels. In short, the kernel provides
a minimalistic set of functionality for managing address spaces, threads, and
communication between threads, but leaves complicated policy and device access
to user-level components.
Using Genode with Codezero
##########################
For using Codezero, please ensure to have Git, SCons, and Python installed as
these tools are required for downloading and building the kernel. Furthermore,
you will need to install the tool chain for ARM. For instructions on how to
download and install the tool chain, please refer to:
:[http://genode.org/download/tool-chain]:
Genode tool-chain
To download the Codezero kernel and integrate it with Genode, issue
! make prepare
from the 'base-codezero/' directory. The Codezero kernel is fully supported by
Genode's run mechanism. Therefore, you can run Genode scenarios using Qemu
directly from the build directory. For a quick test, let's create a build
directory for Codezero on the VersatilePB926 platform using Genode's
'create_builddir' tool:
! <genode-dir>/tool/create_builddir codezero_vpb926 BUILD_DIR=<build_dir>
To execute the graphical Genode demo, change to the new created build directory
and issue:
! make run/demo
Characteristics of the kernel
#############################
To put Codezero in relation to other L4 kernels, here is a quick summary on the
most important design aspects as implemented with the version 0.3, and on how
our port of Genode relates to them:
* In the line of the original L4 interface, the kernel uses global name spaces
for kernel objects such as threads and address spaces.
* For the interaction between a user thread and the kernel, the concept of
user-level thread-control blocks (UTCB) is used. A UTCB is a small
thread-specific region in the thread's virtual address space, which is
always mapped. Hence the access to the UTCB can never raise a page fault,
which makes it perfect for the kernel to access system-call arguments,
in particular IPC payload copied from/to user threads. In contrast to other
L4 kernels, the location of UTCBs within the virtual address space is managed
by the user land.
On Genode, core keeps track of the UTCB locations for all user threads.
This way, the physical backing store for the UTCB can be properly accounted
to the corresponding protection domain.
* The kernel provides three kinds of synchronous inter-process communication
(IPC): Short IPC carries payload in CPU registers only. Full IPC copies
message payload via the UTCBs of the communicating parties. Extended IPC
transfers a variable-sized message from/to arbitrary locations of the
sender/receiver address spaces. During an extended IPC, page fault may
occur.
Genode solely relies on extended IPC, leaving the other IPC mechanisms to
future optimizations.
* The scheduling of threads is based on hard priorities. Threads with the
same priority are executed in a round-robin fashion. The kernel supports
time-slice-based preemption.
Genode does not support Codezero priorities yet.
* The original L4 interface leaves open the question on how to manage
and account kernel resources such as the memory used for page tables.
Codezero makes the accounting of such resources explicit, enables the
user-land to manage them in a responsible way, and prevent kernel-resource
denial-of-service problems.
* In contrast to the original L4.v2 and L4.x0 interfaces, the kernel provides
no time source in the form of IPC timeouts to the user land. A time source
must be provided by a user-space timer driver. Genode employs such a timer
services on all platforms so that it is not effected by this limitation.
In several ways, Codezero goes beyond the known L4 interfaces. The most
noticeable addition is the support for so-called containers. A container is
similar to a virtual machine. It is an execution environment that holds a set
of physical resources such as RAM and devices. The number of containers and the
physical resources assigned to them is static and is to be defined at build
time. The code executed inside a container can be roughly classified into two
cases. First, there are static programs that require strong isolation from the
rest of the system but no classical operating-system infrastructure, for
example special-purpose telecommunication stacks or cryptographic functionality
of an embedded device. Second, there a kernel-like workload, which use the L4
interface to substructure the container into address spaces, for example a
paravirtualized Linux kernel that uses Codezero address spaces to protect Linux
processes. Genode runs inside a container and facilitates Codezero's L4
interface to implement its multi-server architecture.
Behind the scenes
#################
The 'make prepare' mechanism checks out the kernel source code from the
upstream Git repository to 'base-codezero/contrib'. When building the kernel
from within a Genode build directory via 'make kernel', this directory won't be
touched by the Genode build system. Instead, a snapshot of the 'contrib'
directory is taken to '<build-dir>/kernel/codezero'. This is the place where
the Codezero configuration and build processes are executed. By working with a
build-directory-local snapshot, we ensure that the source tree remains
untouched at all times. After having taken the snapshot, the Codezero kernel is
configured using a configuration template specific for the hardware platform.
The configuration comes in the form of a CML file located at
'base-codezero/config/'. There is one CML file per supported platform named
'<platform>.cml'. The configured Codezero build directory will reside at
'<build-dir>/kernel/codezero/build/'. Finally, the Codezero build system is
invoked to build the kernel.
The two stages of building Codezero
===================================
The Codezero build system always performs the compilation of the kernel and the
so-called containers as well as the integration of all these components into a
final ELF image as one operation. When building just the kernel via 'make
kernel', the final image will contain the default container0 that comes with
the Codezero distribution. For integrating Genode into the final image, the
content of the container0 must be replaced by the Genode binaries followed by
another execution of 'kernel/codezero/build.py'. Now, the single-image will be
re-created, including the Genode binaries. When using Genode's run mechanism,
these steps are automated for you. For reference, please review the Codezero
run environment at 'base-codezero/run/env'.
By first building the kernel with Codezero's default container ('make kernel')
and later replacing the container's content with Genode binaries, we
optimize the work flow for building Genode components. The kernel is compiled
only once, but the (quick) re-linking of the final image is done every time a
run script is executed.
In the run environment, you will see that we forcefully remove a file called
'cinfo.c' from the build-directory-local snapshot of the Codezero source tree.
This file is generated automatically by the Codezero build system and linked
against the kernel. It contains the parameters of the containers executed on
the kernel. Because we change the content of container0 each time when
executing a run script, those parameter change. So we have to enforce to
re-generation of the 'cinfo.c' file.
How Genode ROM modules are passed into the final image
======================================================
The Codezero build system picks up any ELF files residing the container's
directory wheres the file called 'main.elf' is considered to be the roottask
(in Codezero speak called pager) of the container. For Genode, 'main.elf'
corresponds to the core executable. All other boot modules are merged into an
ELF file, which we merely use as a container for these binary data. This ELF
file is linked such that it gets loaded directly after the core image (this is
how core finds the boot modules). The process of archiving all boot modules
into the single ELF file is automated via the 'base-codezero/tool/gen_romfs'
tool. In the container's directory, the merged file is called 'modules.elf'.
Adapting the source code of the kernel
======================================
For debugging and development you might desire to change the kernel code
at times. You can safely do so within the 'base-codezero/contrib/' directory.
When issuing the next 'make kernel' from the Genode build directory, your
changes will be picked up. However, when working with run scripts, the kernel
is not revisited each time. The kernel gets built only once if the
'<build-dir>/kernel' directory does not exist, yet. If you work on the kernel
source tree and wish to conveniently test the kernel with a run script, use
! make kernel run/<run-script>
This way, you make sure to rebuild the kernel prior executing the steps
described in the run script.
Tweaking the kernel configuration
=================================
The kernel configuration can be tweaked within '<build-dir>/kernel/codezero'.
Just change to this directory and issue './build.py -C'. The next time you
build the kernel via 'make kernel' your configuration will be applied.
If you want to conserve your custom configuration, just copy the file
'<build-dir>/kernel/codezero/build/config.cml'.
Parameters of 'vpb926.cml' explained
====================================
The default configuration for the VersatilePB926 platform as found at
'base-codzero/config/vpb926.cml' is paramaterized as follows:
:Default pager parameters:
! 0x41000 Pager LMA
! 0x100000 Pager VMA
These values are important because they are currently hard-wired in the
linker script used by Genode. If you need to adopt these values, make
sure to also update the Genode linker script located at
'base-codezero/src/platform/genode.ld'.
:Physical Memory Regions:
! 1 Number of Physical Regions
! 0x41000 Physical Region 0 Start Address
! 0x4000000 Physical Region 0 End Address
We only use 64MB of memory. The physical memory between 0 and 0x41000 is
used by the kernel.
:Virtual Memory Regions:
! 1 Number of Virtual Regions
! 0x0 Virtual Region 0 Start Address
! 0x50000000 Virtual Region 0 End Address
It is important to choose the end address such that the virtual memory
covers the thread context area. The context area is defined at
'base/include/base/thread.h'.
Limitations
###########
At the current stage, the Genode version for Codezero is primarily geared
towards the developers of Codezero as a workload to stress their kernel. It
still has a number of limitations that would affect the real-world use:
* Because the only platform supported out of the box by the official Codezero
source tree is the ARM-based Versatilebp board, Genode is currently tied to
this hardware platform.
* The current timer driver at 'os/src/drivers/timer/codezero/' is a dummy
driver that just yields the CPU time instead of blocking. Is is not
suitable as time source.
* The PL110 framebuffer driver at 'os/src/drivers/framebuffer/pl110/'
does only support the LCD display as provided by Qemu but it is not tested on
real hardware.
* Even though Codezero provides priority-based scheduling, Genode does not
allow assigning priorities to Codezero processes, yet.
As always, these limitations will be addressed as needed.
Thanks
######
We want to thank the main developer of Codezero Bahadir Balban for his great
responsiveness to our feature requests and questions. Without his help, the
porting effort would have taken much more effort. We hope that our framework
will be of value to the Codezero community.

1
repos/base-codezero/etc/specs.conf

@ -1 +0,0 @@
SPECS = genode

33
repos/base-codezero/include/arm/cpu/atomic.h

@ -1,33 +0,0 @@
/*
* \brief Atomic operations for ARM on codezero
* \author Norman Feske
* \date 2009-10-02
*/
/*
* Copyright (C) 2009-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__ARM__CPU__ATOMIC_H_
#define _INCLUDE__ARM__CPU__ATOMIC_H_
namespace Genode {
/**
* Atomic compare and exchange
*
* This function compares the value at dest with cmp_val.
* If both values are equal, dest is set to new_val. If
* both values are different, the value at dest remains
* unchanged.
*
* \return 1 if the value was successfully changed to new_val,
* 0 if cmp_val and the value at dest differ.
*/
int cmpxchg(volatile int *dest, int cmp_val, int new_val);
}
#endif /* _INCLUDE__ARM__CPU__ATOMIC_H_ */

63
repos/base-codezero/include/base/ipc_msgbuf.h

@ -1,63 +0,0 @@
/*
* \brief IPC message buffer
* \author Norman Feske
* \date 2009-10-02
*/
/*
* Copyright (C) 2009-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__BASE__IPC_MSGBUF_H_
#define _INCLUDE__BASE__IPC_MSGBUF_H_
namespace Genode {
/**
* IPC message buffer layout
*/
class Msgbuf_base
{
protected:
size_t _size;
char _msg_start[]; /* symbol marks start of message */
public:
/*
* Begin of actual message buffer
*/
char buf[];
/**
* Return size of message buffer
*/
inline size_t size() const { return _size; };
/**
* Return address of message buffer
*/
inline void *addr() { return &_msg_start[0]; };
} __attribute__((aligned(4)));
/**
* Instance of IPC message buffer with specified buffer size
*/
template <unsigned BUF_SIZE>
class Msgbuf : public Msgbuf_base
{
public:
char buf[BUF_SIZE];
Msgbuf() { _size = BUF_SIZE; }
} __attribute__((aligned(4)));
}
#endif /* _INCLUDE__BASE__IPC_MSGBUF_H_ */

113
repos/base-codezero/include/base/native_types.h

@ -1,113 +0,0 @@
/*
* \brief Dummy definitions for native types used for compiling unit tests
* \author Norman Feske
* \date 2009-10-02
*/
/*
* Copyright (C) 2009-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__BASE__NATIVE_TYPES_H_
#define _INCLUDE__BASE__NATIVE_TYPES_H_
#include <base/native_capability.h>
#include <base/stdint.h>
namespace Codezero {
struct l4_mutex;
enum { NILTHREAD = -1 };
}
namespace Genode {
class Platform_thread;
struct Cap_dst_policy
{
typedef int Dst;
static bool valid(Dst tid) { return tid != Codezero::NILTHREAD; }
static Dst invalid() { return Codezero::NILTHREAD; }
static void copy(void* dst, Native_capability_tpl<Cap_dst_policy>* src);
};
typedef Cap_dst_policy::Dst Native_thread_id;
struct Native_thread
{
Native_thread_id l4id;
/**
* Only used in core
*
* For 'Thread' objects created within core, 'pt' points to the
* physical thread object, which is going to be destroyed on
* destruction of the 'Thread'.
*/
Platform_thread *pt;
};
/**
* Empty UTCB type expected by the thread library
*
* On this kernel, UTCBs are not placed within the the context area. Each
* thread can request its own UTCB pointer using the kernel interface.
* However, we use the 'Native_utcb' member of the thread context to
* hold thread-specific data, i.e. the running lock used by the lock
* implementation.
*/
struct Native_utcb
{
private:
/**
* Prevent construction
*
* A UTCB is never constructed, it is backed by zero-initialized memory.
*/
Native_utcb();
/**
* Backing store for per-thread running lock
*
* The size of this member must equal 'sizeof(Codezero::l4_mutex)'.
* Unfortunately, we cannot include the Codezero headers here.
*/
int _running_lock;
public:
Codezero::l4_mutex *running_lock() {
return (Codezero::l4_mutex *)&_running_lock; }
};
typedef Native_capability_tpl<Cap_dst_policy> Native_capability;
typedef int Native_connection_state;
struct Native_config
{
/**
* Thread-context area configuration.
*/
static constexpr addr_t context_area_virtual_base() {
return 0x40000000UL; }
static constexpr addr_t context_area_virtual_size() {
return 0x10000000UL; }
/**
* Size of virtual address region holding the context of one thread
*/
static constexpr addr_t context_virtual_size() { return 0x00100000UL; }
};
struct Native_pd_args { };
}
#endif /* _INCLUDE__BASE__NATIVE_TYPES_H_ */

0
repos/base-codezero/include/codezero/dummies/stdio.h

0
repos/base-codezero/include/codezero/dummies/string.h

85
repos/base-codezero/include/codezero/syscalls.h

@ -1,85 +0,0 @@
/*
* \brief Aggregate Codezero syscall bindings
* \author Norman Feske
* \date 2010-02-16
*/
/*
* Copyright (C) 2010-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__CODEZERO__SYSCALLS_H_
#define _INCLUDE__CODEZERO__SYSCALLS_H_
/*
* Codezero headers happen to include the compiler's 'stdarg.h'. If this
* happened within the 'Codezero' namespace below, we would not be able to
* include 'stdarg.h' later on into the root namespace (stdarg's include guards
* would prevent this. Therefore, we make sure to include the file into the
* root namespace prior processing any Codezero headers.
*/
#include <stdarg.h>
namespace Codezero { extern "C" {
/* make Codezero includes happy */
extern char *strncpy(char *dest, const char *src, __SIZE_TYPE__);
extern void *memcpy(void *dest, const void *src, __SIZE_TYPE__);
/*
* Work around the problem of C++ keywords being used as
* argument names in the Codezero API headers.
*/
#define new _new_
#define virtual _virtual_
#define printf(A, ...)
#include <l4lib/macros.h>
#include <l4lib/arch/arm/syscalls.h>
#include <l4lib/arch/arm/syslib.h>
#include <l4lib/ipcdefs.h>
#include <l4lib/init.h>
#include <l4lib/mutex.h>
#include <l4/api/thread.h>
#include <l4/api/irq.h>
#include <l4lib/exregs.h>
#include <l4/lib/list.h> /* needed for capability.h */
#include <l4/generic/capability.h>
#include <l4/generic/cap-types.h>
#include <l4/arch/arm/exception.h>
#include <l4/arch/arm/io.h>
#undef new
#undef virtual
#ifdef max
#undef max
#endif
#undef printf
/*
* Turn '#define cacheable' (as defined in the codezero headers) into an enum
* value. Otherwise, the define will conflict with variables named 'cacheable'.
*/
enum { _codezero_cacheable = cacheable /* #define value */ };
#undef cacheable
enum { cacheable = _codezero_cacheable };
} }
namespace Codezero {
/**
* Return thread ID of the calling thread
*/
inline int thread_myself()
{
struct task_ids ids = { 0, 0, 0 };
l4_getid(&ids);
return ids.tid;
}
}
#endif /* _INCLUDE__CODEZERO__SYSCALLS_H_ */

1
repos/base-codezero/lib/import/import-syscall.mk

@ -1 +0,0 @@
REP_INC_DIR += include/codezero/dummies

11
repos/base-codezero/lib/mk/arm_v5/l4_arm_v5.mk

@ -1,11 +0,0 @@
CODEZERO_DIR := $(call select_from_ports,codezero)/src/kernel/codezero
LIBL4_DIR = $(CODEZERO_DIR)/conts/userlibs/libl4
INC_DIR += $(CODEZERO_DIR)/conts/userlibs/libc/include
SRC_C += $(notdir $(wildcard $(LIBL4_DIR)/src/arch/arm/v5/*.c))
SRC_S += $(notdir $(wildcard $(LIBL4_DIR)/src/arch/arm/v5/*.S))
vpath %.c $(LIBL4_DIR)/src/arch/arm/v5
vpath %.S $(LIBL4_DIR)/src/arch/arm/v5

3
repos/base-codezero/lib/mk/arm_v5/syscall.mk

@ -1,3 +0,0 @@
LIBS += l4_arm_v5
include $(REP_DIR)/lib/mk/l4.inc

33
repos/base-codezero/lib/mk/base-common.mk

@ -1,33 +0,0 @@
#
# \brief Portions of base library shared by core and non-core processes
# \author Norman Feske
# \date 2013-02-14
#
LIBS += cxx syscall startup
SRC_CC += cap_copy.cc
SRC_CC += ipc/ipc.cc ipc/ipc_marshal_cap.cc
SRC_CC += avl_tree/avl_tree.cc
SRC_CC += allocator/slab.cc
SRC_CC += allocator/allocator_avl.cc
SRC_CC += heap/heap.cc heap/sliced_heap.cc
SRC_CC += console/console.cc
SRC_CC += child/child.cc
SRC_CC += process/process.cc
SRC_CC += elf/elf_binary.cc
SRC_CC += lock/lock.cc
SRC_CC += signal/signal.cc signal/common.cc signal/platform.cc
SRC_CC += server/server.cc server/common.cc
SRC_CC += thread/thread.cc thread/myself.cc thread/thread_bootstrap.cc thread/trace.cc
SRC_CC += thread/context_allocator.cc env/utcb.cc
SRC_CC += lock/cmpxchg.cc
INC_DIR += $(REP_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/thread
INC_DIR += $(REP_DIR)/include/codezero/dummies
vpath cap_copy.cc $(BASE_DIR)/src/platform
vpath %.cc $(REP_DIR)/src/base
vpath %.cc $(BASE_DIR)/src/base

14
repos/base-codezero/lib/mk/base.mk

@ -1,14 +0,0 @@
SRC_CC += console/log_console.cc
SRC_CC += cpu/cache.cc
SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc
SRC_CC += thread/thread_start.cc
SRC_CC += irq/platform.cc
INC_DIR += $(BASE_DIR)/src/base/env
INC_DIR += $(REP_DIR)/include/codezero/dummies
LIBS += base-common
vpath %.cc $(REP_DIR)/src/base
vpath %.cc $(BASE_DIR)/src/base

3
repos/base-codezero/lib/mk/codezero_cml.inc

@ -1,3 +0,0 @@
ifeq ($(filter-out $(SPECS),platform_vpb926),)
CODEZERO_CML = $(REP_DIR)/config/vpb926.cml
endif

51
repos/base-codezero/lib/mk/l4.inc

@ -1,51 +0,0 @@
CODEZERO_DIR := $(call select_from_ports,codezero)/src/kernel/codezero
LIBL4_DIR = $(CODEZERO_DIR)/conts/userlibs/libl4
SRC_C += init.c irq.c mutex.c
SRC_C += arch/arm/exregs.c
SRC_S += $(addprefix arch/arm/,syscalls.S new_thread.S)
SRC_C += $(addprefix lib/,addr.c bit.c idpool.c)
SRC_C += $(addprefix lib/thread/,init.c thread.c)
SRC_C += $(addprefix lib/cap/,cap.c read.c)
#
# Dummies
#
SRC_C += dummy.c
INC_DIR += $(CODEZERO_DIR)/conts/userlibs/libc/include
INC_DIR += $(CODEZERO_DIR)/conts/userlibs/libmem/include
INC_DIR += $(CODEZERO_DIR)/conts/userlibs/libmem
vpath % $(LIBL4_DIR)/src
vpath %.c $(REP_DIR)/src/lib/syscall
#
# The libl4 source files uses macros defined in macros.h but do not
# explicitly include the 'macros.h' header file.
#
CC_OPT += -include $(LIBL4_DIR)/include/l4lib/macros.h
#
# Resolve conflicts with built-in functions
#
CC_OPT += -fno-builtin-pow
#
# During the compilation of the libl4 file 'thread.c', the 'l4id_t' type
# is used without prior inclusion of 'types.h'. Furthermore, 'types.h'
# has a wrong include guard, so we take care of this problem using a
# wrapper.
#
CC_OPT_lib_thread_thread += -include fix_include_types.h
CC_OPT_arch_arm_exregs += -include fix_include_types.h
lib/thread/thread.o arch/arm/exregs.o: fix_include_types.h
fix_include_types.h:
@echo "#include <l4lib/arch/arm/types.h>" > $@
@echo "#define __L4LIB_ARM_TYPES_H___" >> $@
CC_OPT += -std=gnu99

5
repos/base-codezero/lib/mk/pl011/core_printf.mk

@ -1,5 +0,0 @@
SRC_CC = core_printf.cc
INC_DIR += $(REP_DIR)/src/base/console/pl011
INC_DIR += $(REP_DIR)/include/codezero/dummies
vpath core_printf.cc $(BASE_DIR)/src/base/console

33
repos/base-codezero/lib/mk/platform.mk

@ -1,33 +0,0 @@
#
# Create prerequisites for building Genode for Codezero
#
#
# Execute the rules in this file only at the second build stage when we know
# about the complete build settings, e.g., the 'CROSS_DEV_PREFIX'.
#
ifeq ($(called_from_lib_mk),yes)
include $(REP_DIR)/lib/mk/codezero_cml.inc
all: $(BUILD_BASE_DIR)/include/l4/config.h
$(BUILD_BASE_DIR)/include/l4/config.h: $(CODEZERO_CML)
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)$(CODEZERO_DIR)/tools/cml2header.py -i $^ -o $@
#
# Codezero's 'macros.h' includes the file "config.h", expected to be located in
# the same directory (using #include "config.h"). However, 'config.h' is
# generated into the source tree by the Codezero configuration system. Since we
# do not want to pollute the source tree, we create a shadow copy of 'macros.h'
# in the same directory as our generated 'config.h'.
#
all: $(BUILD_BASE_DIR)/include/l4/macros.h
$(BUILD_BASE_DIR)/include/l4/macros.h: $(CODEZERO_DIR)/include/l4/macros.h
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)ln -s $^ $@
endif

5
repos/base-codezero/lib/mk/startup.mk

@ -1,5 +0,0 @@
include $(BASE_DIR)/lib/mk/startup.inc
INC_DIR += $(REP_DIR)/include/codezero/dummies
vpath crt0.s $(BASE_DIR)/src/platform/arm

39
repos/base-codezero/mk/spec-codezero.mk

@ -1,39 +0,0 @@
#
# Specifics for the Codezero kernel API
#
CODEZERO_DIR := $(call select_from_ports,codezero)/src/kernel/codezero
#
# Convert path to absolute directory
#
absdir = $(shell readlink -f $(1))
#
# Headers generated within the build directory
# (see 'lib/mk/platform.mk')
#
INC_DIR += $(BUILD_BASE_DIR)/include
#
# Codezero headers
#
INC_DIR += $(CODEZERO_DIR)/include
INC_DIR += $(CODEZERO_DIR)/conts/userlibs/libl4/include
INC_DIR += $(CODEZERO_DIR)/conts/userlibs/libdev/uart/include
#
# Allow programs to test for the Codezero kernel
#
# This is needed by the 'pl050/irq_handler.h' to handle the interrupt semantics
# of Codezero.
#
CC_OPT += -D__CODEZERO__
#
# Clean rules for removing the side effects of building the platform
#
clean_includes:
$(VERBOSE)rm -rf $(BUILD_BASE_DIR)/include
cleanall: clean_includes

13
repos/base-codezero/mk/spec-codezero_arm.mk

@ -1,13 +0,0 @@
#
# Specifics for Codezero on ARM
#
SPECS += codezero
#
# Linker options specific for ARM
#
LD_TEXT_ADDR ?= 0x02000000
CC_OPT += -D__ARCH__=arm
include $(call select_from_repositories,mk/spec-codezero.mk)

9
repos/base-codezero/mk/spec-codezero_arm_v5.mk

@ -1,9 +0,0 @@
#
# Specifics for Codezero on ARMv5
#
SPECS += codezero_arm
CC_OPT += -D__SUBARCH__=v5
include $(call select_from_repositories,mk/spec-codezero_arm.mk)

6
repos/base-codezero/mk/spec-codezero_platform_vpb926.mk

@ -1,6 +0,0 @@
SPECS += codezero_arm_v5 platform_vpb926
CC_OPT += -D__PLATFORM__=pb926
include $(call select_from_repositories,mk/spec-codezero_arm_v5.mk)
include $(call select_from_repositories,mk/spec-platform_vpb926.mk)

67
repos/base-codezero/patches/README

@ -1,67 +0,0 @@
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.

27
repos/base-codezero/patches/binutils-2.21.patch

@ -1,27 +0,0 @@
--- src/kernel/codezero/src/arch/arm/vectors.S
+++ src/kernel/codezero/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
--- src/kernel/codezero/conts/userlibs/libc/src/arch-arm/memcpy.S
+++ src/kernel/codezero/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)
--- src/kernel/codezero/conts/userlibs/libc/src/arch-arm/memset.S
+++ src/kernel/codezero/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)

166
repos/base-codezero/patches/gcc_4_6_1_fixes.patch

@ -1,166 +0,0 @@
--- src/kernel/codezero/src/api/map.c
+++ src/kernel/codezero/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;
}
--- src/kernel/codezero/src/api/thread.c
+++ src/kernel/codezero/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
--- src/kernel/codezero/src/arch/arm/mapping-common.c
+++ src/kernel/codezero/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);
/*
--- src/kernel/codezero/src/glue/arm/init.c
+++ src/kernel/codezero/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__,
--- src/kernel/codezero/loader/libs/elf/src/elf.c
+++ src/kernel/codezero/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);
--- src/kernel/codezero/loader/libs/elf/src/elf32.c
+++ src/kernel/codezero/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");
--- src/kernel/codezero/src/generic/capability.c
+++ src/kernel/codezero/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;
--- src/kernel/codezero/loader/main.c
+++ src/kernel/codezero/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++) {

8
repos/base-codezero/patches/gcc_shared_enabled.patch

@ -1,8 +0,0 @@
--- src/kernel/codezero/loader/main.c
+++ src/kernel/codezero/loader/main.c
@@ -135,3 +135,5 @@ int main(void)
return -1;
}
+
+asm(".global __aeabi_unwind_cpp_pr0; __aeabi_unwind_cpp_pr0:");

19
repos/base-codezero/patches/libc_search_dir.patch

@ -1,19 +0,0 @@
--- src/kernel/codezero/conts/userlibs/SConstruct
+++ src/kernel/codezero/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

91
repos/base-codezero/patches/scons-2.0.1.patch

<
@ -1,91 +0,0 @@
--- src/kernel/codezero/src/drivers/SConscript
+++ src/kernel/codezero/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'))