Commit Graph

72 Commits

Author SHA1 Message Date
Alexander Boettcher 0ed45d92ff base: string length handling fix in Rpc_in_buffer
If a null-terminated string exactly of length MAX (0 byte included) is
provided, it will be handled as invalid because of wrong string size length
checks.

Commit fixes this.

Discovered during #1486 development.
2015-05-06 10:55:18 +02:00
Christian Helmuth f20b6bdc88 Prevent overlap of stack and thread-context members
Now, Thread::Context provides the first word of the stack to prevent the
overlapping of stack top and the 'stack_base' member.

Fixes #1491
2015-05-06 10:55:17 +02:00
Martin Stein c9272937e7 CPU session: apply quota via relative weightings
Physical CPU quota was previously given to a thread on construction only
by directly specifying a percentage of the quota of the according CPU
session. Now, a new thread is given a weighting that can be any value.
The physical counter-value of such a weighting depends on the weightings
of the other threads at the CPU session. Thus, the physical quota of all
threads of a CPU session must be updated when a weighting is added or
removed. This is each time the session creates or destroys a thread.

This commit also adapts the "cpu_quota" test in base-hw accordingly.

Ref #1464
2015-05-06 10:55:16 +02:00
Josef Söntgen 2c39c75e1c base: remove Irq_connection::wait_for_irq() 2015-04-23 16:48:00 +02:00
Alexander Boettcher faa25e1df6 base: make irq_session asynchronous
second step

options: factor out common parts of irq_session_component.cc
options: use on foc arm no proxy threads

Fixes #1456
2015-04-23 16:47:58 +02:00
Alexander Boettcher e2cbc7c5b3 base: unify some irq_session headers
remove repos/base-*/include/irq_session headers and use only a unification
from   repos/base/include/irq_session

first step

Issue #1456
2015-04-23 16:47:57 +02:00
Norman Feske 97dc9664fe base: move flex_iterator.h to include/util
Fixes #1482
2015-04-17 16:13:22 +02:00
Norman Feske eaab23c012 base: const-correctness of Allocator interface
This patch adds const qualifiers to the functions Allocator::consumed,
Allocator::overhead, Allocator::avail, and Range_allocator::valid_addr.

Fixes #1481
2015-04-17 16:13:22 +02:00
Norman Feske c4dea1057b Document empty Pd_session_client::assign_pci 2015-04-17 16:13:22 +02:00
Stefan Kalkowski b949489641 base: remove local capability from generic base
* Instead of using local capabilities within core's context area implementation
  for stack allocation/attachment, simply do both operations while stack gets
  attached, thereby getting rid of the local capabilities in generic code
* In base-hw the UTCB of core's main thread gets mapped directly instead of
  constructing a dataspace component out of it and hand over its local
  capability
* Remove local capability implementation from all platforms except Linux

Ref #1443
2015-04-17 16:13:20 +02:00
Norman Feske d9d65aa86b base: use reference for ascii_to output argument
Issue #1477
2015-04-17 16:13:19 +02:00
Norman Feske d884cf1a9a base: unify ascii_to conversion functions
This patch addresses the first point of the issue #1477, namely
replacing the function-template magic by plain function overloads.

Issue #1477
2015-04-13 14:18:16 +02:00
Christian Prochaska 0fd53c7fe4 Extract numeric string arguments with the correct signedness
There are lots of places where a numeric argument of an argument string
gets extraced as signed long value and then assigned to an unsigned long
variable. If the value in the string was negative, it would not be
detected as invalid (and replaced by the default value), but become a
positive bogus value.

With this patch, numeric values which are supposed to be unsigned get
extracted with the 'ulong_value()' function, which returns the default
value for negative numbers.

