genode/base-nova/patches/del_able_utcb.patch
Alexander Boettcher 6862ab481a NOVA: drop special utcb handling of main thread
Unify handling of UTCBs. The utcb of the main thread is with commit
ea38aad30e 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.

Kernel patch: make utcb map-able
With the patch the Utcb of the main thread of Core is map-able.

Fixes #374

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.
2012-10-04 14:35:38 +02:00

46 lines
1.3 KiB
Diff

diff --git a/src/ec.cpp b/src/ec.cpp
index 5d5a66c..a69cfef 100644
--- a/src/ec.cpp
+++ b/src/ec.cpp
@@ -64,6 +64,8 @@ Ec::Ec (Pd *own, mword sel, Pd *p, void (*f)(), unsigned c, unsigned e, mword u,
trace (TRACE_SYSCALL, "EC:%p created (PD:%p CPU:%#x UTCB:%#lx ESP:%lx EVT:%#x)", this, p, c, u, s, e);
+ pd->insert_utcb (u, Buddy::ptr_to_phys(utcb) >> 12);
+
} else {
regs.dst_portal = NUM_VMI - 2;
diff --git a/src/space_mem.cpp b/src/space_mem.cpp
index 5341836..60e2fdc 100644
--- a/src/space_mem.cpp
+++ b/src/space_mem.cpp
@@ -132,12 +132,12 @@ void Space_mem::insert_root (uint64 s, uint64 e, mword a)
}
}
-bool Space_mem::insert_utcb (mword b)
+bool Space_mem::insert_utcb (mword b, mword phys)
{
if (!b)
return true;
- Mdb *mdb = new Mdb (this, 0, b >> PAGE_BITS, 0);
+ Mdb *mdb = new Mdb (this, phys, b >> PAGE_BITS, 0, 0x3);
if (tree_insert (mdb))
return true;
diff --git a/include/space_mem.h b/include/space_mem.h
index e155dad..1584395 100644
--- a/include/space_mem.h
+++ b/include/space_mem.h
@@ -68,7 +68,7 @@ class Space_mem : public Space
INIT
void insert_root (uint64, uint64, mword = 0x7);
- bool insert_utcb (mword);
+ bool insert_utcb (mword, mword = 0);
void update (Mdb *, mword = 0);