Compare commits

...

281 Commits
13.11 ... 14.02

Author SHA1 Message Date
Norman Feske
9e33efde69 Release notes for version 14.02 2014-02-28 10:16:24 +01:00
Christian Helmuth
99a2511496 os: improve README for trace fs 2014-02-28 10:11:52 +01:00
Josef Söntgen
36608b3402 rump: filter ccache
Fixes #1048.
2014-02-28 10:11:52 +01:00
Norman Feske
00f4ff37f6 Update top-level README and doc/components.txt 2014-02-28 10:11:52 +01:00
Sebastian Sumpf
64d60bbc7f rump: Remove deprecated ARM instruction
Substitute 'swpb' (swap byte) instruction with 'ldrexb/strexb', because 'swpb'
needs to be enabled explicitly by the kernel, which is done by neither HW or FOC.
When disabled, 'swpb' will cause an undefined instruction exception.

Issue #1048
2014-02-28 10:11:51 +01:00
Norman Feske
aa1082bed7 dynamic_rom: Additional documentation 2014-02-28 10:11:51 +01:00
Norman Feske
0312bea38b dynamic_rom: Don't mention decorator
Omit the decorator.run script from the README file because it is not
integrated in mainline yet.
2014-02-28 10:11:51 +01:00
Christian Prochaska
0ca1606f10 Qt5: add the QPluginWidget test
Fixes #1073.
2014-02-28 10:11:51 +01:00
Christian Prochaska
6a1d07de86 Arora: increase RAM quota for 'testnit'
This patch increases the RAM quota for 'testnit' in the Arora nitpicker
plugin demo.

Fixes #1074.
2014-02-28 10:11:51 +01:00
Christian Prochaska
66957c8113 Qt5: use Nitpicker instead of liquid_fb
Fixes #1072.
2014-02-28 10:11:51 +01:00
Norman Feske
4c45f3451c os/reporter.h: Don't enable if connection fails
If opening a report session fails (for example because of invalid
session arguments) and an exception is thrown during the session
construction, the report would wrongly keep the enabled state.
By moving the assignment of the state after the construction,
the report stays disabled as it should be.
2014-02-28 10:11:51 +01:00
Norman Feske
57fdce0465 nitpicker: Respond to session-local focus change
This patch improves the focus handling by updating the menubar each time
the user clicks on a different view, even the old and new view belong
to the same session.
2014-02-28 10:11:51 +01:00
Norman Feske
1498bb740b nitpicker: Parent-child relation between views
Fixes #1020
2014-02-28 10:11:50 +01:00
Alexander Boettcher
93605c2b15 test: be more strict for affinity.run
Check that in every round really all threads are alive on all CPUs. It
happened that only the first round was ok (all alive) and in the next rounds
some were dead. Unfortunately the test claimed to be successful.
2014-02-28 10:11:50 +01:00
Sebastian Sumpf
ca0d79010d rump: Use fixed commit for NetBSD sources
Issue #1048
2014-02-28 10:11:50 +01:00
Christian Prochaska
148b8efe8e Adapt gallium and libdrm plugins to current libc
This patch adapts the gallium and libdrm libc plugins to the current
workings of the libc.

Fixes #1070.
2014-02-28 10:11:13 +01:00
Christian Prochaska
7fd53b52df gallium: link with pthread
Fixes #1069.
2014-02-28 10:11:13 +01:00
Sebastian Sumpf
1295d5e062 hw: Change link address for Panda
Don't load image at beginning of RAM, this may cause u-boot to show
unpredictable behavior.
2014-02-28 10:11:13 +01:00
Josef Söntgen
e90c77da89 os: increase ldso MEM_SIZE 2014-02-28 10:11:13 +01:00
Josef Söntgen
f407bc4cbb base: interim forked trace control fix
The destructor of the Area object uses invalid caps which results in
a wanted abort of the process on nova. This is mainly the case in forked
process in noux.
2014-02-28 10:11:13 +01:00
Martin Stein
e7f370f779 base: enable tracing not before reinit_main_thread
ref #989
2014-02-28 10:11:13 +01:00
Martin Stein
99ec536c53 thread: init thread cap for non-core main threads
ref #989
2014-02-28 10:11:13 +01:00
Stefan Kalkowski
379c6c1cd4 i.MX53: fix incorrect DMA protection settings
Within the central security unit of the i.MX53 SoC, one can set protection
level of various DMA bus master requests, distinguishing them between normal,
and secure access. Although, the access level was meant to be set correctly,
the enumeration values that denoted the kind of access were incorrect. Thereby,
until now every DMA requests was set as being secure. This commit corrects
the enumeration values, and sets all DMA operations as being unsecure, accept
from the graphical subsystem which is controlled by the secure world only.

Thanks to Andrea Barisani and Andrej Rosano from Inverse Path for discovering
this bug, as well as the hardware limitation!
2014-02-28 10:11:13 +01:00
Sebastian Sumpf
bf06b7e360 rump: Add repository to build.conf 2014-02-28 10:11:12 +01:00
Martin Stein
a7dd2b3171 base: ABI specific stack creation
ref #1042
2014-02-28 10:11:12 +01:00
Christian Prochaska
43c73eff13 Adapt GDB commands to ldso changes
Issue #1042.
2014-02-28 10:11:12 +01:00
Sebastian Sumpf
b4612d24ce base-linux: Repair hybrid programs
Do not link 'startup' and 'cxx' libraries against hybrid programs.
2014-02-28 10:11:12 +01:00
Alexander Boettcher
961bd41b05 vbox: auto test for win7 @ vbox/Genode/Nova
Issue #1055
2014-02-28 10:11:12 +01:00
Alexander Boettcher
d8c2a908b8 ports: add VirtualBox as VMM for Genode
Fixes #1055
2014-02-28 10:11:12 +01:00
Norman Feske
2e6f281cf0 libc_fs: Handle Packet_alloc_failed exception 2014-02-28 10:11:11 +01:00
Norman Feske
28c6763a7d lx_fs: Support large files on 32-bit machines 2014-02-28 10:11:11 +01:00
Alexander Boettcher
d1b0af5eb9 nova: nopcid required for thinkpad x201 2014-02-28 10:11:11 +01:00
Alexander Boettcher
737a3290d9 nova: for clearing a ds it must be ever writable 2014-02-28 10:11:11 +01:00
Alexander Boettcher
f69b206593 nova: fix utcb layout for 32bit
Makes virtualbox as 32bit VMM working
2014-02-28 10:11:11 +01:00
Alexander Boettcher
dd95266235 nova: add feature to yield a thread
used by virtualbox intensively
2014-02-28 10:11:11 +01:00
Alexander Boettcher
39a7ffd233 nova: use kernel branch with vCPU fpu support
branch r4 based on latest vanilla kernel of @udosteinberg
2014-02-28 10:11:11 +01:00
Alexander Boettcher
fa23c0bd4f nova: update syscall bindings 2014-02-28 10:11:11 +01:00
Alexander Boettcher
8c7cadde5f nova: support noreturn attribute for syscall reply 2014-02-28 10:11:10 +01:00
Alexander Boettcher
491817c00c base: add flex page iterator
Issue #8
2014-02-28 10:11:10 +01:00
Alexander Boettcher
fcd76d10dd pthread: catch time out exception 2014-02-28 10:11:10 +01:00
Christian Helmuth
a11a17147f pthread: limit timeouts to >= 10 ms
The timed semaphore supports a minimum timeout of 10 ms and logs a
warning if the timeout is lower than the minimum. To prevent the
warning, we limit timeouts to >= 10 ms.
2014-02-28 10:11:10 +01:00
Alexander Boettcher
5d9b563503 framebuffer: fix ambiguity for strncpy 2014-02-28 10:11:10 +01:00
Norman Feske
75366c66a4 libc: Add Libc::Mem_alloc::size_at
Adding this function eases the implementation of realloc based on
'Libc::Mem_alloc'. Note that this allocator is not used by libc's
default malloc implementation but it is useful for customized C
runtimes, e.g., for the runtime of VirtualBox.
2014-02-28 10:11:10 +01:00
Norman Feske
db2fe17269 base: Add Allocator_avl::size_at function
This function provides a way to request the size of an previously
allocated block. It is useful to to ease the implementation of realloc
functionality based on Allocator_avl.
2014-02-28 10:11:10 +01:00
Norman Feske
16bc2bc840 libc: Dummy for sys/user.h 2014-02-28 10:11:10 +01:00
Norman Feske
9a971a500d libc: Add sys/disk.h
Needed by the POSIX backend of the VirtualBox runtime.
2014-02-28 10:11:10 +01:00
Norman Feske
e02d643420 libc: export LIBC_REP_DIR in libc-common.inc
This information is useful if 'libc-common.inc' is included from
another repository, i.e., for building stripped-down libc variants
tailored to an individual application.
2014-02-28 10:11:09 +01:00
Sebastian Sumpf
4aef209c8b rump: Increase FS server stack size 2014-02-28 10:11:09 +01:00
Josef Söntgen
a282617407 libports: initial fuse_fs implementation
The fuse_fs server provides access to a FUSE based file system by using
a File_system_session.

Fixes #1058.
2014-02-28 10:11:09 +01:00
Josef Söntgen
829961b0ad libports: add libc_fuse_ntfs-3g
Fixes #1058.
2014-02-28 10:11:09 +01:00
Josef Söntgen
7998fdaf3f libports: less noisy compilation of libfuse
Out of laziness we only provide two dummy functions for all FUSE
operations, which are used in case the FUSE file system does not
implement them itself.

Fixes #1058.
2014-02-28 10:11:09 +01:00
Josef Söntgen
8f1e8c122f libports: less noisy libext2fs compilation
Fixes #1058.
2014-02-28 10:11:09 +01:00
Josef Söntgen
7bc49b05d0 libports: less noisy fuse_ext2 compilation
Fixes #1058.
2014-02-28 10:11:09 +01:00
Josef Söntgen
53c6675500 libports: prevent main symbol clash in fuse-ext2
Omit the main rountine in fuse-ext2.c. Otherwise using fuse-ext2 with
fuse_fs is not possible because the server framework already defines
a main routine.

Fixes #1058.
2014-02-28 10:11:09 +01:00
Josef Söntgen
9f5c13564c libports: extend FUSE implementation
* add sync method:
  Since file systems tend to have a inbuild caching mechansim we need to
  sync these caches at the end of session when using the fuse_fs server.
  Therefore each FUSE file system port has to implement a Fuse::sync_fs()
  function that executes the necessary actions if requested.

* add symlink check

* allow to check FUSE fs initialization
  This changes the private API of the FUSE implementation. The init_fs
  method now has to return true if the initialization was successful and
  otherwise false. All current users of the API are also changed
  accordingly.

