Imported Genode release 11.11

devel 11.11
Genode Labs 11 years ago committed by Christian Helmuth
parent 6bcc9aef0e
commit da4e1feaa5
  1. 280
      LICENSE
  2. 182
      README
  3. 44
      base-codezero/Makefile
  4. 3
      base-codezero/README
  5. 240
      base-codezero/config/vpb926.cml
  6. 274
      base-codezero/doc/codezero.txt
  7. 1
      base-codezero/etc/specs.conf
  8. 33
      base-codezero/include/arm/cpu/atomic.h
  9. 63
      base-codezero/include/base/ipc_msgbuf.h
  10. 169
      base-codezero/include/base/ipc_pager.h
  11. 143
      base-codezero/include/base/native_types.h
  12. 0
      base-codezero/include/codezero/dummies/stdio.h
  13. 0
      base-codezero/include/codezero/dummies/string.h
  14. 76
      base-codezero/include/codezero/syscalls.h
  15. 9
      base-codezero/lib/mk/arm/startup.mk
  16. 3
      base-codezero/lib/mk/arm_v5/l4.mk
  17. 9
      base-codezero/lib/mk/arm_v5/l4_arm_v5.mk
  18. 3
      base-codezero/lib/mk/codezero_cml.inc
  19. 13
      base-codezero/lib/mk/cxx.mk
  20. 4
      base-codezero/lib/mk/ipc.mk
  21. 43
      base-codezero/lib/mk/l4.inc
  22. 7
      base-codezero/lib/mk/lock.mk
  23. 4
      base-codezero/lib/mk/pager.mk
  24. 6
      base-codezero/lib/mk/pl011/core_printf.mk
  25. 33
      base-codezero/lib/mk/platform.mk
  26. 5
      base-codezero/lib/mk/thread.mk
  27. 56
      base-codezero/mk/spec-codezero.mk
  28. 13
      base-codezero/mk/spec-codezero_arm.mk
  29. 9
      base-codezero/mk/spec-codezero_arm_v5.mk
  30. 6
      base-codezero/mk/spec-codezero_platform_vpb926.mk
  31. 67
      base-codezero/patches/README
  32. 33
      base-codezero/patches/binutils-2.21.patch
  33. 182
      base-codezero/patches/gcc_4_6_1_fixes.patch
  34. 10
      base-codezero/patches/gcc_shared_enabled.patch
  35. 21
      base-codezero/patches/libc_search_dir.patch
  36. 97
      base-codezero/patches/scons-2.0.1.patch
  37. 13
      base-codezero/patches/set_fixed_pager.patch
  38. 88
      base-codezero/run/env
  39. 78
      base-codezero/src/base/console/pl011/core_console.h
  40. 53
      base-codezero/src/base/cxx/exception.cc
  41. 24
      base-codezero/src/base/cxx/memcmp.cc
  42. 175
      base-codezero/src/base/ipc/ipc.cc
  43. 175
      base-codezero/src/base/ipc/pager.cc
  44. 48
      base-codezero/src/base/lock/cmpxchg.cc
  45. 63
      base-codezero/src/base/lock/lock.cc
  46. 112
      base-codezero/src/base/lock/lock_helper.h
  47. 101
      base-codezero/src/base/pager/pager.cc
  48. 79
      base-codezero/src/base/thread/thread_start.cc
  49. 67
      base-codezero/src/core/core_rm_session.cc
  50. 52
      base-codezero/src/core/include/core_rm_session.h
  51. 71
      base-codezero/src/core/include/irq_session_component.h
  52. 66
      base-codezero/src/core/include/map_local.h
  53. 72
      base-codezero/src/core/include/platform.h
  54. 74
      base-codezero/src/core/include/platform_pd.h
  55. 135
      base-codezero/src/core/include/platform_thread.h
  56. 46
      base-codezero/src/core/include/util.h
  57. 27
      base-codezero/src/core/io_mem_session_support.cc
  58. 58
      base-codezero/src/core/io_port_session_component.cc
  59. 72
      base-codezero/src/core/irq_session_component.cc
  60. 293
      base-codezero/src/core/platform.cc
  61. 124
      base-codezero/src/core/platform_pd.cc
  62. 104
      base-codezero/src/core/platform_thread.cc
  63. 65
      base-codezero/src/core/ram_session_support.cc
  64. 28
      base-codezero/src/core/rm_session_support.cc
  65. 55
      base-codezero/src/core/target.inc
  66. 4
      base-codezero/src/core/target.mk
  67. 121
      base-codezero/src/core/thread_start.cc
  68. 74
      base-codezero/src/kernel/target.mk
  69. 67
      base-codezero/src/platform/_main_helper.h
  70. 131
      base-codezero/src/platform/genode.ld
  71. 202
      base-codezero/tool/gen_romfs
  72. 44
      base-fiasco/Makefile
  73. 4
      base-fiasco/README
  74. 95
      base-fiasco/config/kernel-config.x86
  75. 83
      base-fiasco/config/l4env-config.x86
  76. 130
      base-fiasco/doc/fiasco.txt
  77. 11
      base-fiasco/etc/fiasco.conf
  78. 15
      base-fiasco/etc/specs.conf
  79. 8
      base-fiasco/etc/tools.conf
  80. 39
      base-fiasco/include/arm/cpu/atomic.h
  81. 57
      base-fiasco/include/base/cancelable_lock.h
  82. 65
      base-fiasco/include/base/ipc_msgbuf.h
  83. 173
      base-fiasco/include/base/ipc_pager.h
  84. 115
      base-fiasco/include/base/native_types.h
  85. 40
      base-fiasco/include/fiasco/thread_helper.h
  86. 8
      base-fiasco/lib/mk/arm/startup.mk
  87. 5
      base-fiasco/lib/mk/core_printf.mk
  88. 3
      base-fiasco/lib/mk/ipc.mk
  89. 19
      base-fiasco/lib/mk/l4v2_support.mk
  90. 3
      base-fiasco/lib/mk/lock.mk
  91. 3
      base-fiasco/lib/mk/pager.mk
  92. 56
      base-fiasco/lib/mk/platform.inc
  93. 6
      base-fiasco/lib/mk/x86/platform.mk
  94. 8
      base-fiasco/lib/mk/x86/startup.mk
  95. 69
      base-fiasco/mk/l4_pkg.mk
  96. 32
      base-fiasco/mk/spec-fiasco.mk
  97. 50
      base-fiasco/mk/spec-fiasco_arm.mk
  98. 25
      base-fiasco/mk/spec-fiasco_x86.mk
  99. 16
      base-fiasco/mk/spec-platform_imx.mk
  100. 14
      base-fiasco/mk/spec-platform_integrator.mk
  101. Some files were not shown because too many files have changed in this diff Show More