Fixes #1472
2015-04-13 14:18:15 +02:00
Norman Feske eaac3cc1bd Revised API documentation
This patch curates the API documentation to become suitable for the
functional specificaton, which is partially generated from the header
files.
2015-04-09 16:04:46 +02:00
Norman Feske 394fce110e base: coding style 2015-04-09 16:04:45 +02:00
Norman Feske 13a0c336d9 base: separate the API's 'Thread_base' constructor
The 'Thread_base' class is constructed differently in some special cases
like the main thread or a thread that use a distinct CPU session. The
official API, however, should be clean from such artifacts. Hence, I
separated the official constructor from the other cases.
2015-04-09 16:04:45 +02:00
Norman Feske 0d74435448 base: remove Genode::parent_cap from the API
Components interact with their environments using the Genode::Env class
instead of directly using the parent capability.
2015-04-09 16:04:45 +02:00
Norman Feske 695ac957f4 base: add missing override annotations 2015-04-09 16:04:44 +02:00
Norman Feske 6fc372bcf4 base: add const qualifiers 2015-04-09 16:04:44 +02:00
Martin Stein 60e392f0c0 hw: support Wandboard Quad (i.MX6)
The port uses the Cortex-A9 private timer for the kernel and an EPIT as
user timer. It was successfully tested on the Wandboard Quad and the CuBox-i
with the signal test. It lacks L2-cache and Trustzone support by now.

Thanks to Praveen Srinivas (IIT Madras, India) and  Nikolay Golikov (Ksys Labs
LLC, Russia). This work is partially based on their contributions.

Fix #1467
2015-04-09 16:04:43 +02:00
Adrian-Ken Rueegsegger e5f26fa8db base: Raise RAM quota of signal session to 16K
On base-hw/x86_64 the quota of the signal session is not sufficient due to
the large size of the Signal_session_component. Increasing the quota to
16K avoids signal-context resource exhaustion messages as emmitted by the
run/launcher scenario:

  ...
  Quota exceeded! amount=4096, size=4096, consumed=4096
  failed to allocate signal-context resources
  upgrading quota donation for signal session
  C++ runtime: Genode::Parent::Quota_exceeded
  void* abort(): abort called
  ...

Note: This change increases the quota for all kernels even though it is
      strictly only required for base-hw/x86_64.
2015-03-27 11:53:33 +01:00
Reto Buerki 28b5e67a8c Update or add hw_x86_64 copyright headers 2015-03-27 11:53:32 +01:00
Adrian-Ken Rueegsegger 7ce8464b3a hw_x86_64: Enable FPU support
* Enable the use of the FXSAVE and FXRSTOR instructions, see Intel SDM
  Vol. 3C, section 2.5.
* The state of the x87 floating point unit (FPU) is loaded and saved on
  demand.
* Make the cr0 control register accessible in the Cpu class. This is in
  preparation of the upcoming FPU management.
* Access to the FPU is disabled by setting the Task Switch flag in the cr0
  register.
* Access to the FPU is enabled by clearing the Task Switch flag in the cr0
  register.
* Implement FPU initialization
* Add is_fpu_enabled helper function
* Add pointer to CPU lazy state to CPU class
* Init FPU when finishing kernel initialization
* Add function to retry FPU instruction:
    Similar to the ARM mechanism to retry undefined instructions, implement a
    function for retrying an FPU instruction. If a floating-point instruction
    causes an #NM exception due to the FPU being disabled, it can be retried
    after the correct FPU state is restored, saving the current state and
    enabling the FPU in the process.
* Disable FPU when switching to different user context:
    This enables lazy save/restore of the FPU since trying to execute a
    floating point instruction when the FPU is disabled will cause a #NM
    exception.
* Declare constant for #NM exception
* Retry FPU instruction on #NM exception
* Assure alignment of FXSAVE area:
    The FXSAVE area is 512-byte memory region that must be 16-byte aligned. As
    it turns out the alignment attribute is not honored in all cases so add a
    workaround to assure the alignment constraint is met by manually rounding
    the start of the FXSAVE area to the next 16-byte boundary if necessary.
