Commit Graph

226 Commits

Author SHA1 Message Date
Alexander Boettcher 9b21c88bc6 base: handle unsupported printf commands better
The commit consumes the argument of a unsupported printf command.

Without the commit - a subsequent command uses the argument of the preceding
command, which may cause memory corruption or page faults for sequences using
string commands, e.g.

Genode::printf("%#x %s\n", 0x20, "Test");

'#' is not supported by Genode::printf. In this scenario a pagefault at
address 0x20 is caused.

Fixes #1701
2015-09-30 12:20:38 +02:00
Alexy Gallardo Segura de87ecfc62 foc_odroid_x2: basic configuration for gpio pins
Fixes #1669
2015-09-30 12:20:38 +02:00
Alexy Gallardo Segura 49b3d520a9 exynos: generalize Exynos5 fb_drv for Exynos4/5
Fixes #1678
2015-09-30 12:20:37 +02:00
Stefan Kalkowski ed52d5a211 Introduce 'spec' subdirectories to outline aspects
Instead of holding SPEC-variable dependent files and directories inline
within the repository structure, move them into 'spec' subdirectories
at the corresponding levels, e.g.:

  repos/base/include/spec
  repos/base/mk/spec
  repos/base/lib/mk/spec
  repos/base/src/core/spec
  ...

Moreover, this commit removes the 'platform' directories. That term was
used in an overloaded sense. All SPEC-relative 'platform' directories are
now named 'spec'. Other files, like for instance those related to the
kernel/architecture specific startup library, where moved from 'platform'
directories to explicit, more meaningful places like e.g.: 'src/lib/startup'.