@ -0,0 +1,280 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS

182
README

@ -1,4 +1,180 @@
Genode OS Framework
This is just the initial version without any code yet. We're on the
way to migrate the current released version into Git.
=================================
Genode Operating System Framework
=================================
This is the source tree of the reference implementation of the Genode OS
architecture. For a general overview about the architecture, please refer to
the project's official website:
:Official project website for the Genode OS Framework:
[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
kernel for the MicroBlaze architecture. 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 microkernels. There
is no "perfect" microkernel - and neither should there be one. If a microkernel
pretended to be fit for all use cases, it wouldn't be "micro". Hence, all
microkernels differ in terms of their respective features, complexity, and
supported hardware architectures.
Genode allows the use of each of the kernels listed above with a rich set of
device drivers, protocol stacks, libraries, and applications in a uniform way.
For developers, the framework provides an easy way to target multiple different
kernels instead of tying the development to a particular kernel technology. For
kernel developers, Genode contributes advanced workloads, stress-testing their
kernel, and enabling a variety of application use cases that would not be
possible otherwise. For users and system integrators, it enables the choice of
the kernel that fits best with the requirements at hand for the particular
usage scenario.
Directory overview
##################
The Genode source tree is composed of the following subdirectories:
:'doc':
This directory contains general documentation. Please consider the following
document for a quick guide to get started with the framework:
! doc/getting_started.txt
If you are curious about the ready-to-use components that come with the
framework, please review the components overview:
! doc/components.txt
:'base':
This directory contains the source-code repository of the fundamental
frameworks and interfaces of Genode. Furthermore, it contains the generic
parts of core.
:'os':
This directory contains the non-base OS components such as the init process,
device drivers, and basic system services.
:'demo':
This directory contains the source-code repository of various services and
applications that we use for demonstration purposes. For example, a graphical
application launcher called Launchpad and the Scout tutorial browser.
:'base-<platform>':
These directories contain platform-specific source-code repositories
complementing the 'base' repository. The following platforms are supported:
:'linux':
Linux kernel (both x86_32 and x86_64)
:'pistachio':
L4ka::Pistachio kernel developed at University of Karlsruhe.
See [http://genode.org/community/wiki/GenodeOnL4kaPistachio]
:'fiasco':
L4/Fiasco kernel developed at University of Technology Dresden.
See [http://genode.org/community/wiki/GenodeOnL4Fiasco]
:'foc':
Fiasco.OC is a modernized version of the Fiasco microkernel with a
completely revised kernel interface fostering capability-based
security. It is not compatible with L4/Fiasco.
See [http://genode.org/community/wiki/GenodeOnFiascoOC]
:'okl4':
OKL4 kernel (x86_32 and ARM) developed at Open-Kernel-Labs.
See [http://genode.org/community/wiki/GenodeOnOKL4]
:'nova':
NOVA hypervisor developed at University of Technology Dresden
See [http://genode.org/community/wiki/GenodeOnNOVA]
:'codezero':
Codezero microkernel developed by B-Labs
See [http://genode.org/community/wiki/GenodeOnCodezero]
:'mb':
Support for running Genode natively on the MicroBlaze softcore CPU.
See [http://genode.org/community/wiki/GenodeOnMicroBlaze]
:'host':
Pseudo platform documenting the interface between the generic and
platform-specific parts of the base framework. This is not a functional
base platform.
:'tool':
Source-code management tools and scripts. Please refer to the README file
contained in the directory.
:'hello_tutorial':
Tutorial for creating a simple client-server scenario with Genode. This
repository includes documentation and the complete source code.
:'libports':
This source-code repository contains ports of popular open-source libraries
to Genode, most importantly the C library. The repository contains no
upstream source code but means to download the code and adapt it to Genode.
For instructions about how to use this mechanism, please consult the README
file at the top level of the repository.
:'linux_drivers':
This source-code repository contains the device driver environment for
executing Linux device drivers natively on Genode.
:'dde_ipxe':
This source-code repository contains the device driver environment for
executing drivers of the iPXE project.
:'qt4':
This source-code repository contains the Genode version of Qt4 framework.
Please find more information about using Qt4 with Genode in the repository's
'README' file.
:'ports':
This source-code repository hosts ports of 3rd-party applications to
Genode. The repository does not contain upstream source code but provides
a mechanism for downloading the official source distributions and adapt
them to the Genode environment. The used mechanism is roughly the same
as used for the 'libports' repository. Please consult 'libports/README'
for further information.
:'ports-<platform>':
These platform-specific source-code repositories contain software that
capitalizes special features of the respective kernel platform. I.e.,
for the OKL4 base platform, a port of OKLinux is provided in 'ports-okl4'.
For the Fiasco.OC platform, 'ports-foc' hosts a port of the L4Linux
kernel. For further information, please refer to the README file at the
top level of the respective repository.
:'gems':
This source-code repository contains Genode applications that use
both native Genode interfaces as well as features of other high-level
repositories, in particular shared libraries provided by 'libports'.
Contact
#######
The best way to get in touch with Genode developers and users is the project's
mailing list. Please feel welcome to join in!
:Genode Mailing Lists:
[http://genode.org/community/mailing-lists]

@ -0,0 +1,44 @@
#
# \brief Download and prepare the Codezero kernel
# \author Norman Feske
# \date 2011-08-05
#
VERBOSE ?= @
ECHO = @echo
GIT_URL = git://git.l4dev.org/codezero.git
GIT_REV = 6fa4884a5a1cf6207372f69ae01e5faa6d5a39c8
CONTRIB_DIR = contrib
PATCHES = $(shell find patches -name *.patch)
#
# Print help information by default
#
help::
prepare: $(CONTRIB_DIR)
help::
$(ECHO)
$(ECHO) "Check out upstream source code of the Codezero kernel"
$(ECHO)
$(ECHO) "The source code will be located at the '$(CONTRIB_DIR)/' directory."
$(ECHO)
$(ECHO) "--- available commands ---"
$(ECHO) "prepare - checkout upstream source codes"
$(ECHO) "clean - remove upstream source codes"
$(ECHO)
$(CONTRIB_DIR)/.git:
$(VERBOSE)git clone $(GIT_URL) $(CONTRIB_DIR)
$(CONTRIB_DIR): $(CONTRIB_DIR)/.git
$(VERBOSE)cd $(CONTRIB_DIR); git reset --hard $(GIT_REV)
$(ECHO) "applying patches to '$(CONTRIB_DIR)/'"
$(VERBOSE)for i in $(PATCHES); do patch -d $@ -p1 < $$i; done
.PHONY: $(CONTRIB_DIR)
clean::
$(VERBOSE)rm -rf $(CONTRIB_DIR)

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

@ -0,0 +1,240 @@
#
# 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=0x40000
CONFIG_CONT0_PAGER_VMA=0x100000
#
# Container 0 Pager Physical Memory Regions (Capabilities)
#
CONFIG_CONT0_PAGER_PHYSMEM_REGIONS=1
CONFIG_CONT0_PAGER_PHYS0_START=0x40000
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=0x40000
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!

@ -0,0 +1,274 @@
==================================
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.co.uk]
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:
! 0x40000 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
! 0x40000 Physical Region 0 Start Address
! 0x4000000 Physical Region 0 End Address
We only use 64MB of memory. The physical memory between 0 and 0x40000 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.

@ -0,0 +1,33 @@
/*
* \brief Atomic operations for ARM on codezero
* \author Norman Feske
* \date 2009-10-02
*/
/*
* Copyright (C) 2009-2011 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_ */

@ -0,0 +1,63 @@
/*
* \brief IPC message buffer
* \author Norman Feske
* \date 2009-10-02
*/
/*
* Copyright (C) 2009-2011 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_ */

@ -0,0 +1,169 @@
/*
* \brief Dummy pager support for Genode
* \author Norman Feske
* \date 2009-10-02
*/
/*
* Copyright (C) 2009-2011 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_PAGER_H_
#define _INCLUDE__BASE__IPC_PAGER_H_
#include <base/ipc.h>
#include <base/stdint.h>
#include <base/native_types.h>
namespace Genode {
class Mapping
{
private:
addr_t _from_phys_addr;
addr_t _to_virt_addr;
size_t _num_pages;
bool _writeable;
enum { PAGE_SIZE_LOG2 = 12 };
public:
/**
* Constructor
*/
Mapping(addr_t dst_addr, addr_t src_addr,
bool write_combined, unsigned l2size = PAGE_SIZE_LOG2,
bool rw = true)
:
_from_phys_addr(src_addr),
_to_virt_addr(dst_addr),
_num_pages(1 << (l2size - PAGE_SIZE_LOG2)),
_writeable(rw)
{ }
/**
* Construct invalid mapping
*/
Mapping() : _num_pages(0) { }
/**
* Prepare map operation
*
* No preparations are needed on Codezero because all mapping
* originate from the physical address space.
*/
void prepare_map_operation() { }
addr_t from_phys() const { return _from_phys_addr; }
addr_t to_virt() const { return _to_virt_addr; }
size_t num_pages() const { return _num_pages; }
bool writeable() const { return _writeable; }
};
/**
* Special paging server class
*/
class Ipc_pager : public Native_capability
{
private:
Native_thread_id _last; /* faulted thread */
addr_t _pf_addr; /* page-fault address */
addr_t _pf_ip; /* instruction pointer of faulter */
bool _pf_write; /* true on write fault */
Mapping _reply_mapping;
// protected:
//
// /**
// * Wait for pagefault
// */
// void _wait();
//
// /**
// * Send page-fault reply and wait for next page fault
// */
// void _reply_and_wait();
public:
/**
* Constructor
*/
Ipc_pager();
/**
* Wait for a new page fault received as short message IPC
*/
void wait_for_fault();
/**
* Reply current page-fault and wait for a new one
*/
void reply_and_wait_for_fault();
/**
* Request instruction pointer of current page fault
*/
addr_t fault_ip() { return _pf_ip; }
/**
* Request fault address of current page fault
*/
addr_t fault_addr() { return _pf_addr; }
/**
* Set parameters for next reply
*/
void set_reply_mapping(Mapping m) { _reply_mapping = m; }
/**
* Set destination for next reply
*/
void set_reply_dst(Native_capability pager_object) {
_last = pager_object.local_name(); }
/**
* Answer call without sending a mapping
*
* This function is used to acknowledge local calls from one of
* core's region-manager sessions.
*/
void acknowledge_wakeup();
/**
* Return thread ID of last faulter
*/
Native_thread_id last() const { return _last; }
/**
* Return badge for faulting thread
*/
unsigned long badge() const { return _last.tid; }
/**
* Return true if page fault was a write fault
*/
bool is_write_fault() const { return _pf_write; }
/**
* Return true if last fault was an exception
*/
bool is_exception() const
{
/*
* Reflection of exceptions is not supported on this platform.
*/
return false;
}
};
}
#endif /* _INCLUDE__BASE__IPC_PAGER_H_ */

@ -0,0 +1,143 @@
/*
* \brief Dummy definitions for native types used for compiling unit tests
* \author Norman Feske
* \date 2009-10-02
*/
/*
* Copyright (C) 2009-2011 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_
namespace Codezero {
struct l4_mutex;
enum { NILTHREAD = -1 };
}
namespace Genode {
class Platform_thread;
struct Native_thread_id
{
int tid;
/**
* Pointer to thread's running lock
*
* Once initialized (see 'lock_helper.h'), it will point to the
* '_running_lock' field of the thread's 'Native_thread' structure,
* which is part of the thread context. This member variable is
* used by the lock implementation only.
*/
struct Codezero::l4_mutex *running_lock;
Native_thread_id() { }
/**
* Constructor (used as implicit constructor)
*/
Native_thread_id(int l4id) : tid(l4id), running_lock(0) { }
Native_thread_id(int l4id, Codezero::l4_mutex *rl) : tid(l4id), running_lock(rl) { }
};
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; }
};
inline bool operator == (Native_thread_id t1, Native_thread_id t2) { return t1.tid == t2.tid; }
inline bool operator != (Native_thread_id t1, Native_thread_id t2) { return t1.tid != t2.tid; }
/*
* Because Codezero does not support local names for capabilities, a Genode
* capability consists of the global thread ID and a global object ID, not
* protected by the kernel when transmitted as IPC payloads.
*/
class Native_capability
{
private:
Native_thread_id _tid; /* global thread ID */
int _local_name; /* global unique object ID */
public:
/**
* Default constructor creates invalid capability
*/
Native_capability()
: _local_name(0) { _tid.tid = Codezero::NILTHREAD; }
/**
* Constructor for hand-crafting capabilities
*
* This constructor is only used internally be the framework.
*/
Native_capability(Native_thread_id tid, int local_name)
: _tid(tid), _local_name(local_name) { }
bool valid() const { return _tid.tid != Codezero::NILTHREAD; }
int local_name() const { return _local_name; }
int dst() const { return _tid.tid; }
Native_thread_id tid() const { return _tid; }
};
typedef int Native_connection_state;
}
#endif /* _INCLUDE__BASE__NATIVE_TYPES_H_ */

@ -0,0 +1,76 @@
/*
* \brief Aggregate Codezero syscall bindings
* \author Norman Feske
* \date 2010-02-16
*/
/*
* Copyright (C) 2010-2011 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
} }
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_ */