2015-03-27 11:53:31 +01:00
Reto Buerki e443b859e6 base: Add x86 RESET pseudo-exception
Define RESET as exception 0xfe. The reset state is only used initially
in the CPU idle exception function.
2015-03-27 11:53:31 +01:00
Reto Buerki c9c84dd751 base: Move Cpu_exception enum to x86_64 cpu_state.h 2015-03-27 11:53:31 +01:00
Adrian-Ken Rueegsegger 408cec32f5 base: Add errcode to x86_64 Cpu_state
The new errcode field is used to store the error code that some
interrupts provide (e.g. #PF). Rework mode transition reserved space and
offset constants to match the new CPU_state layout.
2015-03-27 11:53:21 +01:00
Martin Stein 98616a1812 i.MX53: SD-card driver and bench
The driver for the Freescale eSDHCv2 doesn't support the highest
available bus frequency by now and also the bus width may be set to a
higher value but that needs further checks on the capabilities of the
inserted card.

The commits provide a benchmark as it exists for the OMAP4 SDHC driver.

Fix #1458
2015-03-27 11:53:12 +01:00
Martin Stein c52bf757f0 register: make bitfield-mask methods constexpr
Ref #1458
2015-03-27 11:53:12 +01:00
Alexander Boettcher 1f8fad8fa1 base: refactor signal_transmitter::submit
Move it to platform specific .cc file, so that it may get re-implemented
platform specifically if needed.

Issue #1446
2015-03-19 09:32:52 +01:00
Norman Feske 001b069509 Simplify base/semaphore.h, fix #1453 2015-03-19 08:57:21 +01:00
Norman Feske d841fbb82e Add missing header in base/signal.h 2015-03-19 08:57:20 +01:00
Norman Feske 99e7f26b99 Remove base/include/base/errno.h, fix #1450 2015-03-19 08:57:20 +01:00
Norman Feske e8336acafc base,os: Coding-style unification
Fixes #1432
2015-03-13 12:17:23 +01:00
Norman Feske 56ed7addbc base: fix misleading ROM-connection error message 2015-03-04 17:32:20 +01:00
Martin Stein c78efd4428 odroid_xu: prevent tests with sd/platform/ahci/fb
Drivers like SD-Card, platform, AHCI, and framebuffer are specified as Exynos5
compliant. But they are at least not compliant with Odroid-XU although this is
Exynos5. Thus, prevent tests that rely on such drivers when building for
hw_odoid_xu. Furthermore, make previous Arndale regulator/consts.h,
uart_defs.h, and some Board_base enums available to all Exynos5 builds to
enable at least building the drivers.

Fixes #1419
2015-02-27 11:48:36 +01:00
Martin Stein be392b3bf9 hw: support USB-Armory board
The USB Armory is almost the same as the i.MX53-QSB but it uses only
one of the two RAM banks available in i.MX53. Furthermore we use the USB
Armory only with Trustzone enabled.

Ref #1422
2015-02-27 11:48:35 +01:00
Stefan Kalkowski 7582396e9c hw_arndale: enable ARM virtualization extensions
* enables world-switch using ARM virtualization extensions
* split TrustZone and virtualization extensions hardly from platforms,
  where it is not used
* extend 'Vm_session' interface to enable configuration of guest-physical memory
* introduce VM destruction syscall
* add virtual machine monitor for hw_arndale that emulates a simplified version
  of ARM's Versatile Express Cortex A15 board for a Linux guest OS

Fixes #1405
2015-02-27 11:48:05 +01:00
Stefan Kalkowski e7dad39016 uart_drv: enable RX channel for exynos5 driver
This is useful for automated tests on this platform, where the run script
wants to interact with some component via terminal

Ref #1405
2015-02-27 11:48:05 +01:00
Stefan Kalkowski a40932a324 hw: refactor irq controllers
* name irq controller memory mapped I/O regions consistently
  in board descriptions
* move irq controller and timer memory mapped I/O region descriptions
  from cpu class to board class
* eliminate artificial distinction between flavors of ARM's GIC
* factor cpu local initialization out of ARM's GIC interface description,
  which is needed if the GIC is initialized differently e.g. for TrustZone

Ref #1405
2015-02-27 11:43:56 +01:00
Alexander Boettcher a594ae703d base: fix location_of_index affinity calculation
Take care that ypos parameter is smaller than height().
If it is not - wrap around.

Issue #1412.
2015-02-27 11:43:55 +01:00
Alexander Boettcher 8c66a4b1be base: support phys range specifier in ram_session
Fixes #696
2015-02-16 13:40:38 +01:00
Alexander Boettcher 95ff5ba11d base: support range restriction in allocator
Issue #696
2015-02-16 13:40:38 +01:00
Stefan Kalkowski a3abf74d1e hw: remove code duplication related to Exynos5 SoC
Fixes #1396
2015-02-16 13:40:36 +01:00
Norman Feske 671682cb6a base: use reinterpret_cast for symbol lookup
This patch changes the Shared_object::lookup function to use a
reinterpret_cast instead of a static_cast to allow the conversion
from symbol addresses to arbitrary pointers.
2015-01-26 12:28:42 +01:00
Stefan Kalkowski 901bff813d imx31: remove platform completely (fix #1360) 2015-01-12 14:24:15 +01:00
Martin Stein 9a4a0448be hw vea9x4: remove trustzone support
When building Genode for VEA9X4 as micro-hypervisor protected by the ARM
TrustZone hardware we ran into limitations regarding our basic daily
testing routines. The most significant is that, when speaking about RAM
partitioning, the only available options are to configure the whole SRAM
to be secure and the whole DDR-RAM to be non-secure or vice versa. The
SRAM however provides only 32 MB which isn't enough for both a
representative non-secure guest OS or a secure Genode that is still
capable of passing our basic tests. This initiated our decision to
remove the VEA9X4 TrustZone-support.

Fixes #1351
2015-01-08 13:28:42 +01:00
Martin Stein e63092f1dd hw & cortex_a9: fix scheduling-timer speed
The estimation of the input clock of the Cortex A9 Private Timer module
was pretty miserable at every Cortex A9 board.

Fixes #1341
2015-01-06 15:22:07 +01:00
Christian Helmuth f9422b241f Fix compiler warning about uninitialized variable
Fixes #1051
2014-12-01 17:29:17 +01:00
Stefan Kalkowski 4d3fa001e0 hw: remove memory region duplicate (fix #1304)
On the Versatile Express Cortex A9x4 platform the first memory region
0x0 - 0x4000000 is a hardware remapped memory area, containing flash
and DDR RAM copies and thus should not be added in addition to all
DDR RAM regions and the SRAM region.
2014-11-28 12:02:40 +01:00
Martin Stein 8f9355b360 thread API & CPU session: accounting of CPU quota
In the init configuration one can configure the donation of CPU time via
'resource' tags that have the attribute 'name' set to "CPU" and the
attribute 'quantum' set to the percentage of CPU quota that init shall
donate. The pattern is the same as when donating RAM quota.

! <start name="test">
!   <resource name="CPU" quantum="75"/>
! </start>

This would cause init to try donating 75% of its CPU quota to the child
"test".  Init and core do not preserve CPU quota for their own
requirements by default as it is done with RAM quota.

The CPU quota that a process owns can be applied through the thread
constructor. The constructor has been enhanced by an argument that
indicates the percentage of the programs CPU quota that shall be granted
to the new thread. So 'Thread(33, "test")' would cause the backing CPU
session to try to grant 33% of the programs CPU quota to the thread
"test". By now, the CPU quota of a thread can't be altered after
construction. Constructing a thread with CPU quota 0 doesn't mean the
thread gets never scheduled but that the thread has no guaranty to receive
CPU time. Such threads have to live with excess CPU time.

Threads that already existed in the official repositories of Genode were
adapted in the way that they receive a quota of 0.

This commit also provides a run test 'cpu_quota' in base-hw (the only
kernel that applies the CPU-quota scheme currently). The test basically
runs three threads with different physical CPU quota. The threads simply
count for 30 seconds each and the test then checks wether the counter
values relate to the CPU-quota distribution.

fix #1275
2014-11-28 12:02:37 +01:00