Fix #1673
2015-09-16 13:58:50 +02:00
Stefan Kalkowski acc46f70b7 codezero: remove support from Genode (fix #1668) 2015-09-09 15:14:29 +02:00
Johannes Schlatow 40b31876d2 base-hw: Add basic Zynq-7000 support (QEMU)
Ref #1599
2015-09-09 15:14:28 +02:00
Stefan Kalkowski 458b4d6fc4 base: redesign object pool using lambda interface
Instead of returning pointers to locked objects via a lookup function,
the new object pool implementation restricts object access to
functors resp. lambda expressions that are applied to the objects
within the pool itself.

Fix #884
Fix #1658
2015-09-09 15:14:28 +02:00
Alexander Boettcher c5877b5575 hw: remove access_thread_regs syscall
Issue #1652
2015-09-09 15:14:27 +02:00
Alexander Boettcher 6e481127ce hw: increase stack size for thread test
Stack size of cpu helper is insufficient if a exception is thrown during
'test_create_as_many_threads()'

Related to #1652
2015-09-09 15:14:27 +02:00
Christian Helmuth ae43d13b90 Remove always_hybrid spec
With always_hybrid also the lx_hybrid_x86 platform in
tool/create_builddir vanishes.

Fixes #1619
2015-09-09 15:14:27 +02:00
Reinier Millo Sánchez 98da445269 gpio: RaspberryPI GPIO driver
Fixes #1654
2015-08-31 09:09:23 +02:00
Reinier Millo Sánchez 433f859cb9 foc_odroid_x2: USB support
Fixes #1627
2015-08-31 09:09:22 +02:00
Christian Helmuth 10aba44982 thread: increase test timeout
Because of recently added test cases the script exceeds the timeout on
some embedded boards and base-hw.
2015-08-24 11:38:53 +02:00
Adrian-Ken Rueegsegger c2ff0ae9d4 Minor cleanup fixes
- Fix spelling errors
- Remove extra semicolons
- Remove extra spaces

Fixes #1650
2015-08-21 11:00:59 +02:00
Norman Feske b4e3e99cc8 base: add Weak_object::weak_ptr const
Issue #1649
2015-08-21 11:00:58 +02:00
Josef Söntgen 4992903233 Rename audio_out_drv to audio_drv
With the introducation of the Audio_in session interface it makes
sense to rename the current available audio drivers. At the moment
only the dde_bsd audio_drv supports Audio_out as well as Audio_in.
The Linux audio_drv only supports Audio_out (there is no demand for
Audio_in support currently) but is renamed nonetheless to make it
easiert to write generic run scripts.

Issue #1644.
2015-08-21 10:59:46 +02:00
Stefan Kalkowski eafe5e81e3 core: unify and simplify paging code (Fix #1641)
For most platforms except of NOVA a distinction between pager entrypoint
and pager activation is not needed, and only exists due to historical
reasons. Moreover, the pager thread's execution path is almost identical
between most platforms excluding NOVA, HW, and Fisco.OC. Therefore,
this commit unifies the pager loop for the other platforms, and removes
the pager activation class.
2015-08-21 10:58:59 +02:00
Alexander Boettcher 626b0a68f3 base: increase base-control size for 32bit
It is insufficient for creating threads up to the maximum supported limit
(256 by now).

Issue #1601
2015-08-21 10:58:58 +02:00
Alexander Boettcher 9081653c96 Extend thread test
Issue #1601
2015-08-21 10:58:58 +02:00
Alexander Boettcher fe4e0702d4 base: contain chunk_size heap consumption
Increase internal chunk size of heap only if an allocation succeeded
beforehand. Otherwise the chunk size increases with every unsuccessful
invocation and a upgrade of the used ram session will be insufficient and of
no use at all.

Fixes #1632
2015-07-21 09:36:46 +02:00
Martin Stein f3e76b3e9a base: use BDA header in base-nova like base-hw
Moves the Bios Data Area header from base-hw to base. Modifies the
base-nova core console that it uses the header as replacement for
the previous BDA bit logic.

Ref #1625
2015-07-21 09:30:12 +02:00
Martin Stein c6f73d365a unmanaged singleton: allow private constructors
Introduces a class Unmanaged_singleton_constructor that can be declared as
friend to be able to call unmanaged_singleton on classes with a private
constructor. Enables the appliance of the singleton pattern.

Ref #1625
2015-07-21 09:30:12 +02:00
Alexander Boettcher 0b019d0508 base: move x86 uart driver from nova to base
So it can be reused by base-hw-x86 instead of re-writing it.

Fixes #1403
2015-07-21 09:30:11 +02:00
Stefan Kalkowski 0f05fa6fd4 base: resolve dead lock in weak pointer templates
This commit eliminates the mutual interlaced taking of destruction lock,
list lock and weak pointer locks that could lead to a dead-lock situation
when a lock pointer was tried to construct while a weak object is in
destruction progress.
Now, all weak pointers are invalidated and dequeued at the very
beginning of the weak object's destruction. Moreover, before a weak pointer
gets invalidated during destruction of a weak object, it gets dequeued, and
the list lock is freed again to avoid the former dead-lock.

Fix #1607
2015-07-21 09:30:04 +02:00
Josef Söntgen 7e40f5f587 base: use proper Cpu_session when tracing threads
Up to now it was not possible to trace threads that use a different
Cpu_session rather than env()->cpu_session() (as done by VirtualBox).
This problem is now solved by setting the Cpu_session explicitly when
creating the event logger and attaching the trace control area when
creating the thread.

Fixes #1618.
2015-07-21 09:28:26 +02:00
Alexy Gallardo Segura c14fe7e6c7 foc: Odroid-X2 basic support
Fix #1597
2015-07-21 09:28:25 +02:00
Alexander Boettcher c42e770384 detach ds from all rm sessions before destruction
Fixes #1617
2015-07-21 09:28:24 +02:00
Norman Feske 0cd93c64aa ldso: add lx_environ to symbol map
This symbol must be exported to build dynamically-linked executables on
the lx_hybrid_x86 base platform.
2015-07-07 19:48:07 +02:00
Stefan Kalkowski c951c30d8a base: extend weak pointer test (Ref #1607)
Add a test where a locked pointer shall be taken during object destruction.
Moreover, extend the run-script so it runs on different platforms with
"real" timers.
2015-07-07 19:48:06 +02:00
Stefan Kalkowski 89255c3979 remove Versatile Express board (Fix #1611) 2015-07-07 19:48:06 +02:00
Emery Hemingway 46b7227ef0 cxx: notify parent on abort() (in main thread)
Fixes #1605
2015-07-01 15:09:32 +02:00
Stefan Kalkowski 691df908aa core: remove Rm_member from RM session component
Rm_member does not fulfill a useful role, but makes understanding of
the RM session component more difficult.

Ref #956
2015-07-01 14:46:17 +02:00
Stefan Kalkowski dc36b63acb base: turn align_addr tool into constexpr
Thereby, the tool can be used to calculate static compile-time values.
Ref #1588
2015-07-01 14:46:17 +02:00
Stefan Kalkowski b856bfdfcd base: let bit allocator use fine-grained sizes
Ref #1588
2015-07-01 14:46:17 +02:00
Christian Helmuth 11c31c4432 Prevent silly text-segment alignment on all platforms
We set 'ld -z max-page-size' to 4KiB to prevent the linker from aligning
the text segment to any built-in default (e.g., 4MiB on x86_64 or 64KiB
on ARM). Otherwise, the padding bytes are wasted at the beginning of the
final binary.
2015-07-01 14:46:16 +02:00
Stefan Kalkowski 2a351215f4 base: remove pager code from public API
Fix #1593
2015-07-01 14:46:15 +02:00
Norman Feske e143084b04 base: fix warning in RPC framework
The recent change of the TRACE session interface triggered the
following warning:

/home/no/src/genode/repos/base/include/base/ipc.h:79:4: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    *reinterpret_cast<T *>(&_sndbuf[_write_offset]) = value;
    ^
In file included from /home/no/src/genode/repos/base/src/core/include/trace/session_component.h:19:0,
                 from /home/no/src/genode/repos/base/src/core/trace_session_component.cc:15:
/home/no/src/genode/repos/base/include/base/rpc_server.h:132:42: note: ‘ret’ was declared here
     typename This_rpc_function::Ret_type ret;

The warning occurs for basic return types (like size_t), which are
indeed not initialized. The variable gets its value assigned by the
corresponding 'call_member' overload, to which the variable is passed as
reference. But the compiler apparently is not able to detect this assignment.

Declaring 'ret' with a C++11-style default initializer fixes the warning.
2015-06-22 14:43:40 +02:00
Norman Feske 5d678dba9e core: throw Trace::Out_of_metadata in subjects()
While importing trace sources as trace subjects into a TRACE session,
the session quota might become depleted. The TRACE session already keeps
track of the session quota via an allocator guard but the 'subjects' RPC
function missed to handle the out-of-memory condition. This patch
reflects the error condition as an 'Out_of_metadata' exception to the
TRACE client. It also contains an extension of the trace test to
exercise the corner case.
2015-06-22 14:43:39 +02:00
Alexander Boettcher 705257cf22 cxx: show thread name in event of abort
Issue #1591
2015-06-22 14:43:39 +02:00
Norman Feske a23ac5f569 base/nova: add idle threads to trace sources
Issue #813
2015-06-22 14:43:39 +02:00
Norman Feske 959572968d core: provide thread exec times via TRACE service
This patch enable clients of core's TRACE service to obtain the
execution times of trace subjects (i.e., threads). The execution time is
delivered as part of the 'Subject_info' structure.

Right now, the feature is available solely on NOVA. On all other base
platforms, the returned execution times are 0.

Issue #813
2015-06-22 14:43:38 +02:00
Norman Feske 2d8a4917a5 base: add Trace::Subject_info::state_name
Issue #813
2015-06-22 14:43:37 +02:00
Josef Söntgen 80893dfcfc platform_drv: specific AUDIO/HDAUDIO class aliases
The alias AUDIO matches audio multimedia device while the HDAUDIO
alias matches HD audio multimedia devices.

Fixes #1581
2015-06-22 14:43:37 +02:00
Christian Prochaska 4cae6c0d12 cxx: report names of uncaught exceptions again
Fixes #1582
2015-06-22 14:43:37 +02:00
Norman Feske 5317cca031 base/allocator.h: clarify use of delete operator
Issue #1571
2015-06-22 14:43:35 +02:00
Stefan Kalkowski 409ac1468e core: implement core allocator's free (ref #1573) 2015-06-22 14:43:35 +02:00
Alexander Boettcher 1f40d9de6a pci: convert to platform_drv
Fixes #1542
2015-06-22 14:43:34 +02:00
Norman Feske 4f927f651b core: handle IRQ sessions by separate entrypoint
Fixes #1572
2015-06-22 14:43:34 +02:00
Alexander Boettcher 1c38d4903b x86: use report_rom for acpi and pci driver
Issue #1542
2015-06-09 11:00:12 +02:00
Norman Feske ef9c745e42 ldso: add memcpy and memset to symbol.map
On ARM, the compiler generates calls to memcpy and memset. Most
dynamically linked programs use the libc, which provides these
functions. However, if a dynamically linked program does not use the
libc (e.g., noux/minimal or the new version of cli_monitor), those
symbols remain unresolved. By adding them to ldso's symbol.map, the
dynamic linker will resolve them with the functions of the cxx
library, which is part of the dynamic linker.

Issue #1561
2015-06-09 11:00:11 +02:00
Alexander Boettcher e1896e3b44 run: add platform_drv include for usage by scripts
Related to #765 and used for issue #1542
2015-06-09 11:00:10 +02:00
Stefan Kalkowski 28804e2bfb base: remove cap_integrity test (fix #1536) 2015-05-26 09:40:04 +02:00
Stefan Kalkowski 554146d39c base: enforce ram_quota donations to be consistent
For several basic sessions that core provides default ram quota values
exist in the form of enum values. They are used e.g. by init to deduce
session costs. Unfortunately they were not used when actually establishing
the session, which lead to inconsistencies.

Ref #1443
2015-05-26 09:40:03 +02:00
Stefan Kalkowski a93266548f base: remove unused enum from object pool
Ref #1443
2015-05-26 09:40:03 +02:00
Stefan Kalkowski 217f62b89d base: move retry template function to util header
Ref #1443
2015-05-26 09:40:03 +02:00
Stefan Kalkowski 64bfe233d7 base: make CAP session upgradeable
* Introduce 'Out_of_metadata' exception for capability allocation

Ref #1443
2015-05-26 09:40:02 +02:00
Stefan Kalkowski 73c3a81e0b base: make PD session upgradeable
Ref #1443
2015-05-26 09:40:02 +02:00
Norman Feske 35a52f0282 base: const qualifiers in base/trace/types.h
This patch adds missing const qualifiers to the == operators of
'Subject_id' and 'Policy_id'. Thanks to Pirmin Duss for reporting.
2015-05-26 09:39:53 +02:00
Christian Helmuth 8990346c6c mmio: fix compiler warnings
We implicitly know that the value range will not exceed access_t despite
the integer-based arithmetics, i.e., negation and shift operations.

Fixes #1524
2015-05-26 09:39:53 +02:00
Norman Feske e2fe071871 Minor comment refinements for the manual 2015-05-26 09:39:50 +02:00
Christian Prochaska 72e31090ee tool_chain: update GCC to version 4.9.2
Fixes #1520
2015-05-26 09:39:49 +02:00
Christian Prochaska 2706e4cd75 tool_chain: cleanup
Fixes #1517
2015-05-26 09:39:49 +02:00
Alexander Boettcher e84284c0cd base: remove shared irq from core
Cleanup commit after all relevant drivers got adapted to use the x86 platform
driver (pci_drv).

Issue #1471
2015-05-26 09:39:47 +02:00
Alexander Boettcher 3783db66e2 base: implement detach for core context_area
Required to destroy threads within in core. Used when IRQs get reused on
platforms where every IRQ needs a thread in core.

Issue #1471
2015-05-26 09:39:47 +02:00
Christian Prochaska 3a378bb970 libc_noux: remove dependency on 'platform_env.h'
Currently, libc_noux includes the 'base/src/base/env/platform_env.h' file
to be able to reinitialize the environment using the 'Platform_env'
interface. For base-linux, a special version of this file exists and the
inclusion of the generic version in libc_noux causes GCC 4.9 to make wrong
assumptions about the memory layout of the 'Env' object returned by
'Genode::env()'.

This commit moves the reinitialization functions to the 'Env' interface to
avoid the need to include the 'platform_env.h' file in libc_noux.

Fixes #1510
2015-05-26 09:39:47 +02:00
Adrian-Ken Rueegsegger 96149db858 base: Add #UD exception to x86_64 Cpu_state 2015-05-20 17:52:59 +02:00
Norman Feske 4736488d99 core: change order of _export_ds and _clear_ds
On seL4, we need to convert untyped memory to page frames before being
able to use it as normal memory. There already exists the hook function
'_export_ds' that is principally suitable for such tasks. It is
currently solely used on Linux where we have to create a file for each
dataspace. To make the hook useful also for seL4, we need to call
_export_ds prior _clear_ds. Otherwise, we would try to clear memory that
is still untyped.
2015-05-20 17:52:57 +02:00
Alexander Boettcher d998df3b7f base: extend irq session to support MSIs
Works on base-nova and base-foc, the other kernels have no MSI support.

Issue #1216
2015-05-20 17:39:14 +02:00
Norman Feske c1cb3a6642 Increase initial block for cxx malloc
This patch avoids the attempt to extend the cxx-local heap during the
startup phase of an application. Originally, the static part of the cxx
was merely 100 bytes, which did not suffice to run the minimalistic test
roottask on seL4.
2015-05-06 11:32:06 +02:00
Norman Feske 89e987b22e base/x86_32: preserve EBX value in crt0 2015-05-06 11:32:06 +02:00
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
Christian Helmuth 98def2488a thread: move Thread_base::myself() to separate file
The thread library (thread.cc) in base-foc shared 95% of the code with
the generic implementation except myself(). Therefore, its
implementation is now separated from the other generic sources into
myself.cc, which allows base-foc to use a foc-specific primitive to
enable our base libraries in L4Linux.

Issue #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
Stefan Kalkowski a168c9d6ce core: remove global capability id counter
The global capability ID counter is not used by NOVA and Fiasco.OC
and in the future not needed by base-hw too. Thereby, remove the static
counter variable from the generic code base and add it where appropriated.

Ref #1443
2015-04-17 16:13:19 +02:00
Stefan Kalkowski 358380046c base: assign allocator and quota to platform pd
Enable platform specific allocations and ram quota accounting for
protection domains. Needed to allocate object identity references
in the base-hw kernel when delegating capabilities via IPC.
Moreover, it can be used to account translation table entries in the
future.

Ref #1443
2015-04-17 16:13:19 +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
Christian Helmuth 0fb5ce0918 base: run mp_server on hw_x86_64 as single core 2015-04-09 16:04:47 +02:00
Norman Feske ea9c2199e8 base: extend emergency dataspace size
The emergency dataspace is used to accommodate the corner case where
a signal context capability is created while issuing the first
resource request. Normally, the attempt to upgrade the signal-session
quota under such a constrained situation would fail. By freeing the
emergency dataspace in this situation, we regain enough quota to
upgrade the signal session.

This is a follow up commit for "base: Raise RAM quota of signal session
to 16K" and fixes the resource_request test on 64-bit platforms.
2015-04-09 16:04:46 +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