Free up sm kernel objects
Free up ec kernel objects (w/o utcb, w/o vCPU)

+ initialize all ec object members to avoid bugs
+ free up memory of fpu objects

- free up of Utcb of normal Ec missing
- free up of vCPU Ec missing
Free up memory of utcb
Free up vCPU ec kernel objects
Free up pd kernel objects
Revoke left over mappings before destruction of pd
Free up left over pte entries of a pd
Remove utcb if ec creation failed

Original Genode commit (a6d2042d5b83730e6c2c0912da5dddfc103a4b75)
Bugfix: avoid assertion by checking sc priority

Kernel fails if Sc priority is higher/equal to the maximum (128 currently)
Sc refinement - Genode specific

Delete SC solely, if it is running in the context of its associated EC.

Pro: Avoid deadlocks if a worker EC holds a lock and looses the SC it gets
     runtime from. If never ever a new SC is helping the worker EC, the lock
     is never freed up. Another worker EC trying to get the very same lock
     will get be stucked forever.

Con: A global EC can manage to prevent that the SC gets deleted inside the
     kernel by not running the SC in the context of the global EC.
	 (e.g. a worker thread that would never reply to the global thread).
Add transfer type 'delegate-if-translate-failed'

Original Genode commit (2b161b7aff9cbfa2783487f7dceeb881919e15a4):

Kernel patch:
Introduce a transfer item type to express that a cap should be translated
and if this fails to map it instead.

It would be possible without this combined transfer item type however
with additional complexity. In this case Genode/NOVA would
have to map and translate all caps used as parameter in IPC. It would look
like this:
* If the map and translation succeed, the cap at the new cap index
  would have to be revoked. Then the translated cap index can be used.
* If the map succeeds and the translation fails then the mapped cap index
  can be used.
* It would become complicated when multiple caps are mapped and translated
  and only some of the translation succeed. In such cases Genode would have
  to figure out the right relation of translated/mapped and not
  translated/mapped caps. It would require to make some assumption about the
  order how translated/mapped caps are reported at the UTCB by the kernel.
All the points above lead to the decision to create a separate transfer item
type for that.

Genode:
Most the times the translation succeeds, mapping of caps happens either
seldom. This takes now a bit the pressure of not enough aligned receive
cap windows as described in issue 247.

Genode issue 268
Translate: return last valid capability

Original Genode commit (54ed3734680e130fa9330a920960f07530dce62b):

Unfortunately, another kernel patch is required for Genode/NOVA to get rid
of global unique ids for objects (Genode issue 268).

Kernel patch:

If a translate of a object capability item inside the same PD
(receiver/sender in same PD) is not successful then the very same item is
returned instead of the null item.

Genode:

Some code in Genode try to map/translate the "root" (the first instance of a)
object capability within the same PD. The translate fails since it is the
first cap and was not delegated beforehand. Instead the cap gets mapped to a
new capability index due to 'delegate-if-translate-failed" kernel item patch.

The new local object capability index is used to lookup manged objects
in lists, which however fails because the object is only known by the original
object capability index.

Unfortunately, this happens not only once. Below one example trace and
description is attached.

There are several possible solutions possible:
* Find all places in Genode and replace normal function calls between objects
   with IPC calls, such that all capabilities can be translated during IPC.
** Time consuming to find all spots
** Rather platform specific issue requires re-adjustments in generic Genode
   code
** Not trivial to ever remember this fact during development of new components
   [other platforms have not such a issue, however have global object ids]
** Neither good in terms of performance.

* Use some special system call to the kernel to be able to translate a given
  capability index as long until you find the requested original index.

* Kernel patch as this one.

* <your proposal>

Example trace + code description showing the behavior above:

int main(): --- create local services ---
int main(): --- start init ---
[0] DEL OBJ PD:0xc000aa80->0xc000aa80 SB:0x000000aa RB:0x000000ac O:0x00 A:0x1f
int main(): transferred 42 MB to init
[0] DEL OBJ PD:0xc000aa80->0xc000aa80 SB:0x00000120 RB:0x0000013c O:0x00 A:0x1f
[0] DEL OBJ PD:0xc000aa80->0xc000aa80 SB:0x0000016c RB:0x00000168 O:0x00 A:0x1f
Setup ELF failed
[0] XLT OBJ PD:0xc000aa80->0xc000aa80 SB:0x00000168 RB:0x0000016c O:0x00
unknown exception?
int main(): --- init created, waiting for exit condition ---

thread   - file - line - text
-------------------------------------------------------------------------------
thread A - [ 0] -  228 - new Core_child(... rom_session.dataspace() ...)
thread A - [ 1] -   27 - IPC call    - ask for dataspace cap
thread B - [ 2] -   49 - function    - return dataspace cap index 0x120
thread A - [ 1] -   27 - IPC returned - map 0x120 -> 0x13c, translate failed
thread A - ...
thread A - [ 3] -  231 - call _setup_elf()
thread A - [ 3] -   60 - call env->rm_session()->attach()
thread A - [ 4] -   35 - do dataspace object lookup (0x13c)
thread A - [ 4] -   36 - lookup failed (object known as 0x120), throw Exception
thread A - [ 3] -   61 - catch Exception -> return error code "0"
thread A - [ 3] -  233 - "Setup ELF failed" - because error code "0"

File legend:

[0] base/src/core/main.cc
[1] base/include/rom_session/client.h
[2] base-nova/src/core/include/core_rm_session.h
[3] base/src/base/process/process.cc
[4] base-nova/src/core/core_rm_session.cc
Make utcb of first thread in root task map-able

With the patch the utcb of the main thread of Core is map able.

Original Genode commit (6862ab481a520b8a1686b611be76b9e72bbb9ebc):

Unify handling of UTCBs. The utcb of the main thread is with commit
ea38aad at a fixed location - per convention.
So we can remove all the ugly code to transfer the utcb address during process
creation.

To do so also the UTCB of the main thread of Core must be inside Genode's
thread context area to handle it the same way. Unfortunately the UTCB of the
main thread of Core can't be chosen, it is defined by the kernel.

Possible solutions:
- make virtual address of first thread UTCB configurable in hypervisor
- map the utcb of the first thread inside Core to the desired location

This commit implements the second option.

Noux actually uses the sp variable during thread creation and expects to be
set accordingly. This wasn't the case for the main thread, it was ever set
to the address of the main thread UTCB.
show EC 'die' messages when TRACE_ERROR is set
Increase kernel memory to 32M by default

At least on 64bit otherwise Genode/Noux has no chance to finish.
Use pd obj provided as parameter during assign_pci
Add support for cross CPU IPC
Set idle timeout to CPUs to 100ms

The grace period of RCU is dominated by idle CPUs if other CPUs are heavily
destroying kernel objects. This causes the kernel to run out-of-memory, just
because it can't free up the kernel objects quick enough. Seen for building
Genode on Genode (Noux using gcc and make).
Take care to wipe mappings of pd under destruction
Use remove_utcb during ec destruction