Fixes #1058.
2014-02-28 10:11:09 +01:00
Stefan Kalkowski
3b69dc2a58 TrustZone: reenable memory protection (fix #1060) 2014-02-28 10:11:08 +01:00
Christian Prochaska
14a636f9a7 Noux: fix GDB arguments in run script
Noux generates 'argv[0]' for the initial child automatically (in contrast
to the 'config_args' library), so the first argument stated in the
configuration should not be the GDB program name.

Fixes #1062.
2014-02-28 10:11:08 +01:00
Christian Prochaska
46374a6932 gdb_monitor: show correct register state on FOC
On Genode/Fiasco.OC, when an unresolved page fault occurs, only the IP and
SP registers are valid in the thread state read by GDB monitor. This was
not taken into account so far and the other (possibly outdated) register
values got reported to the client, too.

With this patch, only IP and SP get reported to the client in the page
fault case.

Fixes #1063.
2014-02-28 10:11:08 +01:00
Sebastian Sumpf
dd974f00f7 usb_drv: Fix implicit declaration warnings
Issue #1050
2014-02-28 10:11:08 +01:00
Sebastian Sumpf
9251b1ede8 rump: Port of the rump kernels to Genode
For further information see: http://wiki.netbsd.org/rumpkernel/. In this version
I ported the central rump components to Genode in order to take advantage of
NetBSD file system implementation. The new 'dde_rump' repository contains the
Genode version of the rump libraries and a 'rump_fs' server that implements
Genode file-system-session interface. Currently ext2, iso9660, and fat
file-systems are supported.

Issue #1048
2014-02-28 10:11:08 +01:00
Sebastian Sumpf
ce27985b8a ram_blk: Writable loopback device
Issue #1048
2014-02-25 14:58:09 +01:00
Sebastian Sumpf
2e04cc2d87 libc_fs: Implemented and test 'unlink' call
Issue #1048
2014-02-25 14:58:09 +01:00
Sebastian Sumpf
1b1693e6ff libc: 'readlink' returns non-zero terminated buffer
Make so to handle zero termination correctly for 'stat' calls and for debugging
output.

Issue #1048
2014-02-25 14:58:09 +01:00
Sebastian Sumpf
b7575319bf run: Add 'check_installed' command to run env
'check_installed' takes a command name as argument and tries to call 'which' in
order to find the command path. If that does not succeed, paths like '/sbin' are
'/usr/sbin' searched. On success the absolute path of the command is returned,
on failure 'exit' is called with an error message.

Issue #1048
2014-02-25 14:58:09 +01:00
Sebastian Sumpf
1c4c4d6961 base: Make 'LD_SCRIPT_SO' overwritable
Issue #1048
2014-02-25 14:58:09 +01:00
Sebastian Sumpf
49ee13168b libc: malloc do not destruct allocator 2014-02-25 14:58:09 +01:00
Christian Prochaska
21f031371f Noux: fix build process of more 'e2fsprogs' programs
Fixes #1065.
2014-02-25 14:58:09 +01:00
Christian Prochaska
53c4aa6d22 Noux: fix build process of the 'fixincl' program
The 'LIBS' environment variable needs to get used to build the 'fixincl'
program correctly.

Fixes #1066.
2014-02-25 14:58:09 +01:00
Sebastian Sumpf
1e8f1b7a5b ldso: Do not use new rom connection during open
Search for already opened file, also do not throw any exceptions, since they
may be thrown during execption allocation.
2014-02-25 14:58:08 +01:00
Christian Prochaska
1ac034d16d Noux: fix the 'xxd' program
Fixes #1064.
2014-02-25 14:58:08 +01:00
Martin Stein
f74c70ec05 base: add startup lib to the base libs
Startup lib can now be filtered according to the same rules like
the other base libraries.

Issue #1042
2014-02-25 14:58:08 +01:00
Martin Stein
929a2387d1 hw: merge base-common and kernel_interface lib
Issue #1042
2014-02-25 14:58:08 +01:00
Martin Stein
4f0a75b0bc linux: clean-up lib-files of base and base-common
Issue #1042
2014-02-25 14:58:08 +01:00
Martin Stein
016c3a8d9e test-ldso: test stack alignment
Issue #1042
2014-02-25 14:58:08 +01:00
Martin Stein
13b1aab044 hw & arm7: prepare CPU driver for -O0 2014-02-25 14:58:08 +01:00
Martin Stein
6a2546d7e9 hw: ease syscall backends and prepare them for -O0
Previously we used to many registers in syscalls with much arguments
to build with optimization level O0. Additionally this fix fastens the
userland backend of syscalls.
2014-02-25 14:58:08 +01:00
Martin Stein
724efcb00c test-ldso: test ctors, dtors and atexit functions
Issue #1042
2014-02-25 14:58:08 +01:00
Martin Stein
bd52e49698 os: remove startup lib from dynamic programs
All the pre- and post-processing of the startup lib around the main
function of a dynamic program is now done by LDSO. Hence LDSO directly
calls the main function of the program.

Issue #1042
2014-02-25 14:58:07 +01:00
Martin Stein
8d21064b5e ldso: use generic CRT0 files
Issue #1042
2014-02-25 14:58:07 +01:00
Martin Stein
324af5d769 os: make program ctors and dtors visible to LDSO
This is needed later when eliminating the need for a startup lib in
dynamic programs to enable LDSO to call ctors and dtors of the program.

Issue #1042
2014-02-25 14:58:07 +01:00
Martin Stein
6e2b7c2b92 ldso: make function get_program_var_addr global
This is needed later to lookup program symbols like ctors and dtors to
eliminate the need for a startup lib in dynamic programs.

Issue #1042
2014-02-25 14:58:07 +01:00
Martin Stein
a100b37fdf base: provide a weak init_rtld dummy in base lib
This is needed later to eliminate LDSO specific CRT0 implementations.

Issue #1042
2014-02-25 14:58:07 +01:00
Martin Stein
3893dae673 cxx: implement __aeabi_atexit
Issue #1042
2014-02-25 14:58:07 +01:00
Martin Stein
e45f929eca ldso: make cxx symbols global
Issue #1042
2014-02-25 14:58:07 +01:00
Sebastian Sumpf
433a216919 base: Fix stack pointer alignment for ARM
After some research we found that the stack pointer on ARM platforms must be
at least double word aligned (See: "Procedure Call Standard for the ARM
Architecture" - 5.2.1.1). Since a 'call' on ARM will not result in a stack pointer
change (like on x86), the current behavior resulted in a 4 Byte aligned stack
only.

Follow up to #1043
2014-02-25 14:58:07 +01:00
Martin Stein
df066521a5 ldso: don't destruct Rm_area singleton in file.cc
This is needed to avoid access to invalid caps in forked noux programs.

ref #989
2014-02-25 14:58:07 +01:00
Stefan Kalkowski
6ca8a41232 core: lower default verbosity when quota exceeds
* only print quota exceeded message and statistic when explicitly enabled
* turn init's error message "cannot respond to request" into a warning
2014-02-25 14:58:06 +01:00
Stefan Kalkowski
30bfc63b63 block cache: quota to small for foc_x86_64 2014-02-25 14:58:06 +01:00
Stefan Kalkowski
746011ee28 blk_cache: fix deadlock in allocator hierarchy
This commit generalizes the bit array in 'base/util/bit_array.h',
so that it can be used in a statically, when the array size is known
at compile time, or dynamically. It uses the dynamic approach of the
bit array for a more generalized version of the packet allocator,
formerly only used by NIC session clients. The more generic packet
allocator is used by the block cache to circumvent the allocation
deadlock described in issue #1059.

Fixes #1059
2014-02-25 14:58:06 +01:00
Sebastian Sumpf
aa4f11905a ldso: Export 'lx_syscall' for base-linux
The syscall library in not linked to dynamic binaries anymore, hence ldso need
to export the required symbols

Follow up to #1017
2014-02-25 14:58:06 +01:00
Sebastian Sumpf
f447fbe1a5 base: Do not link base libs against shared libs
Base libraries are already contained within ldso.lib.so. Remove unnecessary
filtering from 'dep_lib.mk', make ldso depend on base libs.

Issue #1017
Issue #989
2014-02-25 14:58:06 +01:00
Sebastian Sumpf
481a8ede5f lxip: Fix implicit declaration warning
Issue #1050
2014-02-25 14:58:06 +01:00
Norman Feske
14718401ea nitpicker: Support for dynamic screen resizing
Fixes #1056
2014-02-25 14:58:06 +01:00
Norman Feske
0056167157 liquid_fb: Improve resize handling
This patch make the handling of resizing the virtual framebuffer more
consistent. Liquid_fb keeps track of two sizes. The "next size" is the
size of the framebuffer handed out via the next call of 'dataspace'.
The "designated size" is the size as demanded by the user. The latter
size may be updated more often than the "next" size, depending on the
responsiveness of the framebuffer client to mode-change signals.

The patch also removes the synchronization with refresh calls because
the synchronization made the flickering artifacts worse when executing
nitpicker within liquid_fb. So it was not properly working anyway.
In the future, we might reimplement such a synchronization mechanism
when switching to the server API.

Issue #1056
2014-02-25 14:58:06 +01:00
Martin Stein
4a61d008be base: beautify BSS stuff in CRT0s
fix #989
2014-02-25 14:58:05 +01:00
Martin Stein
5a6253eeff base: downsize initial main-thread stack
As the initial main-thread stack is not used for the whole main-thread life
anymore but only for the initialization of the Genode environment it can be
downsized to 32Kb for all architectures.

ref #989
2014-02-25 14:58:05 +01:00
Martin Stein
83b0cdf709 base: bin out-commented EH_FRAME stuff in CRT0s
ref #989
2014-02-25 14:58:05 +01:00
Martin Stein
523791b361 base: generic implementation of Context_allocator
ref #989
2014-02-25 14:58:05 +01:00
Martin Stein
020edd3032 noux_fork: raise MAX_COUNT to 1000
To see the output of both, forker and fork, we must give the test
more time on OKL4 as fork seems to be not so fast with this kernel.

ref #989
2014-02-25 14:58:05 +01:00
Martin Stein
9c1563be67 base: ease Platform_env::Resources
It is unnecessary to remember session caps in a Resources object as the
contained connections can cast implicitely to the appropriate caps.

ref #989
2014-02-25 14:58:05 +01:00
Martin Stein
0b64328944 base: setup thread object for main thread in CRT0
For a main thread a thread object is created by the CRT0 before _main gets
called so that _main can already run in a generic environment that, e.g.,
catches stack overflows as a page-fault instead of corrupting the BSS.
Additionally dynamic programs have only one CRT0 - the one of the LDSO -
which does the initialization for both LDSO and program.

ref #989
2014-02-25 14:58:05 +01:00
Martin Stein
ba8e61653f noux & 64bit: fix printf format-warning
ref #989
2014-02-25 14:58:05 +01:00
Martin Stein
cfd4310684 libc_noux & 64bit: fix printf format-warning
Normally for intptr_t the printf format PRIiPTR should be used. As Genode
printf doens't support this format we cast it to long int (intptr_t is int
for 32 bit and long int for 64 bit).

ref #989
2014-02-25 14:58:05 +01:00
Martin Stein
c2af646ad8 noux: Noux_connection::context_area_rm_session()
This enables a forked process to update the capability of its
context area RM session.

ref #989
2014-02-25 14:58:04 +01:00
Martin Stein
f7149623ca base: rename reload_parent_cap.cc
ref #989
2014-02-25 14:58:04 +01:00
Norman Feske
276a1775f1 Accessors for Xml_node utility
This patch adds accessors to obtain the buffer of an attribute value,
which is useful to avoid the copying-out of such information by
maintaining pointers into the XML string as meta data.
2014-02-25 14:58:04 +01:00
Norman Feske
c265cfa593 Add 'operator *' to os/volatile_object.h
This operator is needed when we want to create a reference to (the
content of) a volatile object.
2014-02-25 14:58:04 +01:00
Norman Feske
638a9cfd40 base: optional length argument for String::String 2014-02-25 14:58:04 +01:00
Markus Partheymueller
31fc7c35e2 tool_chain: check for various autoconf installs.
There exist different default setups for a specific autoconf version:
* autoconf
* autoconf$(VERSION)
* autoconf-$(VERSION)

As of now, only the second option is recognized by the check in tool_chain.

This patch ensures that if one of those is present in the correct
version, it will be found and used in the build process.

Fixes #1053.
2014-02-25 14:58:04 +01:00
Christian Prochaska
69785504c7 Qt5: reserve screen space for the liquid_fb title bar
With this patch, the liquid_fb title bar height gets reserved at the top of the
screen, so if a Qt application wants to position a window at (0,0), there's
still enough space to show the title bar above.

Issue #1054.
2014-02-25 14:58:04 +01:00
Norman Feske
c30415fb9b News item for FOSDEM slides 2014-02-25 14:58:04 +01:00
Norman Feske
46eebede26 liquid_fb: Fix decoration config option
The decoration configuration is used by Qt5 to omit window decorations
from menus. It got lost during the restructuring of the scout widgets.
2014-02-25 14:58:03 +01:00
Norman Feske
718b0c0b67 d3m: quota adjustment for ps2 driver 2014-02-25 14:58:03 +01:00
Norman Feske
676c3830f9 d3m: Adaptation to USB driver config change 2014-02-25 14:58:03 +01:00
Norman Feske
e2d9b31bfe iso9660: Increase entrypoint stack size for 64bit 2014-02-25 14:58:03 +01:00
Norman Feske
9947c3d33b d3m: Fix deadlock of usb_drv
This deadlock was introduced by the change of USB driver to the server
API.

Fixes #1052
2014-02-25 14:58:03 +01:00
Norman Feske
6f9e15aff8 base: Add 'construct_at' utility
This utility allows for the manual placement of objects without the need
to have a global placement new operation nor the need for type-specific
new operators.

Issue #989
2014-02-25 14:58:03 +01:00
Christian Helmuth
cdb5030cbb Fix several format string warnings 2014-02-25 14:58:03 +01:00
Josef Söntgen
bdec3dd668 os: initial version of trace_fs
The trace_fs server provides access to a Trace_session by using a
File_system_session as frontend.

Each trace subject is represented by a directory ('thread_name.subject')
that contains specific files ('active', 'cleanup', 'enable', 'events',
'buffer_size' and 'policy'), which are used to control the tracing
process of the thread as well as storing the content of its trace
buffer.

The tracing of a thread is only activated if there is a valid policy
installed and the intend to trace the subject was made clear by writing
'1' to the 'enable' file.

The tracing of a thread may be deactived by writing a '0' to the
'enable' file.

A policy may be changed by overwriting the currently used one. In this
case the old policy is replaced by the new policy and is automatically
utilize.

Writing a value to the 'buffer_size' file changes the appointed size of
the trace buffer. This value is only evaluted by reactivating the
tracing process.

The content of the trace buffer may be accessed by reading from the
'events' file. Throughout all tracing session new trace events are
appended to this file.

Nodes of UNTRACED subjects are kept as long as they do not change their
tracing state to DEAD. In this case all nodes are removed from the
file system. Subjects that were traced before and are now UNTRACED will
only be removed by writing '1' to the 'cleanup' file - even if they
are DEAD by now.

To use the trace_fs a config similar to the following may be used:

! <start name="trace_fs">
! 	<resource name="RAM" quantum="128M"/>
! 	<provides><service name="File_system"/></provides>
! 	<config>
! 		<policy label="noux -> trace" interval="1000" subject_limit="512" trace_quota="64M" />
! 	</config>
! </start>

'interval' sets the periode in which the Trace_session is polled. The
time is given in milliseconds.
'subject_limit' speficies how many trace subject should by acquired at
most when the Trace_session is polled.
'trace_quota' is the amount of quota the trace_fs should use for the
Trace_session connection. The remaing amount of RAM quota will be used
for the actual nodes of the file system and the 'policy' as well as the
'events' files.
In addiition there are 'buffer_size' and 'buffer_size_limit' that define
the initial and the upper limit of the size of a trace buffer.
Tracing of parent processes or rather threads may be enabled by setting
'parent_levels' to a value greater than '0' (though this attribute is
available, the trace session component within core still lacks support
for it).

A ready-to-use runscript can by found in 'ports/run/noux_trace_fs.run'.

Fixes #1049.
2014-02-25 14:58:02 +01:00
Josef Söntgen
e79044d16a core: change policy incrementation to prefix op
Using prefix incrementation makes sure a policy with id == 0 is
invalid.

Fixes #1049.
2014-02-25 14:58:02 +01:00
Martin Stein
e68eadf57b hw: fix bug in IPC message-size calculation
ref #989
2014-02-25 14:58:02 +01:00
Martin Stein
a9747825fc hw: use descriptive bool value names in ipc.cc
ref #989
2014-02-25 14:58:02 +01:00
Martin Stein
901b3e2bb4 hw: ease usage of the kernel log
ref #989
2014-02-25 14:58:02 +01:00
Stefan Kalkowski
eeb2d95b1f block: prevent from dereferencing invalid pointers
Until now, block drivers had to deal with a pointer to the client
session component, e.g.: to acknowledge block packets already processed.
When a session was closed, the driver object wasn't informed explicitly,
which leads to defensive programming, or lastly to a race-condition in
test-blk-srv. To prevent from this class of errors, the pointer is now
private to the generic block driver base class, and not accessible to
the concrete driver implementation. Moreover, the driver gets explicitly
informed when a session got invalidated.

Ref #113
2014-02-25 14:58:02 +01:00
Stefan Kalkowski
ca513113f6 block: cache between one client and one device
This block cache component acts as a block device for a single client.
It uses fixed 4K blocks as caching granularity, thereby implicitly reads
ahead whenever a client requests lesser amount of blocks. Currently,
it only supports a least-recently-used replacement policy.

Fixes #113
2014-02-25 14:58:02 +01:00
Stefan Kalkowski
0bc012eb79 os: handle ipc error in server framework
When using the server framework, it might happen that the main thread
tries to forward a signal to the entrypoint, while the context of that
signal is already destroyed. In that case the main thread will get an
ipc error exception as result.

Related to #113
2014-02-25 14:58:01 +01:00
Christian Helmuth
41d5959ae5 base: extend thread test for stack alignment 2014-02-25 14:58:01 +01:00
Bjoern Doebel
9c9f67d0d6 Check for all missing tools at once
Instead of terminating tool/tool_chain when finding the first
missing tool, this patch runs all checks to completion before
bailing out. This eases finding missing programs, because the
user has to run the script only once to get a list of all missing
software.

Fixes #1046
Fixes #1047
2014-02-06 15:20:14 +01:00
Christian Prochaska
7008013625 Qt5: decrease memory amount needed for QtQWebkit
On 64-bit platforms Qt's JavaScript engine tries to reserve 1GiB of
virtual memory via 'mmap()', to be backed by physical memory on demand.
Genode's 'mmap()' implementation currently does not support on-demand
allocation of physical memory and tries to allocate the whole amount at
once, which is usually far more than needed.

With this patch, the amount to be reserved gets decreased to 32MiB.

Fixes #1041.
2014-02-03 11:37:47 +01:00
Christian Prochaska
4b420f6e71 Fix stack pointer alignment for x86_64 platforms
The x86_64 ABI requires the stack pointer to be 16-byte aligned before the
call of a function and decreased by 8 at the function entrypoint (after
the return address has been pushed to the stack).

Currently, when a new Genode thread gets created, the initial stack
pointer is aligned to 16 byte. On Genode/Linux, the thread entry function
is entered by a 'call' instruction, so the stack pointer alignment at the
function entrypoint is correct. On Fiasco.OC and NOVA, however, the thread
entry function gets executed without a return address being pushed to the
stack, so at the function entrypoint the stack pointer is still aligned to
16 byte, which can cause problems with compiler-generated SSE
instructions.

With this patch, the stack pointer given to a new thread gets aligned to
16 bytes and decreased by 8 by default, since most of the currently
supported base platforms execute the thread entry function without pushing
a return address to the stack. For base-linux, the stack pointer gets
realigned to 16 bytes before the thread entry function gets called.

Fixes #1043.
2014-02-03 11:34:30 +01:00
Norman Feske
a19d491fbd doc: Genode Porting Guide + news item 2014-01-30 10:05:44 +01:00
Christian Helmuth
f91b1b6258 base: test for races in thread-context allocation
Related to #1024.
2014-01-30 10:05:44 +01:00
Christian Prochaska
40aa553fa9 part_blk.run: build components before block image
With this patch, the components get built before the creation of the block
image to ensure that the 'bin' directory exists.

Fixes #1038.
2014-01-30 10:05:44 +01:00
Christian Prochaska
27ff408985 Noux: POSIX signal improvements
- 'kill()' syscall added
- 'wait()' gets unblocked when a signal occurs
- syscalls can get called from a signal handler without corrupting the 'sysio' object
- the child's exit status gets correctly reported to 'wait()'
- SIGCHLD gets ignored by default
- pending signals survive 'execve()'

Fixes #1035.
2014-01-30 10:05:44 +01:00
Stefan Kalkowski
7876dfcb5e block: free packet stream dataspace on destruction
Fixes #1033
2014-01-30 10:05:44 +01:00
Stefan Kalkowski
c888ff0d76 pci_session: add free_dma_buffer call (Fix #1037) 2014-01-30 10:05:44 +01:00
Christian Helmuth
aa02fb8256 Revise delete with allocators
Delete operators with additional allocator reference/pointer parameters
are needed if the constructor of an 'new(allocator)' allocated object
throws an exception. Also, destroy now uses the operator to free memory
and provides variants with allocator reference and pointer.

The commit includes a simple test scripts 'run/new_delete', which
exercises the several 'delete' cases.

Related to #1030.
2014-01-30 10:05:44 +01:00
Christian Helmuth
3234e4f775 Make Deallocator::need_size_for_free() pure virtual 2014-01-30 10:05:43 +01:00
Christian Helmuth
32f6d75cdb Fix compiler warnings 2014-01-28 09:27:09 +01:00
Christian Helmuth
b803375863 Fix ram-fs chunk test
The script was missing RM service and had color codes in output to
compare.
2014-01-28 09:27:09 +01:00
Christian Prochaska
ddc79d5563 base-linux: fix race condition in IPC code
Fixes #1013.
2014-01-27 18:54:09 +01:00
Stefan Kalkowski
5447c406e5 thread: rearrange thread context management
Use a bit allocator for the allocation management of thread contexts,
instead of holding allocation information within the Thread_base objects,
which lead to race conditions in the past.

Moreover, extend the Thread_base class interface with the ability to
to add additional stacks to a thread, and associate the context they're
located in with the corresponding Thread_base object. Additional stacks
can be used to do user-level scheduling with stack switching, without breaking
Genode's API.

Fixes #1024
Fixes #1036
2014-01-27 18:54:09 +01:00
Stefan Kalkowski
66c5887bd3 Move Bit_allocator from base-nova to base
Change the template parameter for Bit_allocator, and Bit_array. Instead of
assigning words to be used by the bit array, you can now tell the count of
items that shall be used.

Moreover, some dead code, previously using the Bit_allocator, was removed.

Related to #1024
2014-01-27 18:54:09 +01:00
Christian Helmuth
1645587b6a pistachio: Explicitly require autoconf >= 2.50
'make -C base-pistachio prepare' produces the following error otherwise

  autoconf: Undefined macros:
  configure.in:117:AC_CONFIG_HEADERS([config.h])
  configure.in:129:Please[AC_HELP_STRING([--with-comport=PORT],
  configure.in:138:Please[AC_HELP_STRING([--with-comspeed=SPEED],
  configure.in:147:Please[AC_HELP_STRING([--with-kickstart-linkbase=BASE],
  configure.in:152:Please[AC_HELP_STRING([--with-s0-linkbase=BASE],
  configure.in:157:Please[AC_HELP_STRING([--with-roottask-linkbase=BASE],
  configure.in:162:Please[AC_HELP_STRING([--with-kerneldir=DIR],
  configure.in:341:AC_CONFIG_FILES([
  configure.in:36:AC_CONFIG_SRCDIR([serv/sigma0/sigma0.cc])

Fixes #1034.
2014-01-27 18:54:09 +01:00
Christian Helmuth
8ed2e150a4 gdb_monitor: inhibit .gdbinit in unattended test 2014-01-27 18:54:09 +01:00
Rolf Sommerhalder
4ac81ad179 Fix run/uart, which fails to run without IO_PORT
Fixes #1031
2014-01-27 18:54:09 +01:00
Christian Helmuth
7e517179c9 Unify stack alignment among all platforms
The alignment is now done in Thread_base::Context. Implementations are
forced to use Context::stack_top(), which aligns the stack top.
2014-01-27 18:54:08 +01:00
Norman Feske
6ec36350d6 base: New Genode::Deallocator interface
Splitting the new Genode::Deallocator interface from the former
Genode::Allocator interface enables us to restrict the accessible
operations for code that is only supposed to release memory, but not
perform any allocations.

Additionally, this patch introduces variants of the 'new' operator
that takes a reference (as opposed to a pointer) to a Genode::Allocator
as argument.
2014-01-27 18:54:08 +01:00
Norman Feske
99979e09ed Xml_node::Attribute::value_size accessor 2014-01-27 18:54:08 +01:00
Norman Feske
a60966150e Service for reflecting reports as ROM modules
Issue #1026
2014-01-27 18:54:08 +01:00
Norman Feske
7c23d6cd81 nitpicker: Report pointer position 2014-01-27 18:54:08 +01:00
Norman Feske
2a576da2b0 Infrastructure for posting status reports
This commit introduces the "Report" session interface and a simple
service to forward reports to the LOG service.

Fixes #1026
2014-01-27 18:54:08 +01:00
Norman Feske
f32a97da38 Use filename as default label for ROM connections
By assigning the file name as label, we may become able to remove the
filename argument in the future by just interpreting the last part of
the label as filename. By keeping only the label, we won't need to
consider conditional routing (via <if-arg>) based on session arguments
other than the label anymore.
2014-01-27 18:54:07 +01:00
Norman Feske
9cb603eb5f Dynamic ROM service for automated testing 2014-01-27 18:54:07 +01:00
Norman Feske
332aeba844 util/string.h: String::operator == 2014-01-27 18:54:07 +01:00
Norman Feske
bdfbe9f20e New 'os/attached_dataspace.h' utility
The new Attached_dataspace complements the existing Attached_*
utilities with a simple version that can be used with any kind of
dataspaces. It may be even useful as a common base type for the other
variants. For example, this patch simplifies Attached_rom_dataspace
and removes the Terminal::Client::Io_buffer.
2014-01-27 18:54:07 +01:00
Norman Feske
759e11f9af Add Attached_rom_dataspace::update
This patch enhances the 'Attached_rom_dataspace' utility to support
dynamic updates of ROM modules.
2014-01-27 18:54:07 +01:00
Norman Feske
b6f59fb9be XML generator and test
Fixes #1019
2014-01-27 18:54:07 +01:00
Norman Feske
865f2b263f New utility for managing volatile class members
Fixes #1025
2014-01-27 18:54:07 +01:00
Norman Feske
3394be9464 Clean up scout widgets
This patch integrate the scout widgets with Genode's new API headers
'util/geometry.h', 'os/surface.h' and 'os/texture.h'. Thereby, we get
almost rid of the platform-abstraction shim that was never used anyway.

Furthermore, it extracts the parts that are worth reusing from the
scout implementation to the public location 'demo/include/scout'.
2014-01-27 18:54:06 +01:00
Norman Feske
8c8d53777f Generalization of nitpicker's graphics backend
This patch re-arranges nitpicker's graphics backend in a more modular
and expandable way. Generalized versions of the 'Canvas',
'Chunky_canvas', and 'Pixel_*' classes have been moved to
'os/include/util/' and 'os/include/os'. The only remaining parts that
are specific to nitpicker's needs are a few drawing functions, each
located in a distinct header at 'os/include/nitpicker_gfx/'.
2014-01-27 18:54:06 +01:00
Norman Feske
765053ea94 Remove nitpicker_gfx/nitpicker_types.h 2014-01-27 18:54:06 +01:00
Norman Feske
0063f217ca Move nitpicker_gfx/color.h to util/color.h 2014-01-27 18:54:06 +01:00
Norman Feske
e809192b97 Remove nitpicker_gfx/miscmath.h 2014-01-27 18:54:06 +01:00
Norman Feske
99ddd1cd85 Add demo/include/util/dither_matrix.h
This patch moves a repeatedly used dithering matrix from the scout
source code to a public header to share it across programs.
2014-01-27 18:54:06 +01:00
Norman Feske
35bfc34db5 Move nitpicker_gfx/geometry.h to util/geometry.h
This patch makes nitpicker's geometry utilities available for the use
by other programs. Thereby, the 'Point', 'Area', and 'Rect' classes
have become templates that take the coordinate type and distance type
as arguments.
2014-01-27 18:54:06 +01:00
Norman Feske
6efac7672f tool/fix_include_ifndef: consider license header 2014-01-27 18:54:05 +01:00
Norman Feske
8ca0f04ba0 Length and capacity accessors for Genode::String 2014-01-27 18:54:05 +01:00
Norman Feske
64a9a53c98 terminal_echo.run: Adjust timer quota 2014-01-27 18:54:05 +01:00
Christian Prochaska
4f9be09643 Arora: add gallium.lib.so boot module
QtGui depends on gallium now, so gallium.lib.so needs to be available as
boot module.

Fixes #992.
2014-01-27 18:54:05 +01:00
Christian Prochaska
5df654ace4 Fix memory leak in Gallium EGL driver
With this patch, the reference count of the textures created in
'Surface::_validate()' gets decreased in the '~Surface()' destructor.

Fixes #1012.
2014-01-27 18:54:05 +01:00
Christian Prochaska
cca2dbc400 Arora: fix the demo launchpad configuration
This patch adapts the launchpad configuration of the Nitpicker plugin demo
to the current launchpad config syntax.

Fixes #1018.
2014-01-27 18:54:05 +01:00
Christian Helmuth
a3e30cc96c run: instruct 'exec' to ignore stderr output
Unless '-ignorestderr' is set on 'exec' in expect, any output on stderr
is interpreted as execution failure. In this case, 'create_iso' logs
some diagnostics but does not fail.

We repeatedly promote our ISOs to be bootable from USB storage.
Therefore, we have a hard dependency on 'isohybrid' and should fail in
the case that the tool is missing.
2014-01-27 18:53:52 +01:00
Stefan Kalkowski
6a076ff621 block: use new server framework in block drivers
As a side effect, the entrypoints in the USB driver are merged into one thread.

Fixes #1027
2014-01-27 18:53:52 +01:00
Josef Söntgen
2e99c19601 libc: add support for sysconf(_SC_PAGESIZE)
Fixes #1029.
2014-01-17 14:04:29 +01:00
Josef Söntgen
6e15d966c7 noux: add e2fsprogs-v1.42.9 package
Fixes #1029.
2014-01-17 14:04:29 +01:00
Josef Söntgen
c4c43ffc9d noux: add block device file system
Access to a block session is provided by using the block file system.
By specifying the label, each block session request can be routed to
the proper block session provider:

! <fstab>
! 	...
! 	<dir name="dev">
! 		<block name="blkdev0" label="block_session_0" />
! 	</dir>
! 	...
! </fstab>

In addition to this file system, support for the DIOCGMEDIASIZE ioctl
request was added. This request is used by FreeBSD and therefore our
libc to query the size of the block device in bytes.

Fixes #1010.
2014-01-17 14:04:29 +01:00
Christian Helmuth
25b41e9cff hello: fix quota value and integration of timer
Fixes #1028.
2014-01-17 14:04:29 +01:00
Alexander Boettcher
041dd2a133 netperf: use Genode specific alarm timer
Fixes #1021
2014-01-17 14:04:29 +01:00
Norman Feske
fe45cc8c05 Road map for 2014 2014-01-17 14:04:09 +01:00
Norman Feske
68608bb62d Increase quota for resource_request test
Needed to let the test pass on foc_x86_64.
2014-01-16 18:34:06 +01:00
Norman Feske
6a19b30795 Vancouver: Clarify license headers
All source codes of the glue code between Vancouver and Genode that were
based on existing GPL code had already stated that Genode Labs is not
the sole owner of the code. To make the distinction between the Genode
OS framework and the glue code more clear, this patch removes the text
"is part of the Genode OS framework" from the glue code.
2014-01-16 18:34:06 +01:00
Stefan Kalkowski
23ce0b2071 block: fix race in generic block driver component
Fixes #1023
2014-01-16 18:34:06 +01:00
Stefan Kalkowski
65291902e0 os: manage/dissolve Signal_rpc_member in class
Instead of, passing responsibility to manage and dissolve Signal_rpc_member
objects at a corresponding entrypoint to the user, hand over entrypoint's
reference to the constructor, and do it in the constructor resp. destructor
of the class.

Fixes #1022
2014-01-16 18:34:06 +01:00
Alexander Boettcher
bf57a5d79c pci: increase memory for device pd
not enough anymore on 32 bit after #989 changes
2014-01-16 18:34:06 +01:00
Norman Feske
07b355b4e4 Clarify comment in base-libs.mk 2014-01-16 18:34:06 +01:00
Christian Prochaska
efd20a7ded loader: fix the 'constrain_geometry()' function
Fixes #1014.
2014-01-16 18:34:06 +01:00
Christian Prochaska
cbd3d0a878 Qt4: fix the 'qpluginwidget' test
Fixes #1015.
2014-01-16 18:34:06 +01:00
Sebastian Sumpf
880930cb4f lxip: support configuration of libc plugin
Added support for the 'ip_addr', 'gateway', and 'netmask' configuration
parameter.

Issue #984
2014-01-16 18:34:06 +01:00
Martin Stein
12f560dc0e fiasco: remove remains of once supported ARM port
ref #989
2014-01-16 18:34:05 +01:00
Ivan Loskutov
b6626607f0 libport: Fix of download location of pcre
Fixes #840
2014-01-08 11:41:07 +01:00
Norman Feske
feedbe4bb9 failsafe test: Fix destruction order 2014-01-07 12:16:16 +01:00
Norman Feske
c8cf882a94 News item for FOSDEM 2014 2014-01-06 11:46:13 +01:00
Norman Feske
89403a24b3 Avoid target-name ambiguity of "test-thread"
Both base/src/test/thread and base-okl4/src/test/okl4_03_thread used the
same target name, which ultimately confused the build system when
building on OKL4.
2013-12-28 19:50:25 +01:00
Josef Söntgen
2e6255d1cf libc_fs: fix potential memory leak in symlink()
Free always the file descriptor and plugin context, return
the appropriate value to the caller and only in the error
case set errno.

Fixes #1009.
2013-12-20 15:21:59 +01:00
Josef Söntgen
f71e38702f noux: add SYSCALL_SYNC
File systems using the File_system_session interface can now be
synchronized by using this syscall. This is needed for file system
that maintain an internal cache, which should be flushed.

Fixes #1008.
2013-12-20 15:21:08 +01:00
Josef Söntgen
e1370b558e add sync implementation to various fs servers
Fixes #1007.
2013-12-20 15:20:10 +01:00
Josef Söntgen
1c67e3bb43 os: extentend File_system interface with sync RPC
Users of a File_system_session might want to force a file system
to flush or rather to synchronize its internal cache. A concret
default implementation is provided because not all file systems
maintain an internal cache and are not required to synchronize
caches.

Fixes #1007.
2013-12-20 15:20:05 +01:00
Alexander Boettcher
944be1b4e6 nova: throw exception if ram_ds setup fails
Fail hard if no large enough virtual memory area can be found where to map
the memory from the kernel to core.

Additionally clear dataspaces in junks if it can't be done in one large junk.

Fixes #1011
2013-12-20 15:17:33 +01:00
Alexander Boettcher
22c1f8772b base: catch errors during ram_ds allocation
Issue #1011
2013-12-20 15:16:25 +01:00
Alexander Boettcher
b893968232 base: show size as %zu instead %zd
For big numbers otherwise negative sizes for memory chunks are displayed.

Issue #1011
2013-12-20 15:16:19 +01:00
Sebastian Sumpf
b8beba5bf3 ldso: Support for setting global object values
Make 'set_program_var' accessible outside of 'rtld.c'. Also, compile
dynamically linked programs with the '-fPIC' option. Doing not so,
yields to program-global symbols being put in the '.symtab' section
(which can be stripped) only. In order to get access to global
variables from the dynamic linker, the symbols need to reside within
the '.dynsym' section additionally. Hence the '-fPIC'.

ref #989
fix #1002
2013-12-20 14:48:06 +01:00
Martin Stein
1aadce4496 codezero: adjust pager ID to new thread order
ref #989
2013-12-20 14:48:06 +01:00
Martin Stein
49eeb485d9 hw: mark caller when printing an activity-table
ref #989
2013-12-20 14:48:06 +01:00
Martin Stein
906b4dc90a hw: format fix in activity table
ref #989
2013-12-20 14:48:06 +01:00
Martin Stein
f4bd2368f6 hw: cancel unresolved faults before pager dissolve
If an RM client gets dissolved the RM server tries to first
dissolve and then destruct the according pager object. As pager objects
previously cancelled unresolved faults only in destructor the dissolve
operation blocked forever when an unresolved fault existed.
As every pager object should get dissolved before it gets destructed
(signal-context complains otherwise) no more unresolved-fault cancelling
is needed in the destructor.

ref #989
2013-12-20 14:48:06 +01:00
Martin Stein
8eef91f2ac hw: do not block on destruction of signal receiver
As synchronization of signal contexts is now the users business instead of
cores and the signal framework ensures that every context of a receiver gets
synchronously destructed before the destruction of the receiver itself
synchronization and thus blocking at the destruction of a kernel
receiver-object isn't necessary anymore.

ref #989
2013-12-20 14:48:06 +01:00
Martin Stein
1c8c30e1f4 hw: sync signal contexts directly as user
Kernel::signal_context_kill can be used by any program to halt the processing
of a signal context synchronously to prevent broken refs when core destructs
the according kernel object. In turn, Kernel::bin_signal_context doesn't block
anymore and destructs a signal context no matter if there are unacknowledged
signals. This way, cores entrypoint doesn't depend on signal acks of a
untrustworthy client anymore.

ref #989
2013-12-20 14:48:06 +01:00
Martin Stein
2bdf0e70e9 hw: fix bug in Kernel::Thread::_print_activity
ref #989
2013-12-20 14:48:06 +01:00
Martin Stein
3bdf70f771 hw: rename kill_* functions in bin_*
In the future bin_* means the direct destruction of a kernel object
without any blocking. kill_* in contrast is used for bringing a
kernel object such as signal contexts synchronized into a sleeping
state from where they can be destructed without the risk of getting
broken refs in userland.

ref #989
2013-12-20 14:48:06 +01:00
Martin Stein
750f5313f7 base: avoid compiler warning in Thread::stack_top
The statement _context->stack[-1] triggered the compiler warning
'array subscript is below array bounds'.

ref #989
2013-12-20 14:48:06 +01:00
Alexander Boettcher
a596bfe797 run: test for main thread_base object
ref #989
2013-12-20 14:48:05 +01:00
Martin Stein
6aa0ab1bf9 hw: communicate UTCB dataspace through start info
To remap its UTCB to its context area later, a main thread needs
to know the according dataspace capability. This is done through
the start-info it receives from its creator at startup.

ref #989
2013-12-20 14:48:05 +01:00
Martin Stein
42f51cd802 hw: use core-PD class to prevent singleton clashes
ref #989
2013-12-20 14:48:05 +01:00
Martin Stein
4009619206 base: natural default align in unmanaged singleton
I have no idea where the previous default alignment = 2 in the unsynchronized
singleton came from but as at least the Arndale IC-driver in base-hw needs an
alignment of 4 = address width, unmanaged singleton now uses sizeof(addr_t)
as default alignment.

ref #989
2013-12-20 14:48:05 +01:00
Martin Stein
77130a9404 hw: replace unsynchronized by unmanaged singleton
ref #989
2013-12-20 14:48:05 +01:00
Martin Stein
212fc47768 base: provide template for unmanaged singletons
An unmanaged singleton is a singleton object that isn't
constructed or destructed implicitly through the C++ runtime
enviroment. The new header provides a helper to create such objects
and is located in src/base/include.

ref #989
2013-12-20 14:48:05 +01:00
Stefan Kalkowski
ea9c0e20ba part_blk: increase ep stack size and bulk buffer
* Increase entrypoint stack size for part_blk server,
  since it crashes on 64 bit
* Consider packet alignment in bulk buffer size calculation of test-blk-cli
2013-12-19 11:34:05 +01:00
Stefan Kalkowski
af86e33c3f part_blk: re-design to work event driven
Fix #750
2013-12-19 11:34:05 +01:00
Stefan Kalkowski
35bb156972 block: extend block session test framework 2013-12-19 11:34:05 +01:00
Stefan Kalkowski
e73a71be12 packet stream: clean range allocator in destructor 2013-12-19 11:34:05 +01:00
Stefan Kalkowski
56a7d00a44 block: extend generic driver API (Ref #750)
* allow to handle a maximum of packets in parallel
  that fits free slots in the ack queue
* stop processing packets, when the driver can't handle
  more requests in parallel, and resume packet handling,
  when the driver is ready again
2013-12-19 11:34:04 +01:00
Stefan Kalkowski
b10b9e20a2 block: support for block number >32 bit (Fix #968) 2013-12-19 11:34:04 +01:00
Josef Söntgen
1bc16f3a23 ahci: missing shift when setting FIS adress
Fixes #997.
2013-12-12 08:49:41 +01:00
Josef Söntgen
038fcf032a os: dissolve contexts in Packet_stream
Fixes #1003.
2013-12-11 08:25:44 +01:00
Stefan Kalkowski
cc3b1599b8 Follow-follow-up fix for "hw: basic support..." 2013-12-09 14:05:53 +01:00
Christian Helmuth
1f75805d54 fs run: fix Qemu ATAPI compatibility test 2013-12-09 14:05:53 +01:00
Christian Helmuth
50c30b1702 libc_block: enable and fix warnings 2013-12-09 14:05:53 +01:00
Alexander Boettcher
05ad5a6ad4 noux: adjust timeouts for diverse platforms
Issue #996
2013-12-09 10:49:16 +01:00
Alexander Boettcher
9759000538 foc: evaluate run_opt target for uboot link
Unify handling as base-hw does and enables us to use uBoot image for foc_panda.
2013-12-09 10:49:16 +01:00
Christian Helmuth
776fdceaa5 vesa: explicitly request VBE 2.0 information
We also skip any non-direct-color modes now.
2013-12-09 10:49:16 +01:00
Christian Helmuth
eaed3ba207 acpi: print RMRR region (not just base) 2013-12-09 10:49:16 +01:00
Christian Helmuth
b24f48b125 framebuffer test: acpi_drv and pci_device_pd 2013-12-09 10:49:16 +01:00
Stefan Kalkowski
8b7c67976d Follow-up fix for "hw: basic support for ODROID" 2013-12-09 10:49:16 +01:00
Stefan Kalkowski
277ca33988 usb block: use generic block driver API (Fix #966) 2013-12-09 10:49:16 +01:00
Stefan Kalkowski
c3c643bcf1 block: let generic driver API work asynchronously
Fix #990
2013-12-04 11:14:18 +01:00
Martin Stein
9c698ab6c1 noux_tool_chain_auto & hw_arndale: adjust timeouts
As hw_arndale is a bit slower than foc_arm and spawn_serial timing
calculation has changed in general, timeouts of noux_tool_chain_auto test
must be adjusted.

fix #996
2013-12-03 18:05:10 +01:00
Stefan Kalkowski
7b49dbf2f3 hw: basic support for ODROID XU board (Fix #991) 2013-12-03 11:30:07 +01:00
Alexander Boettcher
9b456fb3be run: spelling fix 2013-12-03 10:40:23 +01:00
Christian Prochaska
4519b39ba7 Qt5: use pthread synchronization functions
The Genode-specific implementation of 'QWaitCondition' contains a race
condition which can make the 'qt5_samegame' application hang on Fiasco.OC.

Since most of the pthread synchronization functions needed by the
UNIX-specific implementation of 'QWaitCondition' and 'QMutex' are
available now, we can use these now instead of fixing and keeping
the Genode-specific implementation.

Fixes #993.
2013-12-03 10:40:23 +01:00
Martin Stein
c4068c4001 FB & omap4: fix mix-up of _fb_height and _fb_width
fix #983
2013-12-03 10:40:23 +01:00
Martin Stein
d57319bbcb FB test: add stripes to detect line-shift bugs
ref #983
2013-12-03 10:40:23 +01:00
Martin Stein
576b9389cb FB test: fix wrong FB access-widths
ref #983
2013-12-03 10:40:22 +01:00
Christian Helmuth
1ba4e033a7 lxip: fake get_random_bytes() 2013-12-03 10:40:22 +01:00
Christian Helmuth
c05a80a139 netperf: move check for qemu to netperf.inc 2013-12-03 10:40:22 +01:00
Stefan Kalkowski
9d82720a29 http_blk: add run script for automated tests
Ref #966
2013-12-03 10:40:22 +01:00
Stefan Kalkowski
020ba97106 http_blk: use libc_lwip plugin, not lwip directly
Ref #966
2013-12-03 10:40:22 +01:00
Stefan Kalkowski
adc63ef2a6 rom_blk test: abort if test fails
Instead of printing the success message at the end of the test,
abort as soon as two blocks differ.

Ref #966
2013-12-03 10:40:22 +01:00
Stefan Kalkowski
66d499e416 http_block: rename to http_blk to be consistent
Ref #966
2013-12-03 10:40:22 +01:00
Stefan Kalkowski
bf90fd5f66 http_block: use generic block component/driver
Ref #966
2013-12-03 10:40:22 +01:00
Stefan Kalkowski
fec51620f7 fb_block_adapter: use generic block component/driver
Ref #966
2013-12-03 10:40:21 +01:00
Stefan Kalkowski
1b7b0b2050 atapi_drv: use generic block component/driver
Ref #966
2013-12-03 10:40:21 +01:00
Stefan Kalkowski
4c74af274b rom_loopdev: rename to rom_blk to be consistent
Ref #966
2013-12-03 08:33:26 +01:00
Stefan Kalkowski
1256b01867 rom_loopdev: use generic block component/driver
Ref #966
2013-12-03 08:33:26 +01:00
Stefan Kalkowski
0c8a4f9f3a block: extend interface of generic driver class
To support read-only devices like CDROMs, or rom_blk the supported
block operations have to be stated by specific the device driver.

Ref #966
2013-12-03 08:33:26 +01:00
Stefan Kalkowski
5a4cb7fcfb block: eliminate thread in generic block_component
Instead of using an additional thread in each Session_component of a
block server, which uses the generic block component and driver classes,
replace it with signal dispatchers.

Ref #113
2013-12-03 08:33:26 +01:00
Martin Stein
f4c724639b arm: raise stack size of main thread
With 64K stack size, when doing 'make core' in noux on base-hw, the main thread
of /libexec/gcc/arm-elf-eabi/4.7.2/cc1plus runs into a stack overflow during
the compilation of core/main.o . Thus raise the stack size to 128K.

fix #964
2013-12-03 08:33:26 +01:00
Martin Stein
8514eecc90 noux_tool_chain.inc: remove trailing whitespaces
ref #964
2013-12-03 08:33:26 +01:00
Martin Stein
51db6a6056 noux_terminal_fs: remove bad bracket in run script
ref #964
2013-12-03 08:33:25 +01:00
Martin Stein
a2e6fdd922 noux_shell_script: platform driver and usb input
Provide platform driver and USB input driver in run/noux_shell_script
if they are needed.

ref #964
2013-12-03 08:33:25 +01:00
Martin Stein
31b4062688 hw: optionally provide activity table on RM faults
ref #964
2013-12-03 08:33:25 +01:00
Martin Stein
f356ad2bdf hw: print activity table via Kernel::print_char(0)
ref #964
2013-12-03 08:33:25 +01:00
Martin Stein
e35d7c979f hw: IPC nodes provide protected accessors
ref #964
2013-12-03 08:33:25 +01:00
Martin Stein
16d48eaf1e hw: signalling roles provide protected accessors
ref #964
2013-12-03 08:33:25 +01:00
Martin Stein
da116c66ba hw: public access to idle item of a scheduler
ref #964
2013-12-03 08:33:25 +01:00
Martin Stein
8d19aad601 hw_pbxa9: provide 768 MB RAM
The previously used RAM 0x0..0x10000000 was just an alias for
0x70000000..0x80000000. Qemu provides up to of 768 MB RAM with the
correct -m argument. This RAM is located at 0x70000000..0x90000000 and
0x20000000..0x30000000. At least the noux_tool_chain scripts are
happy to have that much RAM.

ref #964
2013-12-03 08:33:25 +01:00
Martin Stein
6e90f70ec2 run: force qemu to emulate PBXA9 with -m 768
For PBXA9 qemu adjusts provided RAM chips to the -m arg. Thus we
filter user values and force value that enables all chips that Genode
expects to be available. Not doing so leads to inexplicable errors.

ref #964
2013-12-03 08:33:25 +01:00
Martin Stein
b5922fb7f1 hw: dissolve signal context in Pager_entrypoint
ref #964
2013-12-03 08:33:24 +01:00
Martin Stein
1eeb68bf56 hw: adjust gcc package to makeinfo version 5
Makeinfo versions greater 5 treat an @itemx that isn't preceeded by an @item
not as warning anymore but as error. The GCC version 4.7.2 that is used by
noux currently triggers this error multiple times. This commit adds a patch
to 'make prepare PKG="gcc"' that avoids the use of @itemx without preceeding
@item. As GCC versions greater than 4.8 should fix this problem by themselves
this should be seen as temporary quick fix.

ref #964
2013-12-03 08:33:24 +01:00
Alexander Boettcher
aca62c7180 noux: enable some arm platforms running tool_chain
ref #964
2013-12-03 08:33:24 +01:00
Martin Stein
fd003f0e00 noux_fork: use pause() instead of endless loop
At least with base-hw, the endless loop at the end of the fork
parent slows execution of the fork child dramatically. Using
libc function pause() is a cleaner solution anyways.

ref #964
2013-12-03 08:33:24 +01:00
Martin Stein
54610247ad hw: don't communicate main-thread UTCB via SP
When using the initial SP of a main thread for the UTCB
startup-argument, fork_trampoline in libc_noux gets broken.
The function expects the SP to be initialized already in contrast
to the _start function in crt0.s that is called for processes that
are not forked. As the main-thread UTCB is located at the same virtual
address for every PD anyways, we can circumvent this problem by
defining it statically.

ref #964
2013-12-03 08:33:24 +01:00
Martin Stein
2b8e5d7b19 hw: turn Native_utcb into restrictive class
fix #958
2013-12-03 08:33:24 +01:00
Martin Stein
5e3d505ef4 hw: bin stupid case in Thread::_await_ipc_failed
ref #958
2013-12-03 08:33:24 +01:00
Martin Stein
dc8cbbf022 hw: rename Startup_msg in Start_info
ref #958
2013-12-03 08:33:24 +01:00
Martin Stein
4359b99c4f hw: rename Ipc_msg in Message
ref #958
2013-12-03 08:33:23 +01:00
Martin Stein
575a81a633 hw: turn Ipc_msg into restrictive class
ref #958
2013-12-03 08:33:23 +01:00
Martin Stein
f128a52e8b hw: get rid of struct Msg and Msg::Type
Struct Msg was introduced due to the handling of pagefaults
and interrupts via synchronous IPC. Its only purpose was to provide
the message type in front of the typed message. Now pagefaults and
interrupts are handled via signals and struct Msg is not necessary
anymore.

ref #958
2013-12-03 08:33:23 +01:00
Martin Stein
d46b30a711 hw: clarify names of messaging kernel-calls
ref #958
2013-12-03 08:33:23 +01:00
Stefan Kalkowski
fbeaa9e358 fix typo on challenges page (fix #988) 2013-12-02 10:56:46 +01:00
Norman Feske
aa220ba042 Minor fixes of the release notes for version 13.11 2013-12-02 10:56:46 +01:00
873 changed files with 42752 additions and 14302 deletions

2
.gitignore vendored
View File

@@ -17,6 +17,8 @@
/dde_linux/download
/dde_oss/contrib
/dde_oss/download
/dde_rump/contrib
/dde_rump/include/rump
/libports/contrib
/libports/download
/libports/include/curl/

7
README
View File

@@ -152,6 +152,13 @@ The Genode source tree is composed of the following subdirectories:
This source-code repository contains the device-driver environment for the
audio drivers of the Open Sound System (OSS).
:'dde_rump':
This source-code repository contains the port of rump kernels, which are
used to execute subsystems of the NetBSD kernel as user level processes.
The repository contains a server that uses a rump kernel to provide
various NetBSD file systems to Genode.
:'qt4':
This source-code repository contains the Genode version of Qt4 framework.

View File

@@ -95,13 +95,15 @@ namespace Genode {
/**
* Thread-context area configuration.
*/
static addr_t context_area_virtual_base() { return 0x40000000UL; }
static addr_t context_area_virtual_size() { return 0x10000000UL; }
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 addr_t context_virtual_size() { return 0x00100000UL; }
static constexpr addr_t context_virtual_size() { return 0x00100000UL; }
};
struct Native_pd_args { };

View File

@@ -4,9 +4,9 @@
# \date 2013-02-14
#
LIBS += cxx l4 startup
LIBS += cxx syscall startup
SRC_CC += cap_copy.cc main_bootstrap.cc
SRC_CC += cap_copy.cc
SRC_CC += ipc/ipc.cc ipc/pager.cc ipc/ipc_marshal_cap.cc
SRC_CC += pager/pager.cc pager/common.cc
SRC_CC += avl_tree/avl_tree.cc
@@ -21,14 +21,13 @@ SRC_CC += lock/lock.cc
SRC_CC += signal/signal.cc signal/common.cc
SRC_CC += server/server.cc server/common.cc
SRC_CC += thread/thread.cc thread/thread_bootstrap.cc thread/trace.cc
SRC_CC += env/utcb.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/thread
INC_DIR += $(REP_DIR)/include/codezero/dummies
vpath main_bootstrap.cc $(REP_DIR)/src/platform
vpath cap_copy.cc $(BASE_DIR)/src/platform
vpath %.cc $(REP_DIR)/src/base
vpath %.cc $(BASE_DIR)/src/base
vpath cap_copy.cc $(BASE_DIR)/src/platform
vpath %.cc $(REP_DIR)/src/base
vpath %.cc $(BASE_DIR)/src/base

View File

@@ -1,5 +1,5 @@
SRC_CC += console/log_console.cc
SRC_CC += env/env.cc env/context_area.cc env/reload_parent_cap.cc
SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc
SRC_CC += thread/thread_start.cc
INC_DIR += $(BASE_DIR)/src/base/env

View File

@@ -7,7 +7,7 @@ index 7b315b8..ace38d8 100644
struct container;
-#define tcb_pagerid(tcb) ((tcb)->pager->tid)
+#define tcb_pagerid(tcb) 3
+#define tcb_pagerid(tcb) 4
#define space_is_pager(tcb) \
((tcb)->space->spid == (tcb)->pager->space->spid)

View File

@@ -1,6 +1,7 @@
/*
* \brief Thread bootstrap code
* \author Christian Prochaska
* \author Martin Stein
* \date 2013-02-15
*/
@@ -13,13 +14,83 @@
/* Genode includes */
#include <base/thread.h>
#include <base/env.h>
#include <util/string.h>
/* Codezero includes */
#include <codezero/syscalls.h>
Genode::Native_thread_id main_thread_tid;
Codezero::l4_mutex main_thread_running_lock;
/*****************************
** Startup library support **
*****************************/
void prepare_init_main_thread()
{
/* initialize codezero environment */
Codezero::__l4_init();
/* provide kernel identification of thread through temporary environment */
main_thread_tid = Codezero::thread_myself();
}
void prepare_reinit_main_thread() { prepare_init_main_thread(); }
/****************************
** Codezero libl4 support **
****************************/
/*
* Unfortunately, the function 'exregs_print_registers' in 'exregs.c' refers to
* 'memset'. Because we do not want to link core against a C library, we have to
* resolve this function here.
*/
extern "C" void *memset(void *s, int c, Genode::size_t n) __attribute__((weak));
extern "C" void *memset(void *s, int c, Genode::size_t n)
{
return Genode::memset(s, c, n);
}
/*
* Same problem as for 'memset'. The 'printf' symbol is referenced from
* 'mutex.c' and 'exregs.c' of Codezero's libl4.
*/
extern "C" int printf(const char *format, ...) __attribute__((weak));
extern "C" int printf(const char *format, ...)
{
va_list list;
va_start(list, format);
Genode::vprintf(format, list);
va_end(list);
return 0;
}
/*****************
** Thread_base **
*****************/
void Genode::Thread_base::_thread_bootstrap()
{
Codezero::l4_mutex_init(utcb()->running_lock());
Codezero::l4_mutex_lock(utcb()->running_lock()); /* block on first mutex lock */
}
void Genode::Thread_base::_init_platform_thread(Type type)
{
if (type == NORMAL) { return; }
/* adjust values whose computation differs for a main thread */
_tid.l4id = main_thread_tid;
_thread_cap = Genode::env()->parent()->main_thread_cap();
/* get first mutex lock (normally done by _thread_bootstrap) */
Codezero::l4_mutex_init(utcb()->running_lock());
Codezero::l4_mutex_lock(utcb()->running_lock());
}

View File

@@ -39,9 +39,6 @@ void Thread_base::_thread_start()
** Thread base **
*****************/
void Thread_base::_init_platform_thread() { }
void Thread_base::_deinit_platform_thread()
{
env()->cpu_session()->kill_thread(_thread_cap);
@@ -64,9 +61,7 @@ void Thread_base::start()
env()->cpu_session()->set_pager(_thread_cap, _pager_cap);
/* register initial IP and SP at core */
addr_t thread_sp = (addr_t)&_context->stack[-4];
thread_sp &= ~0xf; /* align initial stack to 16 byte boundary */
env()->cpu_session()->start(_thread_cap, (addr_t)_thread_start, thread_sp);
env()->cpu_session()->start(_thread_cap, (addr_t)_thread_start, _context->stack_top());
}

View File

@@ -27,10 +27,6 @@ enum { verbose_thread_start = true };
using namespace Genode;
void Thread_base::_init_platform_thread() { }
void Thread_base::_deinit_platform_thread() { }
@@ -104,7 +100,7 @@ void Thread_base::start()
/* create and start platform thread */
_tid.pt = new(platform()->core_mem_alloc()) Platform_thread(_context->name);
_tid.l4id = create_thread(1, &_context->stack[-4], (void *)&_thread_start);
_tid.l4id = create_thread(1, stack_top(), (void *)&_thread_start);
if (_tid.l4id < 0)
PERR("create_thread returned %d", _tid.l4id);

View File

@@ -1,81 +0,0 @@
/*
* \brief Platform-specific helper functions for the _main() function
* \author Norman Feske
* \author Christian Helmuth
* \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.
*/
/* Genode includes */
#include <base/stdint.h>
#include <base/printf.h>
#include <base/thread.h>
#include <util/string.h>
/* Codezero includes */
#include <codezero/syscalls.h>
/****************************
** Codezero libl4 support **
****************************/
/*
* Unfortunately, the function 'exregs_print_registers' in 'exregs.c' refers to
* 'memset'. Because we do not want to link core against a C library, we have to
* resolve this function here.
*/
extern "C" void *memset(void *s, int c, Genode::size_t n) __attribute__((weak));
extern "C" void *memset(void *s, int c, Genode::size_t n)
{
return Genode::memset(s, c, n);
}
/*
* Same problem as for 'memset'. The 'printf' symbol is referenced from
* 'mutex.c' and 'exregs.c' of Codezero's libl4.
*/
extern "C" int printf(const char *format, ...) __attribute__((weak));
extern "C" int printf(const char *format, ...)
{
va_list list;
va_start(list, format);
Genode::vprintf(format, list);
va_end(list);
return 0;
}
/**************************
** Startup-code helpers **
**************************/
namespace Genode { void platform_main_bootstrap(); }
Genode::Native_thread_id main_thread_tid;
Codezero::l4_mutex main_thread_running_lock;
void Genode::platform_main_bootstrap()
{
static struct Bootstrap
{
Bootstrap()
{
Codezero::__l4_init();
main_thread_tid = Codezero::thread_myself();
Codezero::l4_mutex_init(&main_thread_running_lock);
Codezero::l4_mutex_lock(&main_thread_running_lock); /* block on first mutex lock */
}
} bootstrap;
}

View File

@@ -1,39 +0,0 @@
/*
* \brief Atomic operations for ARM
* \author Norman Feske
* \date 2007-04-28
*/
/*
* Copyright (C) 2007-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 {
extern "C" long int
l4_atomic_cmpxchg(volatile long int*, long int, long int);
/**
* 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.
*/
inline int cmpxchg(volatile int *dest, int cmp_val, int new_val)
{
return l4_atomic_cmpxchg((volatile long int *)dest, cmp_val, new_val);
}
}
#endif /* _INCLUDE__ARM__CPU__ATOMIC_H_ */

View File

@@ -78,13 +78,15 @@ namespace Genode {
/**
* Thread-context area configuration.
*/
static addr_t context_area_virtual_base() { return 0x40000000UL; }
static addr_t context_area_virtual_size() { return 0x10000000UL; }
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 addr_t context_virtual_size() { return 0x00100000UL; }
static constexpr addr_t context_virtual_size() { return 0x00100000UL; }
};
struct Native_pd_args { };

View File

@@ -1,6 +0,0 @@
#
# Configuration for L4 build system (for kernel-bindings, sigma0, bootstrap).
#
L4_CONFIG = $(REP_DIR)/config/l4env-config.x86
include $(REP_DIR)/lib/mk/platform.inc

View File

@@ -6,7 +6,7 @@
LIBS += cxx startup
SRC_CC += cap_copy.cc main_bootstrap.cc
SRC_CC += cap_copy.cc
SRC_CC += ipc/ipc.cc ipc/pager.cc ipc/ipc_marshal_cap.cc
SRC_CC += pager/pager.cc pager/common.cc
SRC_CC += avl_tree/avl_tree.cc
@@ -20,12 +20,12 @@ SRC_CC += elf/elf_binary.cc
SRC_CC += lock/lock.cc
SRC_CC += signal/signal.cc signal/common.cc
SRC_CC += server/server.cc server/common.cc
SRC_CC += thread/thread.cc thread/thread_bootstrap_empty.cc thread/trace.cc
SRC_CC += thread/thread.cc thread/thread_bootstrap.cc thread/trace.cc
SRC_CC += thread/context_allocator.cc
INC_DIR += $(REP_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/thread
vpath main_bootstrap.cc $(REP_DIR)/src/platform
vpath cap_copy.cc $(BASE_DIR)/src/platform
vpath %.cc $(REP_DIR)/src/base
vpath %.cc $(BASE_DIR)/src/base
vpath cap_copy.cc $(BASE_DIR)/src/platform
vpath %.cc $(REP_DIR)/src/base
vpath %.cc $(BASE_DIR)/src/base

View File

@@ -7,7 +7,7 @@
LIBS += base-common
SRC_CC += console/log_console.cc
SRC_CC += env/env.cc env/context_area.cc env/reload_parent_cap.cc
SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc
SRC_CC += thread/thread_start.cc
INC_DIR += $(BASE_DIR)/src/base/env

View File

@@ -1,50 +0,0 @@
#
# Specifics for Fiasco on ARM
#
# The following variables must be defined by a platform spec file:
#
# L4SYS_ARM_CPU - Platform identifiert used for constructing l4sys path
# names corresponding to the ARM platform. For example,
# specify 'arm_int' for the ARM integrator board.
# RAM_BASE - Start address of physical memory. If not specified,
# the start adress 0x0 is used.
#
SPECS += arm fiasco 32bit
#
# ARM-specific L4/sys headers
#
L4_INC_DIR += $(L4_BUILD_DIR)/include/arm/l4v2 \
$(L4_BUILD_DIR)/include/arm
#
# Support for Fiasco's ARM-specific extensions of L4
# and ARM-specific utility functions.
#
REP_INC_DIR += include/arm
#
# Defines for L4/sys headers
#
CC_OPT += -DSYSTEM_$(L4SYS_ARM_CPU)_l4v2
CC_OPT += -DCONFIG_L4_CALL_SYSCALLS -DL4API_l4v2 -DARCH_arm
CC_OPT += -msoft-float -fomit-frame-pointer
AS_OPT += -mfpu=softfpa
#
# Linker options that are specific for L4 on ARM
#
RAM_BASE ?= 0x0
LD_TEXT_ADDR ?= $(shell printf "0x%x" $$(($(RAM_BASE) + 0x00078000)))
CXX_LINK_OPT += -Wl,-Ttext=$(LINK_TEXT_ADDR)
CXX_LINK_OPT += -L$(L4_BUILD_DIR)/lib/$(L4SYS_ARM_CPU)/l4v2
EXT_OBJECTS += -ll4sys
#
# Also include less-specific configuration last
#
include $(call select_from_repositories,mk/spec-32bit.mk)
include $(call select_from_repositories,mk/spec-fiasco.mk)
INC_DIR += $(L4_INC_DIR)

View File

@@ -0,0 +1,41 @@
/*
* \brief Platform specific thread initialization
* \author Martin Stein
* \date 2014-01-06
*/
/*
* Copyright (C) 2014 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.
*/
/* Genode includes */
#include <base/thread.h>
#include <base/env.h>
using namespace Genode;
/*****************************
** Startup library support **
*****************************/
void prepare_init_main_thread() { }
void prepare_reinit_main_thread() { }
/*****************
** Thread_base **
*****************/
void Thread_base::_thread_bootstrap() { }
void Thread_base::_init_platform_thread(Type type)
{
if (type == NORMAL) { return; }
_thread_cap = Genode::env()->parent()->main_thread_cap();
}

View File

@@ -1,24 +0,0 @@
/*
* \brief Platform support specific to ARM
* \author Norman Feske
* \date 2007-10-13
*/
/*
* Copyright (C) 2007-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.
*/
#include "platform.h"
using namespace Genode;
void Platform::_setup_io_port_alloc()
{
/*
* This is just a dummy init function for the I/O port allocator.
* ARM does not I/O port support.
*/
}

View File

@@ -1,8 +0,0 @@
include $(PRG_DIR)/../target.inc
REQUIRES += arm
SRC_CC += platform_arm.cc
vpath io_port_session_component.cc $(GEN_CORE_DIR)/arm
vpath platform_services.cc $(GEN_CORE_DIR)

View File

@@ -41,7 +41,7 @@ void Thread_base::start()
_tid.pt->pager(platform_specific()->core_pager());
_tid.l4id = _tid.pt->native_thread_id();
_tid.pt->start((void *)_thread_start, _context->stack);
_tid.pt->start((void *)_thread_start, stack_top());
}
@@ -53,9 +53,6 @@ void Thread_base::cancel_blocking()
}
void Thread_base::_init_platform_thread() { }
void Thread_base::_deinit_platform_thread()
{
/* destruct platform thread */

View File

@@ -1,25 +0,0 @@
SRC = ../x86/genode.ld
TARGET = genode.ld
all:
@echo "--- available targets ---"
@echo " genode.ld - generate $(TARGET) from $(SRC)"
@echo " cleanall - remove generated file"
#
# NOTE: We change the start address to 0x60000, which
# is the same address as used by the original
# roottask.
#
# On L4x0, the thread ID type is only 32bit instead of 64bit
# for L4v2. Therefore, we have to adapt the place holder for
# thread ID part of the parent capability.
#
genode.ld:
cp $(SRC) $@
sed -i "s/= 0x[0-9]\+;/= 0x00060000;/" $@
sed -i "54s/^.*$$/\t\tLONG(0xffffffff);/" $@
clean cleanall:
rm -f $(TARGET)

View File

@@ -1,124 +0,0 @@
/**
* \brief Startup code for Fiasco/ARM
* \author Norman Feske
* \date 2007-04-30
*
* Call constructors for static objects before calling main().
*/
/*
* Copyright (C) 2007-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.
*/
namespace Fiasco {
#include <l4/sys/kdebug.h>
}
/* Genode */
#include <base/crt0.h>
#include <base/env.h>
#include <base/sleep.h>
#include <base/printf.h>
namespace Genode {
/**
* Return constructed parent capability
*/
Parent_capability parent_cap()
{
Fiasco::l4_threadid_t tid = *(Fiasco::l4_threadid_t *)&_parent_cap_thread_id;
return Parent_capability(Native_capability(tid, _parent_cap_local_name));
}
}
using namespace Genode;
/***************
** C++ stuff **
***************/
/*
* This symbol must be defined when exception
* headers are defined in the linker script.
*/
extern "C" __attribute__((weak)) void *__gxx_personality_v0(void)
{
Fiasco::outstring("What a surprise! This function is really used? Sorry - not implemented\n");
return 0;
}
/**
* Resolve symbols needed by libsupc++ to make
* the linker happy.
*
* FIXME: implement us!
*/
extern "C" __attribute__((weak)) int atexit(void) {
Fiasco::outstring("atexit() called - not implemented!\n");
return 0;
};
extern "C" __attribute__((weak)) int memcmp(void) {
Fiasco::outstring("memcmp() called - not implemented!\n");
return 0;
};
extern "C" __attribute__((weak)) int strncmp(void) {
Fiasco::outstring("strncmp() called - not implemented!\n");
return 0;
};
extern int main(int argc, char **argv);
extern void init_exception_handling(); /* implemented in base/cxx */
/* FIXME no support for commandline
* ask parent for argc and argv */
static char argv0[] = { '_', 'm', 'a', 'i', 'n'};
static char *argv[1] = { argv0 };
/*
* Define 'environ' pointer that is supposed to be exported by
* the startup code and relied on by any libC. Because we have no
* UNIX environment, however, we set this pointer to NULL.
*/
__attribute__((weak)) char **environ = (char **)0;
/**
* C entry function called by the crt0 startup code
*/
extern "C" int _main()
{
/* call constructors for static objects */
void (**func)();
for (func = &_ctors_end; func != &_ctors_start; (*--func)());
/* initialize exception handling */
init_exception_handling();
/* completely map program image by touching all pages read-only */
volatile const char *beg, *end;
beg = (const char *)(((unsigned)&_prog_img_beg) & L4_PAGEMASK);
end = (const char *)&_prog_img_end;
for ( ; beg < end; beg += L4_PAGESIZE) (void)(*beg);
/* call real main function */
/* XXX no support for commandline */
int ret = main(1, argv);
/* inform parent about program exit */
env()->parent()->exit(ret);
PDBG("main() returned %d", ret);
sleep_forever();
return ret;
}

View File

@@ -1,37 +0,0 @@
/**
* \brief Startup code for Genode applications on ARM
* \author Norman Feske
* \date 2007-04-28
*/
/*
* Copyright (C) 2007-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.
*/
/*--- .text (program code) -------------------------*/
.text
.globl _start
_start:
ldr sp, .initial_sp
b _main
.initial_sp: .word _stack_high
.globl __dso_handle
__dso_handle:
.long 0
/*--- .bss (non-initialized data) ------------------*/
.section ".bss"
.globl _stack_low
_stack_low:
.space 64*1024
.globl _stack_high
_stack_high:

View File

@@ -1,14 +0,0 @@
/*
* \brief Platform-specific helper functions for the _main() function
* \author Christian Prochaska
* \date 2009-08-05
*/
/*
* 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.
*/
namespace Genode { void platform_main_bootstrap() { /* dummy */ } }

View File

@@ -0,0 +1,38 @@
/*
* \brief Platform-specific context area definitions
* \author Stefan Kalkowski
* \date 2014-01-24
*/
/*
* Copyright (C) 2014 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_CONFIG_H_
#define _INCLUDE__BASE__NATIVE_CONFIG_H_
#include <base/stdint.h>
namespace Genode {
struct Native_config
{
/**
* Thread-context area configuration
*/
static constexpr addr_t context_area_virtual_base() {
return 0x20000000UL; }
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; }
};
}
#endif /* _INCLUDE__BASE__NATIVE_CONFIG_H_ */

View File

@@ -17,6 +17,7 @@
#include <base/cap_map.h>
#include <base/native_types.h>
#include <util/assert.h>
#include <util/construct_at.h>
namespace Genode {
@@ -124,6 +125,11 @@ namespace Genode {
bool static_idx(Cap_index *idx) {
return ((T*)idx) < &_indices[START_IDX]; }
void reinit()
{
construct_at<Cap_index_allocator_tpl<T, SZ> >(this);
}
};
}

View File

@@ -146,6 +146,11 @@ namespace Genode
* \param idx pointer to the Cap_index object in question
*/
virtual bool static_idx(Cap_index *idx) = 0;
/**
* Redo construction of the object
*/
virtual void reinit() = 0;
};
@@ -196,7 +201,9 @@ namespace Genode
* to save entries in the capability space, and prevent leaks of
* them.
*/
class Capability_map : Noncopyable
class Capability_map
:
private Noncopyable
{
private:

View File

@@ -1,8 +1,8 @@
#ifndef _INCLUDE__BASE__NATIVE_TYPES_H_
#define _INCLUDE__BASE__NATIVE_TYPES_H_
#include <base/native_config.h>
#include <base/cap_map.h>
#include <base/stdint.h>
namespace Fiasco {
#include <l4/sys/consts.h>
@@ -178,20 +178,6 @@ namespace Genode {
typedef int Native_connection_state;
struct Native_config
{
/**
* Thread-context area configuration
*/
static addr_t context_area_virtual_base();
static addr_t context_area_virtual_size() { return 0x10000000UL; }
/**
* Size of virtual address region holding the context of one thread
*/
static addr_t context_virtual_size() { return 0x00100000UL; }
};
struct Native_pd_args { };
}

View File

@@ -0,0 +1,38 @@
/*
* \brief Platform-specific context area definitions
* \author Stefan Kalkowski
* \date 2014-01-24
*/
/*
* Copyright (C) 2014 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_CONFIG_H_
#define _INCLUDE__BASE__NATIVE_CONFIG_H_
#include <base/stdint.h>
namespace Genode {
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; }
};
}
#endif /* _INCLUDE__BASE__NATIVE_CONFIG_H_ */

View File

@@ -1,3 +0,0 @@
include $(REP_DIR)/lib/mk/base.inc
SRC_CC += thread/thread_context_area.cc

View File

@@ -6,7 +6,6 @@
LIBS += cxx syscall startup
SRC_CC += main_bootstrap.cc
SRC_CC += ipc/ipc.cc ipc/pager.cc
SRC_CC += pager/pager.cc pager/common.cc
SRC_CC += avl_tree/avl_tree.cc
@@ -22,13 +21,13 @@ SRC_CC += env/spin_lock.cc env/cap_map.cc
SRC_CC += signal/signal.cc signal/common.cc
SRC_CC += server/server.cc server/common.cc
SRC_CC += thread/thread.cc thread/thread_bootstrap.cc thread/trace.cc
SRC_CC += thread/context_allocator.cc
INC_DIR += $(REP_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/thread
vpath main_bootstrap.cc $(REP_DIR)/src/platform
vpath %.cc $(REP_DIR)/src/base
vpath %.cc $(BASE_DIR)/src/base
vpath %.cc $(REP_DIR)/src/base
vpath %.cc $(BASE_DIR)/src/base
# vi: set ft=make :

View File

@@ -7,7 +7,7 @@
LIBS += base-common
SRC_CC += console/log_console.cc
SRC_CC += env/env.cc env/context_area.cc env/reload_parent_cap.cc \
SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc \
env/cap_map_remove.cc env/cap_alloc.cc
SRC_CC += thread/thread_start.cc

View File

@@ -1,3 +0,0 @@
include $(REP_DIR)/lib/mk/base.inc
SRC_CC += thread/arndale/thread_context_area.cc

View File

@@ -1,3 +0,0 @@
include $(REP_DIR)/lib/mk/base.inc
SRC_CC += thread/thread_context_area.cc

View File

@@ -1,4 +1,4 @@
SPECS += foc_arm platform_arndale uboot
SPECS += foc_arm platform_arndale
include $(call select_from_repositories,mk/spec-fpu_vfpv3.mk)
include $(call select_from_repositories,mk/spec-platform_arndale.mk)

View File

@@ -211,6 +211,7 @@ proc build_boot_image_x86 {binaries} {
proc build_boot_image_arm {binaries} {
global run_target
global fiasco_serial_esc_arg
copy_and_strip_binaries $binaries
@@ -254,7 +255,7 @@ proc build_boot_image_arm {binaries} {
if {[info exists ::env(PXE_TFTP_DIR_BASE)] &&
[info exists ::env(PXE_TFTP_DIR_OFFSET)]} {
exec ln -sf "[pwd]/[run_dir]/image.elf" "$::env(PXE_TFTP_DIR_BASE)$::env(PXE_TFTP_DIR_OFFSET)"
if {[have_spec uboot]} {
if {[regexp "uboot" $run_target]} {
exec ln -sf "[pwd]/[run_dir]/uImage" "$::env(PXE_TFTP_DIR_BASE)$::env(PXE_TFTP_DIR_OFFSET)/uImage"
}
}

View File

@@ -1,19 +0,0 @@
/*
* \brief Arndale specific definition of the context area location
* \author Sebastian Sumpf
* \date 2013-02-12
*
* We need to place the context area within core outside the physical memory.
* Sigma0 maps physical to core-local memory always 1:1 when using
* SIGMA0_REQ_FPAGE_ANY. Those mappings would interfere with the context area.
*
* Because the UTCB area of a task resides at the end of the context area and
* its address gets calculated by core, the context area in other tasks needs
* to be at the same address as in core.
*/
#include <base/native_types.h>
using namespace Genode;
addr_t Native_config::context_area_virtual_base() { return 0x20000000UL; }

View File

@@ -17,10 +17,6 @@
#include <util/string.h>
#include <util/misc_math.h>
namespace Fiasco {
#include <l4/sys/utcb.h>
}
using namespace Genode;
@@ -35,77 +31,8 @@ namespace Genode {
}
/******************************
** Thread-context allocator **
******************************/
Thread_base::Context *Thread_base::Context_allocator::base_to_context(addr_t base)
{
addr_t result = base + Native_config::context_virtual_size() - sizeof(Context);
return reinterpret_cast<Context *>(result);
}
addr_t Thread_base::Context_allocator::addr_to_base(void *addr)
{
return ((addr_t)addr) & ~(Native_config::context_virtual_size() - 1);
}
bool Thread_base::Context_allocator::_is_in_use(addr_t base)
{
List_element<Thread_base> *le = _threads.first();
for (; le; le = le->next())
if (base_to_context(base) == le->object()->_context)
return true;
return false;
}
Thread_base::Context *Thread_base::Context_allocator::alloc(Thread_base *thread_base)
{
Lock::Guard _lock_guard(_threads_lock);
/*
* Find slot in context area for the new context
*/
addr_t base = Native_config::context_area_virtual_base();
for (; _is_in_use(base); base += Native_config::context_virtual_size()) {
/* check upper bound of context area */
if (base >= Native_config::context_area_virtual_base() + Native_config::context_area_virtual_size())
return 0;
}
_threads.insert(&thread_base->_list_element);
return base_to_context(base);
}
void Thread_base::Context_allocator::free(Thread_base *thread_base)
{
Lock::Guard _lock_guard(_threads_lock);
_threads.remove(&thread_base->_list_element);
thread_base->_context->~Context();
}
/*****************
** Thread base **
*****************/
Thread_base::Context_allocator *Thread_base::_context_allocator()
{
static Context_allocator context_allocator_inst;
return &context_allocator_inst;
}
Thread_base::Context *Thread_base::_alloc_context(size_t stack_size)
Thread_base::Context *
Thread_base::_alloc_context(size_t stack_size, bool main_thread)
{
/*
* Synchronize context list when creating new threads from multiple threads
@@ -116,7 +43,7 @@ Thread_base::Context *Thread_base::_alloc_context(size_t stack_size)
Lock::Guard _lock_guard(alloc_lock);
/* allocate thread context */
Context *context = _context_allocator()->alloc(this);
Context *context = _context_allocator()->alloc(this, main_thread);
if (!context)
throw Context_alloc_failed();
@@ -124,7 +51,8 @@ Thread_base::Context *Thread_base::_alloc_context(size_t stack_size)
enum { PAGE_SIZE_LOG2 = 12 };
size_t ds_size = align_addr(stack_size, PAGE_SIZE_LOG2);
if (stack_size >= Native_config::context_virtual_size() - sizeof(Native_utcb) - (1 << PAGE_SIZE_LOG2))
if (stack_size >= Native_config::context_virtual_size() -
sizeof(Native_utcb) - (1UL << PAGE_SIZE_LOG2))
throw Stack_too_large();
/*
@@ -132,8 +60,9 @@ Thread_base::Context *Thread_base::_alloc_context(size_t stack_size)
*
* The stack is always located at the top of the context.
*/
addr_t ds_addr = Context_allocator::addr_to_base(context) + Native_config::context_virtual_size()
- ds_size;
addr_t ds_addr = Context_allocator::addr_to_base(context) +
Native_config::context_virtual_size() -
ds_size;
/* add padding for UTCB if defined for the platform */
if (sizeof(Native_utcb) >= (1 << PAGE_SIZE_LOG2))
@@ -144,41 +73,53 @@ Thread_base::Context *Thread_base::_alloc_context(size_t stack_size)
try {
ds_cap = env_context_area_ram_session()->alloc(ds_size);
addr_t attach_addr = ds_addr - Native_config::context_area_virtual_base();
env_context_area_rm_session()->attach_at(ds_cap, attach_addr, ds_size);
} catch (Ram_session::Alloc_failed) {
throw Stack_alloc_failed();
if (attach_addr != (addr_t)env_context_area_rm_session()->attach_at(ds_cap, attach_addr, ds_size))
throw Stack_alloc_failed();
}
catch (Ram_session::Alloc_failed) { throw Stack_alloc_failed(); }
/*
* Now the thread context is backed by memory, so it is safe to access its
* members.
*
* We need to initalize the context object's memory with zeroes,
* We need to initialize the context object's memory with zeroes,
* otherwise the ds_cap isn't invalid. That would cause trouble
* when the assignment operator of Native_capability is used.
*/
memset(context, 0, sizeof(Context));
memset(context, 0, sizeof(Context) - sizeof(Context::utcb));
context->thread_base = this;
context->stack_base = ds_addr;
context->ds_cap = ds_cap;
/*
* The value at the top of the stack might get interpreted as return
* address of the thread start function by GDB, so we set it to 0.
*/
*(addr_t*)context->stack_top() = 0;
return context;
}
void Thread_base::_free_context()
void Thread_base::_free_context(Context* context)
{
addr_t ds_addr = _context->stack_base - Native_config::context_area_virtual_base();
Ram_dataspace_capability ds_cap = _context->ds_cap;
_context_allocator()->free(this);
addr_t ds_addr = context->stack_base - Native_config::context_area_virtual_base();
Ram_dataspace_capability ds_cap = context->ds_cap;
/* call de-constructor explicitly before memory gets detached */
context->~Context();
Genode::env_context_area_rm_session()->detach((void *)ds_addr);
Genode::env_context_area_ram_session()->free(ds_cap);
/* context area ready for reuse */
_context_allocator()->free(context);
}
void Thread_base::name(char *dst, size_t dst_len)
{
snprintf(dst, min(dst_len, (size_t)Context::NAME_LEN), _context->name);
snprintf(dst, min(dst_len, (size_t)Context::NAME_LEN), "%s", _context->name);
}
@@ -196,19 +137,34 @@ void Thread_base::join()
}
Thread_base::Thread_base(const char *name, size_t stack_size)
void* Thread_base::alloc_secondary_stack(char const *name, size_t stack_size)
{
Context *context = _alloc_context(stack_size, false);
strncpy(context->name, name, sizeof(context->name));
return (void *)context->stack_top();
}
void Thread_base::free_secondary_stack(void* stack_addr)
{
addr_t base = Context_allocator::addr_to_base(stack_addr);
_free_context(Context_allocator::base_to_context(base));
}
Thread_base::Thread_base(const char *name, size_t stack_size, Type const type)
:
_list_element(this),
_context(_alloc_context(stack_size)),
_context(type == REINITIALIZED_MAIN ?
_context : _alloc_context(stack_size, type == MAIN)),
_join_lock(Lock::LOCKED)
{
strncpy(_context->name, name, sizeof(_context->name));
_init_platform_thread();
_init_platform_thread(type);
}
Thread_base::~Thread_base()
{
_deinit_platform_thread();
_free_context();
_free_context(_context);
}

View File

@@ -1,6 +1,7 @@
/*
* \brief Fiasco.OC specific thread bootstrap code
* \author Stefan Kalkowski
* \author Martin Stein
* \date 2011-01-20
*/
@@ -11,9 +12,38 @@
* under the terms of the GNU General Public License version 2.
*/
/* Genode includes */
#include <util/construct_at.h>
#include <base/thread.h>
/*****************************
** Startup library support **
*****************************/
void prepare_init_main_thread()
{
using namespace Genode;
enum { THREAD_CAP_ID = 1 };
Cap_index * ci(cap_map()->insert(THREAD_CAP_ID, Fiasco::MAIN_THREAD_CAP));
Fiasco::l4_utcb_tcr()->user[Fiasco::UTCB_TCR_BADGE] = (unsigned long)ci;
Fiasco::l4_utcb_tcr()->user[Fiasco::UTCB_TCR_THREAD_OBJ] = 0;
}
void prepare_reinit_main_thread()
{
using namespace Genode;
construct_at<Capability_map>(cap_map());
cap_idx_alloc()->reinit();
prepare_init_main_thread();
}
/*****************
** Thread_base **
*****************/
void Genode::Thread_base::_thread_bootstrap() { }

View File

@@ -1,11 +0,0 @@
/*
* \brief Generic definitions for the location of the thread-context area
* \author Sebastian Sumpf
* \date 2013-02-12
*/
#include <base/native_types.h>
using namespace Genode;
addr_t Native_config::context_area_virtual_base() { return 0x40000000UL; }

View File

@@ -2,6 +2,7 @@
* \brief Fiasco-specific implementation of the non-core startup Thread API
* \author Norman Feske
* \author Stefan Kalkowski
* \author Martin Stein
* \date 2010-01-19
*/
@@ -38,15 +39,26 @@ void Thread_base::_deinit_platform_thread()
}
void Genode::Thread_base::_init_platform_thread()
void Thread_base::_init_platform_thread(Type type)
{
/* create thread at core */
char buf[48];
name(buf, sizeof(buf));
_thread_cap = env()->cpu_session()->create_thread(buf);
if (type == NORMAL)
{
/* create thread at core */
char buf[48];
name(buf, sizeof(buf));
_thread_cap = env()->cpu_session()->create_thread(buf);
/* assign thread to protection domain */
env()->pd_session()->bind_thread(_thread_cap);
/* assign thread to protection domain */
env()->pd_session()->bind_thread(_thread_cap);
return;
}
/* adjust values whose computation differs for a main thread */
_tid = Fiasco::MAIN_THREAD_CAP;
_thread_cap = env()->parent()->main_thread_cap();
/* make thread object known to the Fiasco environment */
addr_t const t = (addr_t)this;
Fiasco::l4_utcb_tcr()->user[Fiasco::UTCB_TCR_THREAD_OBJ] = t;
}
@@ -70,9 +82,7 @@ void Thread_base::start()
l4_utcb_tcr_u(state.utcb)->user[UTCB_TCR_THREAD_OBJ] = (addr_t)this;
/* register initial IP and SP at core */
addr_t thread_sp = (addr_t)&_context->stack[-4];
thread_sp &= ~0xf; /* align initial stack to 16 byte boundary */
env()->cpu_session()->start(_thread_cap, (addr_t)_thread_start, thread_sp);
env()->cpu_session()->start(_thread_cap, (addr_t)_thread_start, _context->stack_top());
}

View File

@@ -1,6 +1,3 @@
# override default location of thread context area within core
vpath thread_context_area.cc $(REP_DIR)/src/base/thread/arndale
include $(PRG_DIR)/../target.inc
LD_TEXT_ADDR = 0x80100000

View File

@@ -33,7 +33,6 @@ SRC_CC = cap_session_component.cc \
signal_source_component.cc \
trace_session_component.cc \
thread_start.cc \
thread_context_area.cc \
core_printf.cc
INC_DIR += $(REP_DIR)/src/core/include \

View File

@@ -35,7 +35,7 @@ void Thread_base::_deinit_platform_thread()
}
void Genode::Thread_base::_init_platform_thread() { }
void Thread_base::_init_platform_thread(Type) { }
void Thread_base::start()
@@ -56,7 +56,7 @@ void Thread_base::start()
l4_utcb_tcr_u(pt->utcb())->user[UTCB_TCR_BADGE] = (unsigned long) pt->gate().local.idx();
l4_utcb_tcr_u(pt->utcb())->user[UTCB_TCR_THREAD_OBJ] = (addr_t)this;
pt->start((void *)_thread_start, _context->stack);
pt->start((void *)_thread_start, stack_top());
}

View File

@@ -1,41 +0,0 @@
/*
* \brief Platform-specific helper functions for the _main() function
* \author Christian Prochaska
* \author Christian Helmuth
* \date 2009-08-05
*/
/*
* 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.
*/
/* Genode includes */
#include <base/stdint.h>
#include <base/native_types.h>
#include <base/cap_map.h>
namespace Fiasco {
#include <l4/sys/utcb.h>
}
namespace Genode { void platform_main_bootstrap(); }
void Genode::platform_main_bootstrap()
{
static struct Bootstrap
{
enum { MAIN_THREAD_CAP_ID = 1 };
Bootstrap()
{
Cap_index *i(cap_map()->insert(MAIN_THREAD_CAP_ID, Fiasco::MAIN_THREAD_CAP));
Fiasco::l4_utcb_tcr()->user[Fiasco::UTCB_TCR_BADGE] = (unsigned long) i;
Fiasco::l4_utcb_tcr()->user[Fiasco::UTCB_TCR_THREAD_OBJ] = 0;
}
} bootstrap;
}

View File

@@ -37,13 +37,15 @@ namespace Genode {
/**
* Thread-context area configuration.
*/
static addr_t context_area_virtual_base() { return 0x40000000UL; }
static addr_t context_area_virtual_size() { return 0x10000000UL; }
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 addr_t context_virtual_size() { return 0x00100000UL; }
static constexpr addr_t context_virtual_size() { return 0x00100000UL; }
};
struct Native_pd_args { };

View File

@@ -18,6 +18,10 @@
#include <kernel/interface.h>
#include <base/native_capability.h>
#include <base/stdint.h>
#include <util/string.h>
/* base-hw includes */
#include <kernel/log.h>
namespace Genode
{
@@ -48,44 +52,22 @@ namespace Genode
inline Native_thread_id thread_invalid_id() { return 0; }
/**
* Message that is communicated synchronously
* Data bunch with variable size that is communicated between threads
*
* \param MAX_SIZE maximum size the object is allowed to take
*/
struct Msg
{
/**
* Types of synchronously communicated messages
*/
struct Type
{
enum Id {
INVALID = 0,
STARTUP = 1,
IPC = 2,
};
};
Type::Id type;
uint8_t data[];
};
template <size_t MAX_SIZE>
struct Message_tpl;
/**
* Message that is communicated between user threads
* Information that a thread creator hands out to a new thread
*/
struct Ipc_msg : Msg
{
size_t size;
uint8_t data[];
};
/**
* Message that is communicated from a thread creator to the new thread
*/
class Startup_msg;
class Start_info;
/**
* Memory region that is exclusive to every thread and known by the kernel
*/
struct Native_utcb;
class Native_utcb;
struct Cap_dst_policy
{
@@ -124,23 +106,136 @@ namespace Genode
/**
* Thread-context area configuration.
*/
static addr_t context_area_virtual_base() { return 0x40000000UL; }
static addr_t context_area_virtual_size() { return 0x10000000UL; }
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 addr_t context_virtual_size() { return 0x00100000UL; }
static constexpr addr_t context_virtual_size() { return 0x00100000UL; }
};
struct Native_pd_args { };
}
class Genode::Startup_msg : public Msg
template <Genode::size_t MAX_SIZE>
class Genode::Message_tpl
{
private:
Native_thread_id _thread_id;
size_t _data_size;
uint8_t _data[];
/**
* Return size of payload-preceding meta data
*/
size_t _header_size() const { return (addr_t)_data - (addr_t)this; }
/**
* Return maximum payload size
*/
size_t _max_data_size() const { return MAX_SIZE - _header_size(); }
/**
* Return size of header and current payload
*/
size_t _size() const { return _header_size() + _data_size; }
public:
/**
* Get information about current await-request operation
*
* \return buf_base base of receive buffer
* \return buf_size size of receive buffer
*/
void info_about_await_request(void * & buf_base, size_t & buf_size)
const
{
buf_base = (void *)this;
buf_size = MAX_SIZE;
}
/**
* Get information about current send-request operation
*
* \return msg_base base of complete send-message data
* \return msg_size size of complete send-message data
* \return buf_base base of receive buffer
* \return buf_size size of receive buffer
*/
void info_about_send_request(void * & msg_base, size_t & msg_size,
void * & buf_base, size_t & buf_size)
const
{
msg_base = (void *)this;
msg_size = _size();
buf_base = (void *)this;
buf_size = MAX_SIZE;
}
/**
* Get information about current send-reply operation
*
* \return msg_base base of complete send-message data
* \return msg_size size of complete send-message data
*/
void info_about_send_reply(void * & msg_base, size_t & msg_size)
const
{
msg_base = (void *)this;
msg_size = _size();
}
/**
* Install message that shall be send
*
* \param data base of payload
* \param data_size size of payload
* \param name local name that shall be the first payload word
*/
void prepare_send(void * const data, size_t data_size,
unsigned const name)
{
/* limit data size */
if (data_size > _max_data_size()) {
Kernel::log() << "oversized message outgoing\n";
data_size = _max_data_size();
}
/* copy data */
*(unsigned *)_data = name;
void * const data_dst = (void *)((addr_t)_data + sizeof(name));
void * const data_src = (void *)((addr_t)data + sizeof(name));
memcpy(data_dst, data_src, data_size - sizeof(name));
_data_size = data_size;
}
/**
* Read out message that was received
*
* \param buf_base base of read buffer
* \param buf_size size of read buffer
*/
void finish_receive(void * const buf_base, size_t const buf_size)
{
/* limit data size */
if (_data_size > buf_size) {
Kernel::log() << "oversized message incoming\n";
_data_size = buf_size;
}
/* copy data */
memcpy(buf_base, _data, _data_size);
}
};
class Genode::Start_info
{
private:
Native_thread_id _thread_id;
Native_capability _utcb_ds;
public:
@@ -149,63 +244,66 @@ class Genode::Startup_msg : public Msg
*
* \param thread_id kernel name of the thread that is started
*/
void init(Native_thread_id const thread_id)
void init(Native_thread_id const thread_id,
Native_capability const & utcb_ds)
{
_thread_id = thread_id;
type = Msg::Type::STARTUP;
_utcb_ds = utcb_ds;
}
/**
* Return kernel name of started thread message-type-save
*/
Native_thread_id thread_id() const
{
if (type == Msg::Type::STARTUP) { return _thread_id; }
return thread_invalid_id();
}
/***************
** Accessors **
***************/
Native_thread_id thread_id() const { return _thread_id; }
Native_capability utcb_ds() const { return _utcb_ds; }
};
struct Genode::Native_utcb
class Genode::Native_utcb
{
union {
uint8_t data[1 << MIN_MAPPING_SIZE_LOG2];
Msg msg;
Ipc_msg ipc_msg;
Startup_msg startup_msg;
private:
uint8_t _data[1 << MIN_MAPPING_SIZE_LOG2];
public:
typedef Message_tpl<sizeof(_data)/sizeof(_data[0])> Message;
/***************
** Accessors **
***************/
Message * message() const { return (Message *)_data; }
Start_info * start_info() const { return (Start_info *)_data; }
size_t size() const { return sizeof(_data)/sizeof(_data[0]); }
void * base() const { return (void *)_data; }
};
namespace Genode
{
enum {
VIRT_ADDR_SPACE_START = 0x1000,
VIRT_ADDR_SPACE_SIZE = 0xfffef000,
};
void call_wait_for_request(void * & buf_base, size_t & buf_size)
/**
* Return virtual UTCB location of main threads
*/
inline Native_utcb * main_thread_utcb()
{
msg.type = Msg::Type::INVALID;
buf_base = base();
buf_size = size();
enum {
VAS_TOP = VIRT_ADDR_SPACE_START + VIRT_ADDR_SPACE_SIZE,
UTCB = VAS_TOP - sizeof(Native_utcb),
UTCB_ALIGNED = UTCB & ~((1 << MIN_MAPPING_SIZE_LOG2) - 1),
};
return (Native_utcb *)UTCB_ALIGNED;
}
void call_request_and_wait(void * & msg_base, size_t & msg_size,
void * & buf_base, size_t & buf_size)
{
msg.type = Msg::Type::IPC;
msg_base = ipc_msg_base();
msg_size = ipc_msg_size();
buf_base = base();
buf_size = size();
}
void call_reply(void * & msg_base, size_t & msg_size)
{
msg.type = Msg::Type::IPC;
msg_base = ipc_msg_base();
msg_size = ipc_msg_size();
}
size_t size() { return sizeof(data) / sizeof(data[0]); }
void * base() { return &data; }
addr_t top() { return (addr_t)base() + size(); }
void * ipc_msg_base() { return &ipc_msg; }
size_t ipc_msg_size() { return ipc_msg_header_size() + ipc_msg.size; }
size_t ipc_msg_max_size() { return top() - (addr_t)&ipc_msg; }
size_t ipc_msg_header_size() { return (addr_t)ipc_msg.data - (addr_t)&ipc_msg; }
};
}
#endif /* _BASE__NATIVE_TYPES_H_ */

View File

@@ -20,6 +20,9 @@
#include <base/signal.h>
#include <pager/capability.h>
/* base-hw includes */
#include <placement_new.h>
namespace Genode
{
class Cap_session;
@@ -132,9 +135,38 @@ class Genode::Pager_object : public Object_pool<Pager_object>::Entry,
Signal_context_capability _signal_context_cap;
Thread_capability _thread_cap;
bool _signal_valid;
char _signal_buf[sizeof(Signal)];
unsigned const _badge;
/**
* Remember an incoming fault for handling
*
* \param s fault signal
*/
void _take_fault(Signal const & s)
{
new (_signal_buf) Signal(s);
_signal_valid = 1;
}
/**
* End handling of current fault
*/
void _end_fault()
{
_signal()->~Signal();
_signal_valid = 0;
}
/**
* End handling of current fault if there is one
*/
void _end_fault_if_pending()
{
if (_signal_valid) { _end_fault(); }
}
/***************
** Accessors **
@@ -151,27 +183,22 @@ class Genode::Pager_object : public Object_pool<Pager_object>::Entry,
*/
Pager_object(unsigned const badge, Affinity::Location);
/**
* Destructor
*/
virtual ~Pager_object() { }
/**
* The faulter has caused a fault and awaits paging
*
* \param s signal that communicated the fault
*/
void fault_occured(Signal const & s);
void fault_occured(Signal const & s) { _take_fault(s); }
/**
* Current fault has been resolved so resume faulter
*/
void fault_resolved();
void fault_resolved() { _end_fault(); }
/**
* User identification of pager object
*/
unsigned badge() const;
unsigned badge() const { return _badge; }
/**
* Resume faulter
@@ -183,6 +210,29 @@ class Genode::Pager_object : public Object_pool<Pager_object>::Entry,
*/
void exception_handler(Signal_context_capability);
/**
* Install information that is necessary to handle page faults
*
* \param c linkage between signal context and a signal receiver
* \param p linkage between pager object and a pager entry-point
*/
void start_paging(Signal_context_capability const & c,
Pager_capability const & p)
{
_signal_context_cap = c;
Object_pool<Pager_object>::Entry::cap(p);
}
/**
* Uninstall paging information and cancel unresolved faults
*/
void stop_paging()
{
Object_pool<Pager_object>::Entry::cap(Native_capability());
_signal_context_cap = Signal_context_capability();
_end_fault_if_pending();
}
/******************
** Pure virtual **
@@ -207,8 +257,6 @@ class Genode::Pager_object : public Object_pool<Pager_object>::Entry,
void thread_cap(Thread_capability const & c);
void cap(Native_capability const & c);
unsigned signal_context_id() const;
};

View File

@@ -1,6 +1,7 @@
/*
* \brief Serial output driver for console lib
* \author Martin Stein
* \author Stefan Kalkowski
* \date 2013-01-09
*/
@@ -11,19 +12,19 @@
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__ARNDALE_UART__DRIVERS__SERIAL_LOG_H_
#define _INCLUDE__ARNDALE_UART__DRIVERS__SERIAL_LOG_H_
#ifndef _INCLUDE__EXYNOS_UART__DRIVERS__SERIAL_LOG_H_
#define _INCLUDE__EXYNOS_UART__DRIVERS__SERIAL_LOG_H_
/* Genode includes */
#include <board.h>
#include <drivers/uart/arndale_uart_base.h>
#include <drivers/uart/exynos_uart_base.h>
namespace Genode
{
/**
* Serial output driver for console lib
*/
class Serial_log : public Arndale_uart_base
class Serial_log : public Exynos_uart_base
{
public:
@@ -33,11 +34,11 @@ namespace Genode
* \param baud_rate targeted transfer baud-rate
*/
Serial_log(unsigned const baud_rate) :
Arndale_uart_base(Board::UART_2_MMIO_BASE,
Board::UART_2_CLOCK, baud_rate)
Exynos_uart_base(Board::UART_2_MMIO_BASE,
Board::UART_2_CLOCK, baud_rate)
{ }
};
}
#endif /* _INCLUDE__ARNDALE_UART__DRIVERS__SERIAL_LOG_H_ */
#endif /* _INCLUDE__EXYNOS_UART__DRIVERS__SERIAL_LOG_H_ */

View File

@@ -39,7 +39,7 @@ namespace Kernel
{
enum {
NEW_THREAD = 0,
KILL_THREAD = 1,
BIN_THREAD = 1,
START_THREAD = 2,
PAUSE_THREAD = 3,
RESUME_THREAD = 4,
@@ -49,22 +49,23 @@ namespace Kernel
UPDATE_PD = 8,
UPDATE_REGION = 9,
NEW_PD = 10,
KILL_PD = 11,
REQUEST_AND_WAIT = 12,
REPLY = 13,
WAIT_FOR_REQUEST = 14,
BIN_PD = 11,
SEND_REQUEST_MSG = 12,
SEND_REPLY_MSG = 13,
AWAIT_REQUEST_MSG = 14,
NEW_SIGNAL_RECEIVER = 15,
NEW_SIGNAL_CONTEXT = 16,
KILL_SIGNAL_CONTEXT = 17,
KILL_SIGNAL_RECEIVER = 18,
SUBMIT_SIGNAL = 19,
AWAIT_SIGNAL = 20,
SIGNAL_PENDING = 21,
ACK_SIGNAL = 22,
NEW_VM = 23,
RUN_VM = 24,
PAUSE_VM = 25,
PRINT_CHAR = 26,
BIN_SIGNAL_CONTEXT = 18,
BIN_SIGNAL_RECEIVER = 19,
SUBMIT_SIGNAL = 20,
AWAIT_SIGNAL = 21,
SIGNAL_PENDING = 22,
ACK_SIGNAL = 23,
NEW_VM = 24,
RUN_VM = 25,
PAUSE_VM = 26,
PRINT_CHAR = 27,
};
};
@@ -151,9 +152,9 @@ namespace Kernel
* \retval 0 succeeded
* \retval -1 failed
*/
inline int kill_pd(unsigned const pd_id)
inline int bin_pd(unsigned const pd_id)
{
return call(Call_id::KILL_PD, pd_id);
return call(Call_id::BIN_PD, pd_id);
}
@@ -223,9 +224,9 @@ namespace Kernel
*
* Restricted to core threads.
*/
inline void kill_thread(unsigned const thread_id)
inline void bin_thread(unsigned const thread_id)
{
call(Call_id::KILL_THREAD, thread_id);
call(Call_id::BIN_THREAD, thread_id);
}
@@ -315,47 +316,59 @@ namespace Kernel
/**
* Send IPC request and await corresponding IPC reply
* Send request message and await receipt of corresponding reply message
*
* \param id kernel name of the server thread
* \param thread_id kernel name of targeted thread
*
* As soon as call returns, callers UTCB provides received message.
* \retval 0 succeeded
* \retval -1 failed
*
* If the call returns successful, the received message is located at the
* base of the callers userland thread-context.
*/
inline void request_and_wait(unsigned const id)
inline int send_request_msg(unsigned const thread_id)
{
call(Call_id::REQUEST_AND_WAIT, id);
return call(Call_id::SEND_REQUEST_MSG, thread_id);
}
/**
* Await the receipt of a message
* Await receipt of request message
*
* \return type of received message
* \retval 0 succeeded
* \retval -1 failed
*
* As soon as call returns, callers UTCB provides received message.
* If the call returns successful, the received message is located at the
* base of the callers userland thread-context.
*/
inline void wait_for_request()
inline int await_request_msg()
{
call(Call_id::WAIT_FOR_REQUEST);
return call(Call_id::AWAIT_REQUEST_MSG);
}
/**
* Reply to lastly received message
* Reply to lastly received request message
*
* \param await_message wether the call shall await receipt of a message
* \param await_request_msg wether the call shall await a request message
*
* If await_request = 1, callers UTCB provides received message
* as soon as call returns
* \retval 0 await_request_msg == 0 or request-message receipt succeeded
* \retval -1 await_request_msg == 1 and request-message receipt failed
*
* If the call returns successful and await_request_msg == 1, the received
* message is located at the base of the callers userland thread-context.
*/
inline void reply(bool const await_message)
inline int send_reply_msg(bool const await_request_msg)
{
call(Call_id::REPLY, await_message);
return call(Call_id::SEND_REPLY_MSG, await_request_msg);
}
/**
* Print a char 'c' to the kernels serial ouput
* Print a char c to the kernels serial ouput
*
* If c is set to 0 the kernel prints a table of all threads and their
* current activities to the serial output.
*/
inline void print_char(char const c)
{
@@ -510,6 +523,20 @@ namespace Kernel
}
/**
* Halt processing of a signal context synchronously
*
* \param context kernel name of the targeted signal context
*
* \retval 0 suceeded
* \retval -1 failed
*/
inline int kill_signal_context(unsigned const context)
{
return call(Call_id::KILL_SIGNAL_CONTEXT, context);
}
/**
* Destruct a signal context
*
@@ -520,9 +547,9 @@ namespace Kernel
*
* Restricted to core threads.
*/
inline int kill_signal_context(unsigned const context)
inline int bin_signal_context(unsigned const context)
{
return call(Call_id::KILL_SIGNAL_CONTEXT, context);
return call(Call_id::BIN_SIGNAL_CONTEXT, context);
}
@@ -536,9 +563,9 @@ namespace Kernel
*
* Restricted to core threads.
*/
inline int kill_signal_receiver(unsigned const receiver)
inline int bin_signal_receiver(unsigned const receiver)
{
return call(Call_id::KILL_SIGNAL_RECEIVER, receiver);
return call(Call_id::BIN_SIGNAL_RECEIVER, receiver);
}

View File

@@ -1,5 +1,5 @@
/*
* \brief Print to kernel log output
* \brief Print to the standard output of the kernel
* \author Martin stein
* \date 2012-04-05
*/
@@ -17,42 +17,45 @@
/* Genode includes */
#include <kernel/interface.h>
namespace Genode
namespace Kernel
{
/**
* Prints incoming streams to the kernel log output
* Prints incoming streams to the standard output of the kernel
*/
class Kernel_log
class Log
{
/**
* Print an unsigned 4 bit integer as hexadecimal value
*/
void _print_4bit_hex(unsigned char x) const
{
/* decode to ASCII char */
x &= 0x0f;
if (x > 9) x += 39;
x += 48;
private:
/* print ASCII char */
Kernel::print_char(x);
}
/**
* Print an unsigned 4 bit integer x as hexadecimal value
*/
void _print_4bit_hex(unsigned char x) const
{
/* decode to ASCII char */
x &= 0x0f;
if (x > 9) x += 39;
x += 48;
/* print ASCII char */
print_char(x);
}
public:
/**
* Print zero-terminated string
* Print a zero-terminated string s
*/
Kernel_log & operator << (char const * s)
Log & operator << (char const * s)
{
while (*s) Kernel::print_char(*s++);
while (*s) print_char(*s++);
if (*--s != '\n') { print_char(' '); }
return *this;
}
/**
* Print an unsigned integer as hexadecimal value
* Print an unsigned integer x as hexadecimal value
*/
Kernel_log & operator << (unsigned int const & x)
Log & operator << (unsigned int const x)
{
enum {
BYTE_WIDTH = 8,
@@ -91,17 +94,23 @@ namespace Genode
_print_4bit_hex(c >> 4);
_print_4bit_hex(c);
}
print_char(' ');
return *this;
}
/**
* Print a pointer p as hexadecimal value
*/
Log & operator << (void * const p) { return *this << (unsigned)p; }
};
/**
* Give static 'Kernel_log' reference as target for common log output
* Return singleton kernel-log
*/
inline Kernel_log & kernel_log()
inline Log & log()
{
static Kernel_log _log;
return _log;
static Log s;
return s;
}
}

View File

@@ -20,10 +20,16 @@
namespace Trustzone
{
enum {
VM_STATE_SIZE = 1 << 20,
/**
* Currently, we limit secure RAM to 256 MB only,
* because the memory protection feature of the M4IF
* on this platform allows to protect a max. region of
* 256MB per RAM bank only.
*/
SECURE_RAM_BASE = Genode::Board_base::RAM0_BASE,
SECURE_RAM_SIZE = Genode::Board_base::RAM0_SIZE - VM_STATE_SIZE,
SECURE_RAM_SIZE = 256 * 1024 * 1024,
VM_STATE_BASE = SECURE_RAM_BASE + SECURE_RAM_SIZE,
VM_STATE_SIZE = 1 << 20,
NONSECURE_RAM_BASE = Genode::Board_base::RAM1_BASE,
NONSECURE_RAM_SIZE = Genode::Board_base::RAM1_SIZE,
};

View File

@@ -0,0 +1,3 @@
include $(REP_DIR)/lib/mk/base-common.inc
vpath kernel/interface.cc $(REP_DIR)/src/arm

View File

@@ -1,2 +0,0 @@
SRC_CC = kernel/interface.cc
vpath % $(REP_DIR)/src/arm

View File

@@ -1,12 +1,12 @@
#
# \brief Portions of base library shared by core and non-core processes
# \author Norman Feske
# \author Martin Stein
# \date 2013-02-14
#
LIBS += cxx kernel_interface
LIBS += cxx
SRC_CC += main_bootstrap.cc
SRC_CC += ipc.cc ipc/ipc_marshal_cap.cc
SRC_CC += avl_tree/avl_tree.cc
SRC_CC += allocator/slab.cc
@@ -20,11 +20,12 @@ SRC_CC += lock/lock.cc
SRC_CC += signal/signal.cc signal/common.cc
SRC_CC += server/server.cc server/common.cc
SRC_CC += thread/thread_bootstrap.cc thread/trace.cc
SRC_CC += thread/context_allocator.cc
SRC_CC += kernel/interface.cc
INC_DIR += $(REP_DIR)/src/base/lock
INC_DIR += $(REP_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/thread
vpath main_bootstrap.cc $(REP_DIR)/src/platform
vpath %.cc $(REP_DIR)/src/base
vpath %.cc $(BASE_DIR)/src/base
vpath %.cc $(REP_DIR)/src/base
vpath %.cc $(BASE_DIR)/src/base

View File

@@ -7,7 +7,7 @@
LIBS += base-common startup
SRC_CC += console/log_console.cc
SRC_CC += env/env.cc env/context_area.cc env/reload_parent_cap.cc
SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc
SRC_CC += thread/thread.cc thread_support.cc
INC_DIR += $(BASE_DIR)/src/base/env

View File

@@ -1,5 +1,5 @@
#
# \brief Offer build configurations that are specific to base-hw and Pandaboard A2
# \brief Offer build configurations that are specific to base-hw and Arndale
# \author Martin Stein
# \date 2013-01-09
#
@@ -7,6 +7,9 @@
# denote wich specs are also fullfilled by this spec
SPECS += hw platform_arndale
# add repository relative paths
REP_INC_DIR += include/exynos5_uart
# set address where to link the text segment at
LD_TEXT_ADDR ?= 0x80000000

View File

@@ -0,0 +1,18 @@
#
# \brief Offer build configurations that are specific to base-hw and Odroid XU
# \author Stefan Kalkowski
# \date 2013-11-25
#
# denote wich specs are also fullfilled by this spec
SPECS += hw platform_odroid_xu
# add repository relative paths
REP_INC_DIR += include/exynos5_uart
# set address where to link the text segment at
LD_TEXT_ADDR ?= 0x80000000
# include implied specs
include $(call select_from_repositories,mk/spec-hw.mk)
include $(call select_from_repositories,mk/spec-platform_odroid_xu.mk)

View File

@@ -8,7 +8,7 @@
SPECS += hw platform_panda
# set address where to link the text segment at
LD_TEXT_ADDR ?= 0x80000000
LD_TEXT_ADDR ?= 0x81000000
# include implied specs
include $(call select_from_repositories,mk/spec-hw.mk)

View File

@@ -8,7 +8,7 @@
SPECS += hw platform_pbxa9
# set address where to link text segment at
LD_TEXT_ADDR ?= 0x01000000
LD_TEXT_ADDR ?= 0x70000000
# include implied specs
include $(call select_from_repositories,mk/spec-hw.mk)

View File

@@ -1,6 +1,6 @@
/*
* \brief Interface between kernel and userland
* \author Martin stein
* \author Martin Stein
* \date 2011-11-30
*/
@@ -17,91 +17,59 @@
using namespace Kernel;
/**********************************************************************
** Inline assembly templates for kernel calls with 1 to 6 arguments **
**********************************************************************/
#define CALL_6_ASM_OPS \
"mov r5, #0 \n" \
"add r5, %[arg_5] \n" \
CALL_5_ASM_OPS
#define CALL_5_ASM_OPS \
"mov r4, #0 \n" \
"add r4, %[arg_4] \n" \
CALL_4_ASM_OPS
#define CALL_4_ASM_OPS \
"mov r3, #0 \n" \
"add r3, %[arg_3] \n" \
CALL_3_ASM_OPS
#define CALL_3_ASM_OPS \
"mov r2, #0 \n" \
"add r2, %[arg_2] \n" \
CALL_2_ASM_OPS
#define CALL_2_ASM_OPS \
"mov r1, #0 \n" \
"add r1, %[arg_1] \n" \
CALL_1_ASM_OPS
#define CALL_1_ASM_OPS \
"mov r0, #0 \n" \
"add r0, %[arg_0] \n" \
"swi 0 \n" \
"mov %[result], #0 \n" \
"add %[result], r0 "
/****************************************************************************
** Inline assembly "writeable" tpl-args for kernel calls with 1 to 6 args **
****************************************************************************/
#define CALL_6_ASM_WRITE [arg_5] "+r" (arg_5), CALL_5_ASM_WRITE
#define CALL_5_ASM_WRITE [arg_4] "+r" (arg_4), CALL_4_ASM_WRITE
#define CALL_4_ASM_WRITE [arg_3] "+r" (arg_3), CALL_3_ASM_WRITE
#define CALL_3_ASM_WRITE [arg_2] "+r" (arg_2), CALL_2_ASM_WRITE
#define CALL_2_ASM_WRITE [arg_1] "+r" (arg_1), CALL_1_ASM_WRITE
#define CALL_1_ASM_WRITE \
[arg_0] "+r" (arg_0), \
[result] "+r" (result)
/**************************************************************************
** Inline assembly clobber lists for kernel calls with 1 to 6 arguments **
**************************************************************************/
#define CALL_6_ASM_CLOBBER "r5", CALL_5_ASM_CLOBBER
#define CALL_5_ASM_CLOBBER "r4", CALL_4_ASM_CLOBBER
#define CALL_4_ASM_CLOBBER "r3", CALL_3_ASM_CLOBBER
#define CALL_3_ASM_CLOBBER "r2", CALL_2_ASM_CLOBBER
#define CALL_2_ASM_CLOBBER "r1", CALL_1_ASM_CLOBBER
#define CALL_1_ASM_CLOBBER "r0"
/************************************
** Calls with 1 to 6 arguments **
** Helper macros for kernel calls **
************************************/
#define CALL_1_FILL_ARG_REGS \
register Call_arg arg_0_reg asm("r0") = arg_0;
#define CALL_2_FILL_ARG_REGS \
CALL_1_FILL_ARG_REGS \
register Call_arg arg_1_reg asm("r1") = arg_1;
#define CALL_3_FILL_ARG_REGS \
CALL_2_FILL_ARG_REGS \
register Call_arg arg_2_reg asm("r2") = arg_2;
#define CALL_4_FILL_ARG_REGS \
CALL_3_FILL_ARG_REGS \
register Call_arg arg_3_reg asm("r3") = arg_3;
#define CALL_5_FILL_ARG_REGS \
CALL_4_FILL_ARG_REGS \
register Call_arg arg_4_reg asm("r4") = arg_4;
#define CALL_6_FILL_ARG_REGS \
CALL_5_FILL_ARG_REGS \
register Call_arg arg_5_reg asm("r5") = arg_5;
#define CALL_1_SWI "swi 0\n" : "+r" (arg_0_reg)
#define CALL_2_SWI CALL_1_SWI: "r" (arg_1_reg)
#define CALL_3_SWI CALL_2_SWI, "r" (arg_2_reg)
#define CALL_4_SWI CALL_3_SWI, "r" (arg_3_reg)
#define CALL_5_SWI CALL_4_SWI, "r" (arg_4_reg)
#define CALL_6_SWI CALL_5_SWI, "r" (arg_5_reg)
/******************
** Kernel calls **
******************/
Call_ret Kernel::call(Call_arg arg_0)
{
Call_ret result = 0;
asm volatile(CALL_1_ASM_OPS
: CALL_1_ASM_WRITE
:: CALL_1_ASM_CLOBBER);
return result;
CALL_1_FILL_ARG_REGS
asm volatile(CALL_1_SWI);
return arg_0_reg;
}
Call_ret Kernel::call(Call_arg arg_0,
Call_arg arg_1)
{
Call_ret result = 0;
asm volatile(CALL_2_ASM_OPS
: CALL_2_ASM_WRITE
:: CALL_2_ASM_CLOBBER);
return result;
CALL_2_FILL_ARG_REGS
asm volatile(CALL_2_SWI);
return arg_0_reg;
}
@@ -109,11 +77,9 @@ Call_ret Kernel::call(Call_arg arg_0,
Call_arg arg_1,
Call_arg arg_2)
{
Call_ret result = 0;
asm volatile(CALL_3_ASM_OPS
: CALL_3_ASM_WRITE
:: CALL_3_ASM_CLOBBER);
return result;
CALL_3_FILL_ARG_REGS
asm volatile(CALL_3_SWI);
return arg_0_reg;
}
@@ -122,11 +88,9 @@ Call_ret Kernel::call(Call_arg arg_0,
Call_arg arg_2,
Call_arg arg_3)
{
Call_ret result = 0;
asm volatile(CALL_4_ASM_OPS
: CALL_4_ASM_WRITE
:: CALL_4_ASM_CLOBBER);
return result;
CALL_4_FILL_ARG_REGS
asm volatile(CALL_4_SWI);
return arg_0_reg;
}
@@ -136,11 +100,9 @@ Call_ret Kernel::call(Call_arg arg_0,
Call_arg arg_3,
Call_arg arg_4)
{
Call_ret result = 0;
asm volatile(CALL_5_ASM_OPS
: CALL_5_ASM_WRITE
:: CALL_5_ASM_CLOBBER);
return result;
CALL_5_FILL_ARG_REGS
asm volatile(CALL_5_SWI);
return arg_0_reg;
}
@@ -151,11 +113,9 @@ Call_ret Kernel::call(Call_arg arg_0,
Call_arg arg_4,
Call_arg arg_5)
{
Call_ret result = 0;
asm volatile(CALL_6_ASM_OPS
: CALL_6_ASM_WRITE
:: CALL_6_ASM_CLOBBER);
return result;
CALL_6_FILL_ARG_REGS
asm volatile(CALL_6_SWI);
return arg_0_reg;
}

View File

@@ -16,8 +16,8 @@
#include <base/printf.h>
#include <drivers/serial_log.h>
/* base-hw includes */
#include "singleton.h"
/* base includes */
#include <unmanaged_singleton.h>
namespace Genode
{
@@ -66,7 +66,7 @@ using namespace Genode;
*/
static Platform_console * platform_console()
{
return unsynchronized_singleton<Platform_console>();
return unmanaged_singleton<Platform_console>();
}

View File

@@ -35,46 +35,6 @@ enum
};
/***************
** Utilities **
***************/
/**
* Copy message from the callers UTCB to message buffer
*/
static void utcb_to_msgbuf(Msgbuf_base * const msgbuf)
{
Native_utcb * const utcb = Thread_base::myself()->utcb();
size_t msg_size = utcb->ipc_msg.size;
if (msg_size > msgbuf->size()) {
kernel_log() << "oversized IPC message\n";
msg_size = msgbuf->size();
}
memcpy(msgbuf->buf, utcb->ipc_msg.data, msg_size);
}
/**
* Copy message from message buffer to the callers UTCB
*/
static void msgbuf_to_utcb(Msgbuf_base * const msg_buf, size_t msg_size,
unsigned const local_name)
{
Native_utcb * const utcb = Thread_base::myself()->utcb();
enum { NAME_SIZE = sizeof(local_name) };
size_t const ipc_msg_size = msg_size + NAME_SIZE;
if (ipc_msg_size > utcb->ipc_msg_max_size()) {
kernel_log() << "oversized IPC message\n";
msg_size = utcb->ipc_msg_max_size() - NAME_SIZE;
}
*(unsigned *)utcb->ipc_msg.data = local_name;
void * const utcb_msg = (void *)((addr_t)utcb->ipc_msg.data + NAME_SIZE);
void * const buf_msg = (void *)((addr_t)msg_buf->buf + NAME_SIZE);
memcpy(utcb_msg, buf_msg, msg_size);
utcb->ipc_msg.size = ipc_msg_size;
}
/*****************
** Ipc_ostream **
*****************/
@@ -116,20 +76,15 @@ Ipc_istream::~Ipc_istream() { }
void Ipc_client::_call()
{
using namespace Kernel;
/* send request */
/* send request and receive corresponding reply */
unsigned const local_name = Ipc_ostream::_dst.local_name();
msgbuf_to_utcb(_snd_msg, _write_offset, local_name);
request_and_wait(Ipc_ostream::_dst.dst());
/* receive reply */
Native_utcb * const utcb = Thread_base::myself()->utcb();
if (utcb->msg.type != Msg::Type::IPC) {
utcb->message()->prepare_send(_snd_msg->buf, _write_offset, local_name);
if (Kernel::send_request_msg(Ipc_ostream::_dst.dst())) {
PERR("failed to receive reply");
throw Blocking_canceled();
}
utcb_to_msgbuf(_rcv_msg);
utcb->message()->finish_receive(_rcv_msg->buf, _rcv_msg->size());
/* reset unmarshaller */
_write_offset = _read_offset = RPC_OBJECT_ID_SIZE;
@@ -168,14 +123,13 @@ void Ipc_server::_prepare_next_reply_wait()
void Ipc_server::_wait()
{
/* receive next request */
Kernel::wait_for_request();
Native_utcb * const utcb = Thread_base::myself()->utcb();
if (utcb->msg.type != Msg::Type::IPC) {
/* receive request */
if (Kernel::await_request_msg()) {
PERR("failed to receive request");
throw Blocking_canceled();
}
utcb_to_msgbuf(_rcv_msg);
Native_utcb * const utcb = Thread_base::myself()->utcb();
utcb->message()->finish_receive(_rcv_msg->buf, _rcv_msg->size());
/* update server state */
_prepare_next_reply_wait();
@@ -184,9 +138,10 @@ void Ipc_server::_wait()
void Ipc_server::_reply()
{
unsigned const local_name = Ipc_ostream::_dst.local_name();
Native_utcb * const utcb = Thread_base::myself()->utcb();
utcb->ipc_msg.size = _write_offset;
Kernel::reply(0);
utcb->message()->prepare_send(_snd_msg->buf, _write_offset, local_name);
Kernel::send_reply_msg(false);
}
@@ -197,20 +152,16 @@ void Ipc_server::_reply_wait()
_wait();
return;
}
/* send reply an await request */
/* send reply and receive next request */
unsigned const local_name = Ipc_ostream::_dst.local_name();
msgbuf_to_utcb(_snd_msg, _write_offset, local_name);
Kernel::reply(1);
/* fetch request */
Native_utcb * const utcb = Thread_base::myself()->utcb();
if (utcb->msg.type != Msg::Type::IPC) {
utcb->message()->prepare_send(_snd_msg->buf, _write_offset, local_name);
if (Kernel::send_reply_msg(true)) {
PERR("failed to receive request");
throw Blocking_canceled();
}
utcb_to_msgbuf(_rcv_msg);
utcb->message()->finish_receive(_rcv_msg->buf, _rcv_msg->size());
/* update server state */
_prepare_next_reply_wait();
}

View File

@@ -15,9 +15,6 @@
#include <base/pager.h>
#include <base/printf.h>
/* base-hw includes */
#include <placement_new.h>
using namespace Genode;
@@ -70,25 +67,10 @@ void Pager_object::wake_up() { fault_resolved(); }
void Pager_object::exception_handler(Signal_context_capability) { }
void Pager_object::fault_resolved() { _signal()->~Signal(); }
unsigned Pager_object::badge() const { return _badge; }
void Pager_object::fault_occured(Signal const & s)
{
new (_signal()) Signal(s);
}
void Pager_object::cap(Native_capability const & c)
{
Object_pool<Pager_object>::Entry::cap(c);
}
Pager_object::Pager_object(unsigned const badge, Affinity::Location)
:
_signal_valid(0),
_badge(badge)
{ }
@@ -124,7 +106,12 @@ Native_capability Pager_activation_base::cap()
** Pager_entrypoint **
**********************/
void Pager_entrypoint::dissolve(Pager_object * const o) { remove_locked(o); }
void Pager_entrypoint::dissolve(Pager_object * const o)
{
remove_locked(o);
o->stop_paging();
_activation->Signal_receiver::dissolve(o);
}
Pager_entrypoint::Pager_entrypoint(Cap_session *,
@@ -138,11 +125,10 @@ Pager_entrypoint::Pager_entrypoint(Cap_session *,
Pager_capability Pager_entrypoint::manage(Pager_object * const o)
{
if (!_activation) return Pager_capability();
o->_signal_context_cap = _activation->Signal_receiver::manage(o);
unsigned const dst = _activation->cap().dst();
Native_capability c = Native_capability(dst, o->badge());
o->cap(c);
unsigned const d = _activation->cap().dst();
unsigned const b = o->badge();
auto const p = reinterpret_cap_cast<Pager_object>(Native_capability(d, b));
o->start_paging(_activation->Signal_receiver::manage(o), p);
insert(o);
return reinterpret_cap_cast<Pager_object>(c);
return p;
}

View File

@@ -14,9 +14,9 @@
#ifndef _PLACEMENT_NEW_H_
#define _PLACEMENT_NEW_H_
/**
* Placement new operator
*/
inline void *operator new(Genode::size_t, void *at) { return at; }
/* base includes */
#include <unmanaged_singleton.h>
/* FIXME: remove this header as soon as the Placeable template is public */
#endif /* _PLACEMENT_NEW_H_ */

View File

@@ -123,6 +123,9 @@ void Signal_receiver::_platform_destructor()
void Signal_receiver::_unsynchronized_dissolve(Signal_context * const c)
{
/* wait untill all context references disappear and put context to sleep */
Kernel::kill_signal_context(c->_cap.dst());
/* release server resources of context */
signal_connection()->free_context(c->_cap);

View File

@@ -1,56 +0,0 @@
/*
* \brief Helper for creating singleton objects
* \author Norman Feske
* \date 2013-05-14
*
* Before enabling the MMU on ARM, the 'cmpxchg' implementation is not always
* guaranteed to work. For example, on the Raspberry Pi, the 'ldrex' as used by
* 'cmpxchg' causes the machine to reboot. After enabling the MMU, everything
* is fine. Hence, we need to avoid executing 'cmpxchg' prior this point.
* Unfortunately, 'cmpxchg' is implicitly called each time when creating a
* singleton object via a local-static object pattern. In this case, the
* compiler generates code that calls the '__cxa_guard_acquire' function of the
* C++ runtime, which, in turn, relies 'cmpxchg' for synchronization.
*
* The utility provided herein is an alternative way to create single object
* instances without implicitly calling 'cmpxchg'. Because object creation is
* not synchronized via a spin lock, it must not be used in scenarios where
* multiple threads may contend.
*/
/*
* Copyright (C) 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 _SINGLETON_H_
#define _SINGLETON_H_
/* Genode includes */
#include <base/stdint.h>
/* base-hw includes */
#include <placement_new.h>
template <typename T, int ALIGN = 2, typename... Args>
static inline T *unsynchronized_singleton(Args... args)
{
/*
* Each instantiation of the function template with a different type 'T'
* yields a dedicated instance of the local static variables, thereby
* creating the living space for the singleton objects.
*/
static bool initialized;
static int inst[sizeof(T)/sizeof(int) + 1] __attribute__((aligned(ALIGN)));
/* execute constructor on first call */
if (!initialized) {
initialized = true;
new (&inst) T(args...);
}
return reinterpret_cast<T *>(inst);
}
#endif /* _SINGLETON_H_ */

View File

@@ -1,6 +1,6 @@
/*
* \brief Thread bootstrap code
* \author Christian Prochaska
* \brief Thread initialization
* \author Martin stein
* \date 2013-02-15
*/
@@ -13,13 +13,83 @@
/* Genode includes */
#include <base/thread.h>
#include <base/env.h>
/* base-hw includes */
#include <kernel/interface.h>
using namespace Genode;
void Genode::Thread_base::_thread_bootstrap()
Ram_dataspace_capability _main_thread_utcb_ds;
Native_thread_id _main_thread_id;
namespace Genode { Rm_session * env_context_area_rm_session(); }
/**************************
** Native types support **
**************************/
Native_thread_id Genode::thread_get_my_native_id()
{
Thread_base * const t = Thread_base::myself();
return t ? t->tid().thread_id : _main_thread_id;
}
/*****************************
** Startup library support **
*****************************/
void prepare_init_main_thread()
{
using namespace Genode;
/*
* Make data from the startup info persistantly available by copying it
* before the UTCB gets polluted by the following function calls.
*/
Native_utcb * const utcb = Thread_base::myself()->utcb();
_main_thread_id = utcb->start_info()->thread_id();
_main_thread_utcb_ds =
reinterpret_cap_cast<Ram_dataspace>(utcb->start_info()->utcb_ds());
}
void prepare_reinit_main_thread() { prepare_init_main_thread(); }
/*****************
** Thread_base **
*****************/
void Thread_base::_thread_bootstrap()
{
Native_utcb * const utcb = Thread_base::myself()->utcb();
_tid.thread_id = utcb->startup_msg.thread_id();
_tid.thread_id = utcb->start_info()->thread_id();
}
void Thread_base::_init_platform_thread(Type type)
{
/* nothing platform specific to do if this is not a special thread */
if (type == NORMAL) { return; }
/* if we got reinitialized we have to get rid of the old UTCB */
size_t const utcb_size = sizeof(Native_utcb);
addr_t const context_area = Native_config::context_area_virtual_base();
addr_t const utcb_new = (addr_t)&_context->utcb - context_area;
Rm_session * const rm = env_context_area_rm_session();
if (type == REINITIALIZED_MAIN) { rm->detach(utcb_new); }
/* remap initial main-thread UTCB according to context-area spec */
try { rm->attach_at(_main_thread_utcb_ds, utcb_new, utcb_size); }
catch(...) {
PERR("failed to re-map UTCB");
while (1) ;
}
/* adjust initial object state in case of a main thread */
tid().thread_id = _main_thread_id;
_thread_cap = env()->parent()->main_thread_cap();
}

View File

@@ -19,8 +19,6 @@
using namespace Genode;
extern Native_utcb * __initial_sp;
namespace Genode { Rm_session * env_context_area_rm_session(); }
@@ -28,13 +26,10 @@ namespace Genode { Rm_session * env_context_area_rm_session(); }
** Thread_base **
*****************/
void Thread_base::_init_platform_thread() { }
Native_utcb * Thread_base::utcb()
{
if (this) { return &_context->utcb; }
return __initial_sp;
return main_thread_utcb();
}
@@ -92,9 +87,7 @@ void Thread_base::start()
sleep_forever();
}
/* start thread with its initial IP and aligned SP */
addr_t thread_sp = (addr_t)&_context->stack[-4];
thread_sp &= ~0xf;
env()->cpu_session()->start(_thread_cap, (addr_t)_thread_start, thread_sp);
env()->cpu_session()->start(_thread_cap, (addr_t)_thread_start, _context->stack_top());
}

View File

@@ -60,11 +60,6 @@
/* catch erroneous kernel return */
3: b 3b
/* handle for dynamic symbol objects */
.align 3
.global __dso_handle
__dso_handle: .long 0
.section .bss
/* kernel stack */

View File

@@ -10,6 +10,7 @@ REQUIRES += platform_arndale
# add include paths
INC_DIR += $(REP_DIR)/src/core/arndale
INC_DIR += $(REP_DIR)/src/core/exynos5
INC_DIR += $(REP_DIR)/src/core/arm
# add C++ sources

View File

@@ -240,55 +240,49 @@ void Arm::Cpu::flush_data_caches()
* with more beauty.
*/
asm volatile (
"mrc p15, 1, r0, c0, c0, 1\n" /* read CLIDR into R0 */
"mrc p15, 1, r0, c0, c0, 1\n" /* read CLIDR into R0 */
"ands r3, r0, #0x7000000\n"
"mov r3, r3, lsr #23\n" /* cache level value (naturally aligned) */
"mov r3, r3, lsr #23\n" /* cache level value (naturally aligned) */
"beq 5f\n"
"mov r10, #0\n"
"mov r9, #0\n"
"1:\n"
"add r2, r10, r10, lsr #1\n" /* work out 3 x cachelevel */
"mov r1, r0, lsr r2\n" /* bottom 3 bits are the Cache type for this level */
"and r1, r1, #7\n" /* get those 3 bits alone */
"add r2, r9, r9, lsr #1\n" /* work out 3 x cachelevel */
"mov r1, r0, lsr r2\n" /* bottom 3 bits are the Cache type for this level */
"and r1, r1, #7\n" /* get those 3 bits alone */
"cmp r1, #2\n"
"blt 4f\n" /* no cache or only instruction cache at this level */
"mcr p15, 2, r10, c0, c0, 0\n" /* write CSSELR from R10 */
"isb\n" /* ISB to sync the change to the CCSIDR */
"mrc p15, 1, r1, c0, c0, 0\n" /* read current CCSIDR to R1 */
"and r2, r1, #0x7\n" /* extract the line length field */
"add r2, r2, #4\n" /* add 4 for the line length offset (log2 16 bytes) */
"blt 4f\n" /* no cache or only instruction cache at this level */
"mcr p15, 2, r9, c0, c0, 0\n" /* write CSSELR from R9 */
"isb\n" /* ISB to sync the change to the CCSIDR */
"mrc p15, 1, r1, c0, c0, 0\n" /* read current CCSIDR to R1 */
"and r2, r1, #0x7\n" /* extract the line length field */
"add r2, r2, #4\n" /* add 4 for the line length offset (log2 16 bytes) */
"ldr r4, =0x3ff\n"
"ands r4, r4, r1, lsr #3\n" /* R4 is the max number on the way size (right aligned) */
"clz r5, r4\n" /* R5 is the bit position of the way size increment */
"mov r9, r4\n" /* R9 working copy of the max way size (right aligned) */
"ands r4, r4, r1, lsr #3\n" /* R4 is the max number on the way size (right aligned) */
"clz r5, r4\n" /* R5 is the bit position of the way size increment */
"mov r8, r4\n" /* R8 working copy of the max way size (right aligned) */
"2:\n"
"ldr r7, =0x00007fff\n"
"ands r7, r7, r1, lsr #13\n" /* R7 is the max number of the index size (right aligned) */
"ands r7, r7, r1, lsr #13\n" /* R7 is the max number of the index size (right aligned) */
"3:\n"
"orr r11, r10, r9, lsl r5\n" /* factor in the way number and cache number into R11 */
"orr r11, r11, r7, lsl r2\n" /* factor in the index number */
"mcr p15, 0, r11, c7, c10, 2\n" /* DCCSW, clean by set/way */
"subs r7, r7, #1\n" /* decrement the index */
"orr r6, r9, r8, lsl r5\n" /* factor in the way number and cache number into R11 */
"orr r6, r6, r7, lsl r2\n" /* factor in the index number */
"mcr p15, 0, r6, c7, c10, 2\n" /* DCCSW, clean by set/way */
"subs r7, r7, #1\n" /* decrement the index */
"bge 3b\n"
"subs r9, r9, #1\n" /* decrement the way number */
"subs r8, r8, #1\n" /* decrement the way number */
"bge 2b\n"
"4:\n"
"add r10, r10, #2\n" /* increment the cache number */
"cmp r3, r10\n"
"add r9, r9, #2\n" /* increment the cache number */
"cmp r3, r9\n"
"bgt 1b\n"
"dsb\n"
"5:\n"
::: "r0", "r1", "r2", "r3", "r4",
"r5", "r7", "r9", "r10", "r11");
::: "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9");
}

View File

@@ -11,8 +11,8 @@
* under the terms of the GNU General Public License version 2.
*/
#ifndef _ARNDALE__CPU_H_
#define _ARNDALE__CPU_H_
#ifndef _EXYNOS5__CPU_H_
#define _EXYNOS5__CPU_H_
/* core includes */
#include <cpu/cortex_a15.h>
@@ -25,5 +25,5 @@ namespace Genode
class Cpu : public Cortex_a15::Cpu { };
}
#endif /* _ARNDALE__CPU_H_ */
#endif /* _EXYNOS5__CPU_H_ */

View File

@@ -11,8 +11,8 @@
* under the terms of the GNU General Public License version 2.
*/
#ifndef _ARNDALE__PIC_H_
#define _ARNDALE__PIC_H_
#ifndef _EXYNOS5__PIC_H_
#define _EXYNOS5__PIC_H_
/* core includes */
#include <pic/corelink_gic400.h>
@@ -38,5 +38,5 @@ namespace Kernel
bool Arm_gic::Pic::_use_security_ext() { return 0; }
#endif /* _ARNDALE__PIC_H_ */
#endif /* _EXYNOS5__PIC_H_ */

View File

@@ -11,8 +11,8 @@
* under the terms of the GNU General Public License version 2.
*/
#ifndef _ARNDALE__TIMER_H_
#define _ARNDALE__TIMER_H_
#ifndef _EXYNOS5__TIMER_H_
#define _EXYNOS5__TIMER_H_
/* core includes */
#include <board.h>
@@ -37,5 +37,4 @@ namespace Kernel
};
}
#endif /* _ARNDALE__TIMER_H_ */
#endif /* _EXYNOS5__TIMER_H_ */

View File

@@ -11,8 +11,8 @@
* under the terms of the GNU General Public License version 2.
*/
#ifndef _ARNDALE__TLB_H_
#define _ARNDALE__TLB_H_
#ifndef _EXYNOS5__TLB_H_
#define _EXYNOS5__TLB_H_
/* core includes */
#include <board.h>
@@ -43,5 +43,5 @@ namespace Genode
};
}
#endif /* _ARNDALE__TLB_H_ */
#endif /* _EXYNOS5__TLB_H_ */

View File

@@ -41,8 +41,8 @@ namespace Genode
{
enum {
SECURE_UNLOCKED,
SECURE_LOCKED,
UNSECURE_UNLOCKED,
SECURE_LOCKED,
UNSECURE_LOCKED
};
@@ -123,10 +123,10 @@ namespace Genode
write<Csl19::Slave_a>(Csl00::UNSECURE);
/* GPIO */
//write<Csl00::Slave_b>(Csl00::UNSECURE);
//write<Csl01::Slave_a>(Csl00::UNSECURE);
//write<Csl01::Slave_b>(Csl00::UNSECURE);
//write<Csl02::Slave_a>(Csl00::UNSECURE);
write<Csl00::Slave_b>(Csl00::SECURE);
write<Csl01::Slave_a>(Csl00::SECURE);
write<Csl01::Slave_b>(Csl00::SECURE);
write<Csl02::Slave_a>(Csl00::SECURE);
/* IOMUXC TODO */
write<Csl05::Slave_a>(Csl00::UNSECURE);
@@ -138,15 +138,15 @@ namespace Genode
write<Csl00::Slave_a>(Csl00::UNSECURE);
/* TVE */
//write<Csl22::Slave_b>(Csl00::UNSECURE);
write<Csl22::Slave_b>(Csl00::SECURE);
/* I2C */
//write<Csl18::Slave_a>(Csl00::UNSECURE);
//write<Csl17::Slave_b>(Csl00::UNSECURE);
//write<Csl31::Slave_a>(Csl00::UNSECURE);
write<Csl18::Slave_a>(Csl00::SECURE);
write<Csl17::Slave_b>(Csl00::SECURE);
write<Csl31::Slave_a>(Csl00::SECURE);
/* IPU */
//write<Csl24::Slave_a>(Csl00::UNSECURE);
write<Csl24::Slave_a>(Csl00::SECURE);
/* Audio */
write<Csl18::Slave_b>(Csl00::UNSECURE);
@@ -167,10 +167,10 @@ namespace Genode
write<Csl29::Slave_a>(Csl00::UNSECURE);
/* GPU 2D */
write<Csl24::Slave_b>(Csl00::UNSECURE);
write<Csl24::Slave_b>(Csl00::SECURE);
/* GPU 3D */
write<Csl27::Slave_b>(Csl00::UNSECURE);
write<Csl27::Slave_b>(Csl00::SECURE);
write<Csl02::Slave_b>(Csl00::UNSECURE);
write<Csl03::Slave_a>(Csl00::UNSECURE);
@@ -196,7 +196,7 @@ namespace Genode
write<Csl20::Slave_b>(Csl00::UNSECURE);
write<Csl21::Slave_a>(Csl00::UNSECURE);
write<Csl21::Slave_b>(Csl00::UNSECURE);
//write<Csl23::Slave_a>(Csl00::UNSECURE); //VPU
write<Csl23::Slave_a>(Csl00::SECURE); //VPU
write<Csl23::Slave_b>(Csl00::UNSECURE);
write<Csl26::Slave_b>(Csl00::UNSECURE);
write<Csl27::Slave_a>(Csl00::UNSECURE);
@@ -204,16 +204,19 @@ namespace Genode
write<Csl30::Slave_a>(Csl00::UNSECURE);
write<Csl31::Slave_b>(Csl00::UNSECURE);
/* DMA from graphical subsystem is considered to be secure */
write<Master::Gpu>(Master::SECURE_UNLOCKED);
/* all other DMA operations are insecure */
write<Master::Sdma>(Master::UNSECURE_UNLOCKED);
write<Master::Esdhc3>(Master::UNSECURE_UNLOCKED);
write<Master::Gpu>(Master::UNSECURE_UNLOCKED);
write<Master::Usb>(Master::UNSECURE_UNLOCKED);
write<Master::Pata>(Master::UNSECURE_UNLOCKED);
write<Master::Esdhc4>(Master::UNSECURE_UNLOCKED);
write<Master::Fec>(Master::UNSECURE_UNLOCKED);
write<Master::Dap>(Master::UNSECURE_UNLOCKED);
write<Master::Esdhc1>(Master::UNSECURE_UNLOCKED);
write<Master::Esdhc2>(Master::UNSECURE_UNLOCKED);
write<Master::Esdhc3>(Master::UNSECURE_UNLOCKED);
write<Master::Esdhc4>(Master::UNSECURE_UNLOCKED);
}
};

View File

@@ -50,18 +50,19 @@ namespace Genode
_alloc->free(addr, size); }
size_t consumed() {
PDBG("Unexprected call");
PDBG("Unexpected call");
while (1) ;
return 0;
}
size_t overhead(size_t size) {
PDBG("Unexprected call");
PDBG("Unexpected call");
while (1) ;
return 0;
}
bool need_size_for_free() const { return true; }
bool need_size_for_free() const override {
return _alloc->need_size_for_free(); }
};
}

View File

@@ -41,8 +41,8 @@ namespace Genode {
Phys_allocator _irq_alloc; /* IRQ allocator */
Rom_fs _rom_fs; /* ROM file system */
addr_t _vm_base; /* base of virtual address space */
size_t _vm_size; /* size of virtual address space */
addr_t _vm_start; /* base of virtual address space */
size_t _vm_size; /* size of virtual address space */
/**
* Get one of the consecutively numbered available resource regions
@@ -101,7 +101,7 @@ namespace Genode {
inline Range_allocator * irq_alloc() { return &_irq_alloc; }
inline addr_t vm_start() const { return _vm_base; }
inline addr_t vm_start() const { return _vm_start; }
inline size_t vm_size() const { return _vm_size; }
@@ -116,7 +116,7 @@ namespace Genode {
inline Range_allocator * region_alloc()
{
kernel_log() << __PRETTY_FUNCTION__ << ": Not implemented\n";
Kernel::log() << __PRETTY_FUNCTION__ << "not implemented\n";
while (1) ;
return 0;
}

View File

@@ -11,8 +11,8 @@
* under the terms of the GNU General Public License version 2.
*/
#ifndef _CORE__INCLUDE__UTIL_H_
#define _CORE__INCLUDE__UTIL_H_
#ifndef _UTIL_H_
#define _UTIL_H_
/* Genode includes */
#include <rm_session/rm_session.h>
@@ -20,7 +20,10 @@
namespace Genode
{
enum { MIN_PAGE_SIZE_LOG2 = 12 };
enum {
ACTIVITY_TABLE_ON_FAULTS = 0,
MIN_PAGE_SIZE_LOG2 = 12,
};
/**
* Identification that core threads use to get access to their metadata
@@ -99,20 +102,41 @@ namespace Genode
return 20;
}
/**
* Debug output on page faults
* Print debug output on page faults
*
* \param fault_msg introductory message
* \param fault_addr target address of the fault access
* \param fault_ip instruction pointer of the faulter
* \param fault_type access type of fault
* \param faulter_badge user identification of faulter
*/
inline void print_page_fault(const char *msg, addr_t pf_addr, addr_t pf_ip,
Rm_session::Fault_type pf_type,
unsigned faulter_badge)
{
printf("%s (%s pf_addr=%p pf_ip=%p from %02x)", msg,
pf_type == Rm_session::WRITE_FAULT ? "WRITE" : "READ",
(void *)pf_addr, (void *)pf_ip,
faulter_badge);
inline void print_page_fault(char const * const fault_msg,
addr_t const fault_addr,
addr_t const fault_ip,
Rm_session::Fault_type const fault_type,
unsigned const faulter_badge);
}
void Genode::print_page_fault(char const * const fault_msg,
addr_t const fault_addr,
addr_t const fault_ip,
Rm_session::Fault_type const fault_type,
unsigned const faulter_badge)
{
const char read[] = "read from";
const char write[] = "write to";
printf("\033[31m%s\033[0m (faulter %x", fault_msg, faulter_badge);
printf(" with IP %p attempts to", (void *)fault_ip);
printf(" %s", fault_type == Rm_session::READ_FAULT ? read : write);
printf(" address %p)\n", (void *)fault_addr);
if (ACTIVITY_TABLE_ON_FAULTS) {
printf("---------- activity table ----------\n");
Kernel::print_char(0);
printf("\n");
}
}
#endif /* _CORE__INCLUDE__UTIL_H_ */
#endif /* _UTIL_H_ */

View File

@@ -30,11 +30,7 @@ namespace Kernel
class Kernel::Ipc_node
{
private:
class Message_buf;
typedef Genode::Fifo<Message_buf> Message_fifo;
protected:
enum State
{
@@ -45,6 +41,12 @@ class Kernel::Ipc_node
PREPARE_AND_AWAIT_REPLY = 5,
};
private:
class Message_buf;
typedef Genode::Fifo<Message_buf> Message_fifo;
/**
* Describes the buffer for incoming or outgoing messages
*/
@@ -201,6 +203,16 @@ class Kernel::Ipc_node
*/
virtual void _await_ipc_failed() = 0;
protected:
/***************
** Accessors **
***************/
Ipc_node * outbuf_dst() { return _outbuf_dst; }
State state() { return _state; }
public:
/**

View File

@@ -31,14 +31,17 @@
#include <timer.h>
#include <pic.h>
/* base includes */
#include <unmanaged_singleton.h>
/* base-hw includes */
#include <singleton.h>
#include <kernel/perf_counter.h>
using namespace Kernel;
/* get core configuration */
extern Genode::Native_utcb * _main_thread_utcb;
extern Genode::Native_thread_id _main_thread_id;
extern int _kernel_stack_high;
extern "C" void CORE_MAIN();
@@ -47,7 +50,7 @@ namespace Kernel
/**
* Return interrupt-controller singleton
*/
Pic * pic() { return unsynchronized_singleton<Pic>(); }
Pic * pic() { return unmanaged_singleton<Pic>(); }
/* import Genode types */
typedef Genode::umword_t umword_t;
@@ -64,15 +67,15 @@ namespace Kernel
*/
static void idle_main() { while (1) ; }
Pd_ids * pd_ids() { return unsynchronized_singleton<Pd_ids>(); }
Thread_ids * thread_ids() { return unsynchronized_singleton<Thread_ids>(); }
Signal_context_ids * signal_context_ids() { return unsynchronized_singleton<Signal_context_ids>(); }
Signal_receiver_ids * signal_receiver_ids() { return unsynchronized_singleton<Signal_receiver_ids>(); }
Pd_ids * pd_ids() { return unmanaged_singleton<Pd_ids>(); }
Thread_ids * thread_ids() { return unmanaged_singleton<Thread_ids>(); }
Signal_context_ids * signal_context_ids() { return unmanaged_singleton<Signal_context_ids>(); }
Signal_receiver_ids * signal_receiver_ids() { return unmanaged_singleton<Signal_receiver_ids>(); }
Pd_pool * pd_pool() { return unsynchronized_singleton<Pd_pool>(); }
Thread_pool * thread_pool() { return unsynchronized_singleton<Thread_pool>(); }
Signal_context_pool * signal_context_pool() { return unsynchronized_singleton<Signal_context_pool>(); }
Signal_receiver_pool * signal_receiver_pool() { return unsynchronized_singleton<Signal_receiver_pool>(); }
Pd_pool * pd_pool() { return unmanaged_singleton<Pd_pool>(); }
Thread_pool * thread_pool() { return unmanaged_singleton<Thread_pool>(); }
Signal_context_pool * signal_context_pool() { return unmanaged_singleton<Signal_context_pool>(); }
Signal_receiver_pool * signal_receiver_pool() { return unmanaged_singleton<Signal_receiver_pool>(); }
/**
* Access to static kernel timer
@@ -91,11 +94,25 @@ namespace Kernel
*/
static Pd * core()
{
constexpr int tlb_align = 1 << Core_tlb::ALIGNM_LOG2;
/**
* Core protection-domain
*/
class Core_pd : public Pd
{
public:
Core_tlb *core_tlb = unsynchronized_singleton<Core_tlb, tlb_align>();
Pd *pd = unsynchronized_singleton<Pd>(core_tlb, nullptr);
return pd;
/**
* Constructor
*/
Core_pd(Tlb * const tlb, Platform_pd * const platform_pd)
:
Pd(tlb, platform_pd)
{ }
};
constexpr int tlb_align = 1 << Core_tlb::ALIGNM_LOG2;
Core_tlb * core_tlb = unmanaged_singleton<Core_tlb, tlb_align>();
Core_pd * core_pd = unmanaged_singleton<Core_pd>(core_tlb, nullptr);
return core_pd;
}
/**
@@ -233,8 +250,9 @@ extern "C" void kernel()
/* start thread with stack pointer at the top of stack */
static Native_utcb utcb;
static Thread t(Priority::MAX, "core");
_main_thread_id = t.id();
_main_thread_utcb = &utcb;
_main_thread_utcb->startup_msg.init(t.id());
_main_thread_utcb->start_info()->init(t.id(), Genode::Native_capability());
t.ip = (addr_t)CORE_MAIN;;
t.sp = (addr_t)s + STACK_SIZE;
t.init(0, core_id(), &utcb, 1);
@@ -262,8 +280,8 @@ Kernel::Mode_transition_control * Kernel::mtc()
sp = (addr_t)&_kernel_stack_high;
core()->admit(this);
}
} * const k = unsynchronized_singleton<Kernel_context>();
} * const k = unmanaged_singleton<Kernel_context>();
/* initialize mode transition page */
return unsynchronized_singleton<Mode_transition_control>(k);
return unmanaged_singleton<Mode_transition_control>(k);
}

View File

@@ -21,9 +21,6 @@
/* core includes */
#include <assert.h>
/* base-hw includes */
#include <singleton.h>
namespace Kernel
{
template <typename T> class Avl_tree : public Genode::Avl_tree<T> { };

View File

@@ -289,6 +289,13 @@ class Kernel::Scheduler
* Exclude 'i' from scheduling
*/
void remove(T * const i) { _items[i->priority()].remove(i); }
/***************
** Accessors **
***************/
T * idle() const { return _idle; }
};
class Kernel::Execution_context : public Cpu_scheduler::Item

View File

@@ -47,16 +47,6 @@ void Signal_context_killer::_cancel_waiting()
}
/****************************
** Signal_receiver_killer **
****************************/
void Signal_receiver_killer::_cancel_waiting()
{
if (_receiver) { _receiver->_killer_cancelled(); }
}
/********************
** Signal_context **
********************/
@@ -67,7 +57,11 @@ void Signal_context::_deliverable()
}
Signal_context::~Signal_context() { _receiver->_context_killed(this); }
Signal_context::~Signal_context()
{
if (_killer) { _killer->_signal_context_kill_failed(); }
_receiver->_context_destructed(this);
}
Signal_context::Signal_context(Signal_receiver * const r, unsigned const imprint)
@@ -78,9 +72,9 @@ Signal_context::Signal_context(Signal_receiver * const r, unsigned const imprint
_imprint(imprint),
_submits(0),
_ack(1),
_kill(0),
_killed(0),
_killer(0),
_ack_handler(&_default_ack_handler)
{
if (r->_add_context(this)) { throw Assign_to_receiver_failed(); }
r->_add_context(this);
}

View File

@@ -39,11 +39,6 @@ namespace Kernel
*/
class Signal_context_killer;
/**
* Ability to destruct signal receivers
*/
class Signal_receiver_killer;
/**
* Signal types that are assigned to a signal receiver each
*/
@@ -69,7 +64,9 @@ class Kernel::Signal_ack_handler
{
friend class Signal_context;
Signal_context * _signal_context;
private:
Signal_context * _signal_context;
protected:
@@ -120,6 +117,14 @@ class Kernel::Signal_handler
*/
virtual void _receive_signal(void * const base, size_t const size) = 0;
protected:
/***************
** Accessors **
***************/
Signal_receiver * receiver() const { return _receiver; }
public:
/**
@@ -151,20 +156,33 @@ class Kernel::Signal_context_killer
Signal_context * _context;
/**
* Backend for for destructor and cancel_waiting
* Backend for destructor and cancel_waiting
*/
void _cancel_waiting();
/**
* Notice that the destruction is pending
* Notice that the kill operation is pending
*/
virtual void _signal_context_kill_pending() = 0;
/**
* Notice that pending destruction is done
* Notice that pending kill operation is done
*/
virtual void _signal_context_kill_done() = 0;
/**
* Notice that pending kill operation failed
*/
virtual void _signal_context_kill_failed() = 0;
protected:
/***************
** Accessors **
***************/
Signal_context * context() const { return _context; }
public:
/**
@@ -183,47 +201,6 @@ class Kernel::Signal_context_killer
void cancel_waiting() { _cancel_waiting(); }
};
class Kernel::Signal_receiver_killer
{
friend class Signal_receiver;
private:
Signal_receiver * _receiver;
/**
* Backend for for destructor and cancel_waiting
*/
void _cancel_waiting();
/**
* Notice that the destruction is pending
*/
virtual void _signal_receiver_kill_pending() = 0;
/**
* Notice that pending destruction is done
*/
virtual void _signal_receiver_kill_done() = 0;
public:
/**
* Constructor
*/
Signal_receiver_killer() : _receiver(0) { }
/**
* Destructor
*/
virtual ~Signal_receiver_killer() { _cancel_waiting(); }
/**
* Stop waiting for a signal receiver
*/
void cancel_waiting() { _cancel_waiting(); }
};
class Kernel::Signal_context
:
public Object<Signal_context, MAX_SIGNAL_CONTEXTS,
@@ -256,7 +233,7 @@ class Kernel::Signal_context
unsigned const _imprint;
unsigned _submits;
bool _ack;
bool _kill;
bool _killed;
Signal_context_killer * _killer;
Default_ack_handler _default_ack_handler;
Signal_ack_handler * _ack_handler;
@@ -276,24 +253,17 @@ class Kernel::Signal_context
}
/**
* Notice that the killer of the context has been destructed
* Notice that the killer of the context has cancelled waiting
*/
void _killer_cancelled() { _killer = 0; }
protected:
public:
/**
* Destructor
*/
~Signal_context();
public:
/**
* Exception types
*/
struct Assign_to_receiver_failed { };
/**
* Constructor
*
@@ -325,7 +295,7 @@ class Kernel::Signal_context
*/
int submit(unsigned const n)
{
if (_kill || _submits >= (unsigned)~0 - n) { return -1; }
if (_killed || _submits >= (unsigned)~0 - n) { return -1; }
_submits += n;
if (_ack) { _deliverable(); }
return 0;
@@ -338,15 +308,15 @@ class Kernel::Signal_context
{
_ack_handler->_signal_acknowledged();
if (_ack) { return; }
if (!_kill) {
if (!_killed) {
_ack = 1;
_deliverable();
return;
}
this->~Signal_context();
if (_killer) {
_killer->_context = 0;
_killer->_signal_context_kill_done();
_killer = 0;
}
}
@@ -360,16 +330,19 @@ class Kernel::Signal_context
*/
int kill(Signal_context_killer * const k)
{
if (_kill) { return -1; }
/* destruct directly if there is no unacknowledged delivery */
/* check if in a kill operation or already killed */
if (_killed) {
if (_ack) { return 0; }
return -1;
}
/* kill directly if there is no unacknowledged delivery */
if (_ack) {
this->~Signal_context();
_killed = 1;
return 0;
}
/* wait for delivery acknowledgement */
_killer = k;
_kill = 1;
_killer = k;
_killed = 1;
_killer->_context = this;
_killer->_signal_context_kill_pending();
return 0;
@@ -380,12 +353,10 @@ class Kernel::Signal_receiver
:
public Object<Signal_receiver, MAX_SIGNAL_RECEIVERS,
Signal_receiver_ids, signal_receiver_ids,
signal_receiver_pool>,
public Signal_context_killer
signal_receiver_pool>
{
friend class Signal_context;
friend class Signal_handler;
friend class Signal_receiver_killer;
private:
@@ -396,9 +367,6 @@ class Kernel::Signal_receiver
Fifo<Signal_handler::Fifo_element> _handlers;
Fifo<Signal_context::Fifo_element> _deliver;
Fifo<Signal_context::Fifo_element> _contexts;
bool _kill;
Signal_receiver_killer * _killer;
unsigned _context_kills;
/**
* Recognize that context 'c' has submits to deliver
@@ -438,22 +406,17 @@ class Kernel::Signal_receiver
}
/**
* Notice that a context of the receiver has been killed
* Notice that a context of the receiver has been destructed
*
* \param c killed context
* \param c destructed context
*/
void _context_killed(Signal_context * const c)
void _context_destructed(Signal_context * const c)
{
_contexts.remove(&c->_contexts_fe);
if (!c->_deliver_fe.is_enqueued()) { return; }
_deliver.remove(&c->_deliver_fe);
}
/**
* Notice that the killer of the receiver has cancelled waiting
*/
void _killer_cancelled() { _killer = 0; }
/**
* Notice that handler 'h' has cancelled waiting
*/
@@ -464,47 +427,24 @@ class Kernel::Signal_receiver
/**
* Assign context 'c' to the receiver
*
* \retval 0 succeeded
* \retval -1 failed
*/
int _add_context(Signal_context * const c)
void _add_context(Signal_context * const c)
{
if (_kill) { return -1; }
_contexts.enqueue(&c->_contexts_fe);
return 0;
}
/***************************
** Signal_context_killer **
***************************/
void _signal_context_kill_pending() { _context_kills++; }
void _signal_context_kill_done()
{
_context_kills--;
if (!_context_kills && _kill) {
this->~Signal_receiver();
if (_killer) {
_killer->_receiver = 0;
_killer->_signal_receiver_kill_done();
}
}
}
public:
/**
* Constructor
* Destructor
*/
Signal_receiver()
:
_kill(0),
_killer(0),
_context_kills(0)
{ }
~Signal_receiver()
{
/* destruct all attached contexts */
while (Signal_context * c = _contexts.dequeue()->object()) {
c->~Signal_context();
}
}
/**
* Let a handler 'h' wait for signals of the receiver
@@ -514,7 +454,7 @@ class Kernel::Signal_receiver
*/
int add_handler(Signal_handler * const h)
{
if (_kill || h->_receiver) { return -1; }
if (h->_receiver) { return -1; }
_handlers.enqueue(&h->_handlers_fe);
h->_receiver = this;
h->_await_signal(this);
@@ -526,37 +466,6 @@ class Kernel::Signal_receiver
* Return wether any of the contexts of this receiver is deliverable
*/
bool deliverable() { return !_deliver.empty(); }
/**
* Destruct receiver or prepare to do it as soon as delivery is done
*
* \param killer object that shall receive progress reports
*
* \retval 0 succeeded
* \retval -1 failed
*/
int kill(Signal_receiver_killer * const k)
{
if (_kill) { return -1; }
/* start killing at all contexts of the receiver */
Signal_context * c = _contexts.dequeue()->object();
while (c) {
c->kill(this);
c = _contexts.dequeue()->object();
}
/* destruct directly if no context kill is pending */
if (!_context_kills) {
this->~Signal_receiver();
return 0;
}
/* wait for pending context kills */
_kill = 1;
_killer = k;
_killer->_receiver = this;
_killer->_signal_receiver_kill_pending();
return 0;
}
};
#endif /* _KERNEL__SIGNAL_RECEIVER_ */

View File

@@ -48,18 +48,10 @@ void Thread::_signal_context_kill_done()
}
void Thread::_signal_receiver_kill_pending()
void Thread::_signal_context_kill_failed()
{
assert(_state == SCHEDULED);
_state = AWAITS_SIGNAL_RECEIVER_KILL;
cpu_scheduler()->remove(this);
}
void Thread::_signal_receiver_kill_done()
{
assert(_state == AWAITS_SIGNAL_RECEIVER_KILL);
user_arg_0(0);
assert(_state == AWAITS_SIGNAL_CONTEXT_KILL);
user_arg_0(-1);
_schedule();
}
@@ -84,6 +76,7 @@ void Thread::_received_ipc_request(size_t const s)
{
switch (_state) {
case SCHEDULED:
user_arg_0(0);
return;
default:
PERR("wrong thread state to receive IPC");
@@ -112,6 +105,7 @@ void Thread::_await_ipc_succeeded(size_t const s)
{
switch (_state) {
case AWAITS_IPC:
user_arg_0(0);
_schedule();
return;
default:
@@ -126,12 +120,9 @@ void Thread::_await_ipc_failed()
{
switch (_state) {
case AWAITS_IPC:
user_arg_0(-1);
_schedule();
return;
case SCHEDULED:
PERR("failed to receive IPC");
_stop();
return;
default:
PERR("wrong thread state to cancel IPC");
_stop();
@@ -157,9 +148,6 @@ int Thread::_resume()
case AWAITS_SIGNAL_CONTEXT_KILL:
Signal_context_killer::cancel_waiting();
return 0;
case AWAITS_SIGNAL_RECEIVER_KILL:
Signal_receiver_killer::cancel_waiting();
return 0;
case AWAITS_START:
case STOPPED:;
}
@@ -294,7 +282,7 @@ void Thread::_call_new_pd()
}
void Thread::_call_kill_pd()
void Thread::_call_bin_pd()
{
/* check permissions */
if (!_core()) {
@@ -338,7 +326,7 @@ void Thread::_call_new_thread()
}
void Thread::_call_kill_thread()
void Thread::_call_bin_thread()
{
/* check permissions */
assert(_core());
@@ -449,16 +437,16 @@ void Thread::_call_yield_thread()
}
void Thread::_call_wait_for_request()
void Thread::_call_await_request_msg()
{
void * buf_base;
size_t buf_size;
_utcb_phys->call_wait_for_request(buf_base, buf_size);
_utcb_phys->message()->info_about_await_request(buf_base, buf_size);
Ipc_node::await_request(buf_base, buf_size);
}
void Thread::_call_request_and_wait()
void Thread::_call_send_request_msg()
{
Thread * const dst = Thread::pool()->object(user_arg_1());
if (!dst) {
@@ -470,21 +458,22 @@ void Thread::_call_request_and_wait()
size_t msg_size;
void * buf_base;
size_t buf_size;
_utcb_phys->call_request_and_wait(msg_base, msg_size,
buf_base, buf_size);
_utcb_phys->message()->info_about_send_request(msg_base, msg_size,
buf_base, buf_size);
Ipc_node::send_request_await_reply(dst, msg_base, msg_size,
buf_base, buf_size);
}
void Thread::_call_reply()
void Thread::_call_send_reply_msg()
{
void * msg_base;
size_t msg_size;
_utcb_phys->call_reply(msg_base, msg_size);
_utcb_phys->message()->info_about_send_reply(msg_base, msg_size);
Ipc_node::send_reply(msg_base, msg_size);
bool const await_request = user_arg_1();
if (await_request) { _call_wait_for_request(); }
bool const await_request_msg = user_arg_1();
if (await_request_msg) { _call_await_request_msg(); }
else { user_arg_0(0); }
}
@@ -608,8 +597,86 @@ void Thread::_call_update_region()
}
void Thread::_print_activity_table()
{
for (unsigned id = 0; id < MAX_THREADS; id++) {
Thread * const t = Thread::pool()->object(id);
if (!t) { continue; }
t->_print_activity(t == this);
}
return;
}
void Thread::_print_activity(bool const printing_thread)
{
static Thread * idle = dynamic_cast<Thread *>(cpu_scheduler()->idle());
Genode::printf("\033[33m[%u] %s", pd_id(), pd_label());
Genode::printf(" (%u) %s:\033[0m", id(), label());
if (id() == idle->id()) {
Genode::printf("\033[32m run\033[0m");
_print_common_activity();
return;
}
switch (_state) {
case AWAITS_START: {
Genode::printf("\033[32m init\033[0m");
break; }
case SCHEDULED: {
if (!printing_thread) { Genode::printf("\033[32m run\033[0m"); }
else { Genode::printf("\033[32m debug\033[0m"); }
break; }
case AWAITS_IPC: {
_print_activity_when_awaits_ipc();
break; }
case AWAITS_RESUME: {
Genode::printf("\033[32m await RES\033[0m");
break; }
case AWAITS_SIGNAL: {
unsigned const receiver_id = Signal_handler::receiver()->id();
Genode::printf("\033[32m await SIG %u\033[0m", receiver_id);
break; }
case AWAITS_SIGNAL_CONTEXT_KILL: {
unsigned const context_id = Signal_context_killer::context()->id();
Genode::printf("\033[32m await SCK %u\033[0m", context_id);
break; }
case STOPPED: {
Genode::printf("\033[32m stop\033[0m");
break; }
}
_print_common_activity();
}
void Thread::_print_common_activity()
{
Genode::printf(" ip %lx sp %lx\n", ip, sp);
}
void Thread::_print_activity_when_awaits_ipc()
{
switch (Ipc_node::state()) {
case AWAIT_REPLY: {
Thread * const server = dynamic_cast<Thread *>(Ipc_node::outbuf_dst());
Genode::printf("\033[32m await RPL %u\033[0m", server->id());
break; }
case AWAIT_REQUEST: {
Genode::printf("\033[32m await REQ\033[0m");
break; }
case PREPARE_AND_AWAIT_REPLY: {
Thread * const server = dynamic_cast<Thread *>(Ipc_node::outbuf_dst());
Genode::printf("\033[32m prep RPL await RPL %u\033[0m", server->id());
break; }
default: break;
}
}
void Thread::_call_print_char()
{
char const c = user_arg_1();
if (!c) { _print_activity_table(); }
Genode::printf("%c", (char)user_arg_1());
}
@@ -648,13 +715,8 @@ void Thread::_call_new_signal_context()
/* create and assign context*/
void * const p = (void *)user_arg_1();
unsigned const imprint = user_arg_3();
try {
Signal_context * const c = new (p) Signal_context(r, imprint);
user_arg_0(c->id());
} catch (Signal_context::Assign_to_receiver_failed) {
PERR("failed to assign context to receiver");
user_arg_0(0);
}
Signal_context * const c = new (p) Signal_context(r, imprint);
user_arg_0(c->id());
}
@@ -735,6 +797,25 @@ void Thread::_call_ack_signal()
void Thread::_call_kill_signal_context()
{
/* lookup signal context */
unsigned const id = user_arg_1();
Signal_context * const c = Signal_context::pool()->object(id);
if (!c) {
PERR("unknown signal context");
user_arg_0(-1);
return;
}
/* kill signal context */
if (c->kill(this)) {
PERR("failed to kill signal context");
user_arg_0(-1);
return;
}
}
void Thread::_call_bin_signal_context()
{
/* check permissions */
if (!_core()) {
@@ -750,17 +831,13 @@ void Thread::_call_kill_signal_context()
user_arg_0(0);
return;
}
/* kill signal context */
if (c->kill(this)) {
PERR("failed to kill signal context");
user_arg_0(-1);
return;
}
/* destruct signal context */
c->~Signal_context();
user_arg_0(0);
}
void Thread::_call_kill_signal_receiver()
void Thread::_call_bin_signal_receiver()
{
/* check permissions */
if (!_core()) {
@@ -776,12 +853,7 @@ void Thread::_call_kill_signal_receiver()
user_arg_0(0);
return;
}
/* kill signal receiver */
if (r->kill(this)) {
PERR("unknown signal receiver");
user_arg_0(-1);
return;
}
r->~Signal_receiver();
user_arg_0(0);
}
@@ -863,14 +935,14 @@ void Thread::_call()
{
switch (user_arg_0()) {
case Call_id::NEW_THREAD: _call_new_thread(); return;
case Call_id::KILL_THREAD: _call_kill_thread(); return;
case Call_id::BIN_THREAD: _call_bin_thread(); return;
case Call_id::START_THREAD: _call_start_thread(); return;
case Call_id::PAUSE_THREAD: _call_pause_thread(); return;
case Call_id::RESUME_THREAD: _call_resume_thread(); return;
case Call_id::YIELD_THREAD: _call_yield_thread(); return;
case Call_id::REQUEST_AND_WAIT: _call_request_and_wait(); return;
case Call_id::REPLY: _call_reply(); return;
case Call_id::WAIT_FOR_REQUEST: _call_wait_for_request(); return;
case Call_id::SEND_REQUEST_MSG: _call_send_request_msg(); return;
case Call_id::SEND_REPLY_MSG: _call_send_reply_msg(); return;
case Call_id::AWAIT_REQUEST_MSG: _call_await_request_msg(); return;
case Call_id::UPDATE_PD: _call_update_pd(); return;
case Call_id::UPDATE_REGION: _call_update_region(); return;
case Call_id::NEW_PD: _call_new_pd(); return;
@@ -878,7 +950,8 @@ void Thread::_call()
case Call_id::NEW_SIGNAL_RECEIVER: _call_new_signal_receiver(); return;
case Call_id::NEW_SIGNAL_CONTEXT: _call_new_signal_context(); return;
case Call_id::KILL_SIGNAL_CONTEXT: _call_kill_signal_context(); return;
case Call_id::KILL_SIGNAL_RECEIVER: _call_kill_signal_receiver(); return;
case Call_id::BIN_SIGNAL_CONTEXT: _call_bin_signal_context(); return;
case Call_id::BIN_SIGNAL_RECEIVER: _call_bin_signal_receiver(); return;
case Call_id::AWAIT_SIGNAL: _call_await_signal(); return;
case Call_id::SUBMIT_SIGNAL: _call_submit_signal(); return;
case Call_id::SIGNAL_PENDING: _call_signal_pending(); return;
@@ -886,7 +959,7 @@ void Thread::_call()
case Call_id::NEW_VM: _call_new_vm(); return;
case Call_id::RUN_VM: _call_run_vm(); return;
case Call_id::PAUSE_VM: _call_pause_vm(); return;
case Call_id::KILL_PD: _call_kill_pd(); return;
case Call_id::BIN_PD: _call_bin_pd(); return;
case Call_id::ACCESS_THREAD_REGS: _call_access_thread_regs(); return;
case Call_id::ROUTE_THREAD_EVENT: _call_route_thread_event(); return;
default:

View File

@@ -51,7 +51,6 @@ class Kernel::Thread
public Execution_context,
public Ipc_node,
public Signal_context_killer,
public Signal_receiver_killer,
public Signal_handler,
public Thread_cpu_support
{
@@ -69,8 +68,7 @@ class Kernel::Thread
AWAITS_RESUME = 4,
AWAITS_SIGNAL = 5,
AWAITS_SIGNAL_CONTEXT_KILL = 6,
AWAITS_SIGNAL_RECEIVER_KILL = 7,
STOPPED = 8,
STOPPED = 7,
};
State _state;
@@ -177,22 +175,44 @@ class Kernel::Thread
*/
addr_t Thread::* _reg(addr_t const id) const;
/**
* Print table of all threads and their current activity
*/
void _print_activity_table();
/**
* Print the activity of the thread
*
* \param printing_thread wether this thread caused the debugging
*/
void _print_activity(bool const printing_thread);
/**
* Print the activity of the thread when it awaits a message
*/
void _print_activity_when_awaits_ipc();
/**
* Print activity info that is printed regardless of the thread state
*/
void _print_common_activity();
/****************************************************************
** Kernel-call backends, for details see 'kernel/interface.h' **
****************************************************************/
void _call_new_pd();
void _call_kill_pd();
void _call_bin_pd();
void _call_new_thread();
void _call_kill_thread();
void _call_bin_thread();
void _call_start_thread();
void _call_pause_thread();
void _call_resume_thread();
void _call_yield_thread();
void _call_wait_for_request();
void _call_request_and_wait();
void _call_reply();
void _call_await_request_msg();
void _call_send_request_msg();
void _call_send_reply_msg();
void _call_update_pd();
void _call_update_region();
void _call_print_char();
@@ -203,7 +223,8 @@ class Kernel::Thread
void _call_submit_signal();
void _call_ack_signal();
void _call_kill_signal_context();
void _call_kill_signal_receiver();
void _call_bin_signal_context();
void _call_bin_signal_receiver();
void _call_new_vm();
void _call_run_vm();
void _call_pause_vm();
@@ -216,17 +237,10 @@ class Kernel::Thread
***************************/
void _signal_context_kill_pending();
void _signal_context_kill_failed();
void _signal_context_kill_done();
/****************************
** Signal_receiver_killer **
****************************/
void _signal_receiver_kill_pending();
void _signal_receiver_kill_done();
/********************
** Signal_handler **
********************/

View File

@@ -16,6 +16,6 @@
namespace Kernel
{
Vm_ids * vm_ids() { return unsynchronized_singleton<Vm_ids>(); }
Vm_pool * vm_pool() { return unsynchronized_singleton<Vm_pool>(); }
Vm_ids * vm_ids() { return unmanaged_singleton<Vm_ids>(); }
Vm_pool * vm_pool() { return unmanaged_singleton<Vm_pool>(); }
}

View File

@@ -0,0 +1,84 @@
/*
* \brief Parts of platform that are specific to Odroid XU
* \author Stefan Kalkowski
* \date 2013-11-25
*/
/*
* Copyright (C) 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.
*/
/* core includes */
#include <board.h>
#include <platform.h>
#include <pic.h>
#include <cpu.h>
#include <timer.h>
#include <kernel/irq.h>
using namespace Genode;
namespace Kernel { void init_platform(); }
/**
* Interrupts that core shall provide to users
*/
static unsigned irq_ids[] =
{
Board::PWM_IRQ_0,
};
enum { IRQ_IDS_SIZE = sizeof(irq_ids)/sizeof(irq_ids[0]) };
void Kernel::init_platform()
{
/* make user IRQs become known by cores IRQ session backend and kernel */
static uint8_t _irqs[IRQ_IDS_SIZE][sizeof(Irq)];
for (unsigned i = 0; i < IRQ_IDS_SIZE; i++) {
new (_irqs[i]) Irq(irq_ids[i]);
}
}
unsigned * Platform::_irq(unsigned const i)
{
return i < IRQ_IDS_SIZE ? &irq_ids[i] : 0;
}
Native_region * Platform::_ram_regions(unsigned const i)
{
static Native_region _regions[] =
{
{ Board::RAM_0_BASE, Board::RAM_0_SIZE },
};
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
}
Native_region * Platform::_mmio_regions(unsigned const i)
{
static Native_region _regions[] =
{
{ Board::MMIO_0_BASE, Board::MMIO_0_SIZE },
};
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
}
Native_region * Platform::_core_only_mmio_regions(unsigned const i)
{
static Native_region _regions[] =
{
{ Board::GIC_CPU_MMIO_BASE, Board::GIC_CPU_MMIO_SIZE },
{ Board::MCT_MMIO_BASE, Board::MCT_MMIO_SIZE },
};
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
}
Cpu::User_context::User_context() { cpsr = Psr::init_user(); }

View File

@@ -0,0 +1,44 @@
#
# \brief Build config for Genodes core process
# \author Stefan Kalkowski
# \date 2013-11-25
#
# declare wich specs must be given to build this target
REQUIRES += platform_odroid_xu
# add include paths
INC_DIR += $(REP_DIR)/src/core/odroid_xu
INC_DIR += $(REP_DIR)/src/core/exynos5
INC_DIR += $(REP_DIR)/src/core/arm
# add C++ sources
SRC_CC += platform_services.cc \
platform_support.cc \
cpu_support.cc
# add assembly sources
SRC_S += mode_transition.s \
boot_modules.s \
crt0.s
# declare source paths
vpath platform_services.cc $(BASE_DIR)/src/core
vpath platform_support.cc $(REP_DIR)/src/core/odroid_xu
vpath mode_transition.s $(REP_DIR)/src/core/arm_v7
vpath cpu_support.cc $(REP_DIR)/src/core/arm
vpath crt0.s $(REP_DIR)/src/core/arm
#
# Check if there are other images wich shall be linked to core.
# If not use a dummy boot-modules file wich includes only the symbols.
#
ifeq ($(wildcard $(BUILD_BASE_DIR)/boot_modules.s),)
vpath boot_modules.s $(REP_DIR)/src/core/arm
else
INC_DIR += $(BUILD_BASE_DIR)
vpath boot_modules.s $(BUILD_BASE_DIR)
endif
# include less specific target parts
include $(REP_DIR)/src/core/target.inc

View File

@@ -109,10 +109,12 @@ Native_region * Platform::_core_only_ram_regions(unsigned const i)
}
Platform::Platform() :
Platform::Platform()
:
_core_mem_alloc(0),
_io_mem_alloc(core_mem_alloc()), _io_port_alloc(core_mem_alloc()),
_irq_alloc(core_mem_alloc()), _vm_base(0x1000), _vm_size(0xfffef000)
_irq_alloc(core_mem_alloc()),
_vm_start(VIRT_ADDR_SPACE_START), _vm_size(VIRT_ADDR_SPACE_SIZE)
{
/*
* Initialise platform resource allocators.
@@ -173,7 +175,7 @@ Platform::Platform() :
void Core_parent::exit(int exit_value)
{
kernel_log() << __PRETTY_FUNCTION__ << ": Not implemented\n";
Kernel::log() << __PRETTY_FUNCTION__ << "not implemented\n";
while (1) ;
}

View File

@@ -20,7 +20,7 @@ Platform_pd::~Platform_pd()
{
_tlb->remove_region(platform()->vm_start(), platform()->vm_size());
regain_ram_from_tlb(_tlb);
if (Kernel::kill_pd(_id)) {
if (Kernel::bin_pd(_id)) {
PERR("failed to destruct protection domain at kernel");
}
}

View File

@@ -20,6 +20,8 @@ using namespace Genode;
namespace Kernel { unsigned core_id(); }
void Platform_thread::_init() { }
bool Platform_thread::_attaches_utcb_by_itself()
{
@@ -69,7 +71,7 @@ Platform_thread::~Platform_thread()
rm->remove_client(cap);
}
/* destroy object at the kernel */
Kernel::kill_thread(_id);
Kernel::bin_thread(_id);
}
@@ -158,23 +160,12 @@ int Platform_thread::join_pd(unsigned const pd_id, bool const main_thread,
}
void Platform_thread::_init()
{
}
int Platform_thread::start(void * const ip, void * const sp,
unsigned int const cpu_id)
{
/* attach UTCB if the thread can't do this by itself */
if (!_attaches_utcb_by_itself())
{
/* declare page aligned virtual UTCB outside the context area */
_utcb_virt = (Native_utcb *)((platform()->vm_start()
+ platform()->vm_size() - sizeof(Native_utcb))
& ~((1<<MIN_MAPPING_SIZE_LOG2)-1));
/* attach UTCB */
/* attach UTCB in case of a main thread */
if (_main_thread) {
_utcb_virt = main_thread_utcb();
if (!_rm_client) {
PERR("invalid RM client");
return -1;
@@ -186,22 +177,19 @@ int Platform_thread::start(void * const ip, void * const sp,
return -1;
}
}
/* initialize thread regisers */
/* initialize thread registers */
typedef Kernel::Thread_reg_id Reg_id;
enum { WRITES = 2 };
addr_t * write_regs = (addr_t *)Thread_base::myself()->utcb()->base();
write_regs[0] = Reg_id::IP;
write_regs[1] = Reg_id::SP;
addr_t write_values[] = {
(addr_t)ip,
_main_thread ? (addr_t)_utcb_virt : (addr_t)sp
};
addr_t write_values[] = { (addr_t)ip, (addr_t)sp };
if (Kernel::access_thread_regs(id(), 0, WRITES, 0, write_values)) {
PERR("failed to initialize thread registers");
return -1;
}
/* start executing new thread */
_utcb_phys->startup_msg.init(_id);
_utcb_phys->start_info()->init(_id, _utcb);
_tlb = Kernel::start_thread(_id, cpu_id, _pd_id, _utcb_phys);
if (!_tlb) {
PERR("failed to start thread");

View File

@@ -137,7 +137,7 @@ void Signal_session_component::free_context(Signal_context_capability cap)
void Signal_session_component::_destruct_context(Context * const c)
{
/* release kernel resources */
if (Kernel::kill_signal_context(c->id()))
if (Kernel::bin_signal_context(c->id()))
{
/* clean-up */
c->release();
@@ -153,7 +153,7 @@ void Signal_session_component::_destruct_context(Context * const c)
void Signal_session_component::_destruct_receiver(Receiver * const r)
{
/* release kernel resources */
if (Kernel::kill_signal_receiver(r->id()))
if (Kernel::bin_signal_receiver(r->id()))
{
/* clean-up */
r->release();

View File

@@ -22,7 +22,8 @@ INC_DIR += $(REP_DIR)/src/core \
$(BASE_DIR)/src/core/include \
$(BASE_DIR)/include \
$(BASE_DIR)/src/platform \
$(BASE_DIR)/src/base/thread
$(BASE_DIR)/src/base/thread \
$(BASE_DIR)/src/base/include
# add C++ sources
SRC_CC += console.cc \

View File

@@ -31,7 +31,6 @@ Native_utcb * Thread_base::utcb()
{
if (this) { return _tid.platform_thread->utcb_virt(); }
return _main_thread_utcb;
}
@@ -54,9 +53,7 @@ void Thread_base::_thread_start()
}
Thread_base::Thread_base(const char * const label, size_t const stack_size)
:
_list_element(this)
Thread_base::Thread_base(const char * const label, size_t const stack_size, Type)
{
_tid.platform_thread = new (platform()->core_mem_alloc())
Platform_thread(stack_size, Kernel::core_id(), label);
@@ -65,7 +62,7 @@ Thread_base::Thread_base(const char * const label, size_t const stack_size)
Thread_base::~Thread_base()
{
kernel_log() << __PRETTY_FUNCTION__ << ": Not implemented\n";
Kernel::log() << __PRETTY_FUNCTION__ << "not implemented\n";
while (1) ;
}

View File

@@ -1,42 +0,0 @@
/*
* \brief Platform-specific helper functions for the _main() function
* \author Martin Stein
* \author Christian Helmuth
* \date 2010-09-13
*/
/*
* 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.
*/
/* Genode includes */
#include <base/native_types.h>
#include <base/thread.h>
using namespace Genode;
namespace Genode { void platform_main_bootstrap(); }
Native_thread_id _main_thread_id;
Native_thread_id Genode::thread_get_my_native_id()
{
Thread_base * const t = Thread_base::myself();
return t ? t->tid().thread_id : _main_thread_id;
}
void Genode::platform_main_bootstrap()
{
/* go save against multiple calls e.g. for programs with dynamic linker */
static bool main_thread_id_valid = 0;
if (!main_thread_id_valid) {
Native_utcb * const utcb = Thread_base::myself()->utcb();
_main_thread_id = utcb->startup_msg.thread_id();
main_thread_id_valid = 1;
}
}

View File

@@ -131,13 +131,15 @@ namespace Genode {
* Please update platform-specific files after changing these
* values, e.g., 'base-linux/src/platform/context_area.*.ld'.
*/
static addr_t context_area_virtual_base() { return 0x40000000UL; }
static addr_t context_area_virtual_size() { return 0x10000000UL; }
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 addr_t context_virtual_size() { return 0x00100000UL; }
static constexpr addr_t context_virtual_size() { return 0x00100000UL; }
};
class Native_pd_args

Some files were not shown because too many files have changed in this diff Show More