mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
nova: use kernel branch adjusted to Genode
Since we have now more than a handful patches to the vanilla kernel, we better switch to a separate git repository in order to review and to maintain the patches more effectively. Remove the patches, they are already in the kernel branch. Fixes #394
This commit is contained in:
parent
f762e8e4fd
commit
08d87adb4b
@ -7,8 +7,9 @@
|
||||
|
||||
VERBOSE ?= @
|
||||
ECHO = @echo
|
||||
GIT_URL = git://github.com/IntelLabs/NOVA.git
|
||||
GIT_REV = 16dd65c15dac298dc5b36d636d79fa0110bd5736
|
||||
GIT_URL = https://github.com/alex-ab/NOVA.git
|
||||
GIT_REV = HEAD
|
||||
GIT_BRANCH = r1
|
||||
CONTRIB_DIR = contrib
|
||||
PATCHES = $(shell find patches -name '*.patch')
|
||||
|
||||
@ -40,7 +41,7 @@ $(CONTRIB_DIR)/.git:
|
||||
$(VERBOSE)git clone $(GIT_URL) $(CONTRIB_DIR)
|
||||
|
||||
$(CONTRIB_DIR): $(CONTRIB_DIR)/.git
|
||||
$(VERBOSE)cd $(CONTRIB_DIR); git reset --hard $(GIT_REV)
|
||||
$(VERBOSE)cd $(CONTRIB_DIR); git reset --hard $(GIT_REV); git checkout $(GIT_BRANCH)
|
||||
$(ECHO) "applying patches to '$(CONTRIB_DIR)/'"
|
||||
$(VERBOSE)for i in $(PATCHES); do patch -d $@ -p1 < $$i; done
|
||||
|
||||
|
@ -1,45 +0,0 @@
|
||||
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);
|
||||
|
@ -1,98 +0,0 @@
|
||||
diff --git a/include/ec.h b/include/ec.h
|
||||
index 10d895c..4442b38 100644
|
||||
--- a/include/ec.h
|
||||
+++ b/include/ec.h
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "tss.h"
|
||||
|
||||
class Utcb;
|
||||
+class Pt;
|
||||
|
||||
class Ec : public Kobject, public Refcount, public Queue<Sc>
|
||||
{
|
||||
@@ -131,6 +132,8 @@ class Ec : public Kobject, public Refcount, public Queue<Sc>
|
||||
regs.REG(ip) = regs.ARG_IP;
|
||||
}
|
||||
|
||||
+ inline mword local_pt_id(const Ec *, const Pt *, const mword);
|
||||
+
|
||||
public:
|
||||
static Ec *current CPULOCAL_HOT;
|
||||
static Ec *fpowner CPULOCAL;
|
||||
diff --git a/include/pt.h b/include/pt.h
|
||||
index 3067914..3883fdd 100644
|
||||
--- a/include/pt.h
|
||||
+++ b/include/pt.h
|
||||
@@ -34,6 +34,7 @@ class Pt : public Kobject
|
||||
Refptr<Ec> const ec;
|
||||
Mtd const mtd;
|
||||
mword const ip;
|
||||
+ Refptr<Pd> const pd;
|
||||
|
||||
Pt (Pd *, mword, Ec *, Mtd, mword);
|
||||
|
||||
diff --git a/src/pt.cpp b/src/pt.cpp
|
||||
index ed5e692..23b9b5c 100644
|
||||
--- a/src/pt.cpp
|
||||
+++ b/src/pt.cpp
|
||||
@@ -25,7 +25,7 @@
|
||||
INIT_PRIORITY (PRIO_SLAB)
|
||||
Slab_cache Pt::cache (sizeof (Pt), 32);
|
||||
|
||||
-Pt::Pt (Pd *own, mword sel, Ec *e, Mtd m, mword addr) : Kobject (PT, static_cast<Space_obj *>(own), sel), ec (e), mtd (m), ip (addr)
|
||||
+Pt::Pt (Pd *own, mword sel, Ec *e, Mtd m, mword addr) : Kobject (PT, static_cast<Space_obj *>(own), sel), ec (e), mtd (m), ip (addr), pd(own)
|
||||
{
|
||||
trace (TRACE_SYSCALL, "PT:%p created (EC:%p IP:%#lx)", this, e, ip);
|
||||
}
|
||||
diff --git a/src/syscall.cpp b/src/syscall.cpp
|
||||
index 564e249..e0286fb 100644
|
||||
--- a/src/syscall.cpp
|
||||
+++ b/src/syscall.cpp
|
||||
@@ -31,6 +31,29 @@
|
||||
#include "utcb.h"
|
||||
#include "vectors.h"
|
||||
|
||||
+mword Ec::local_pt_id(const Ec * ec, const Pt * pt, const mword pt_sel)
|
||||
+{
|
||||
+ if (EXPECT_FALSE (ec->pd != pt->pd)) {
|
||||
+ Crd crd = Crd(Crd::OBJ, pt_sel, 0);
|
||||
+ ec->pd->xlt_crd(Pd::current, Crd(Crd::OBJ, 0), crd);
|
||||
+ if (crd.type() == Crd::OBJ) {
|
||||
+ // Doesn't work, since Space_obj is only local to a pd available
|
||||
+ //Kobject *local_obj = ec->pd->Space_obj::lookup(crd.base()).obj();
|
||||
+ //trace(0, "kobject %u", local_obj->type());
|
||||
+ return crd.base();
|
||||
+ } else {
|
||||
+ trace(0, "----- pt=%lx ec=%lx %p?=%p, call: %p:%#lx->%p:?",
|
||||
+ pt->node_base, ec->node_base,
|
||||
+ &*ec->pd, &*pt->pd,
|
||||
+ Pd::current, pt_sel,
|
||||
+ &*ec->pd);
|
||||
+ trace(0, "base:order:attr type - %#lx:%#x:%#x %u", crd.base(), crd.order(), crd.attr(), crd.type());
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ return pt->node_base;
|
||||
+}
|
||||
+
|
||||
template <Sys_regs::Status T>
|
||||
void Ec::sys_finish()
|
||||
{
|
||||
@@ -93,7 +116,7 @@ void Ec::send_msg()
|
||||
current->set_partner (ec);
|
||||
current->regs.mtd = pt->mtd.val;
|
||||
ec->cont = recv_kern;
|
||||
- ec->regs.set_pt (pt->node_base);
|
||||
+ ec->regs.set_pt (ec->local_pt_id(ec, pt, current->evt + r->dst_portal));
|
||||
ec->regs.set_ip (pt->ip);
|
||||
ec->make_current();
|
||||
}
|
||||
@@ -122,7 +147,7 @@ void Ec::sys_call()
|
||||
current->set_partner (ec);
|
||||
ec->cont = recv_user;
|
||||
ec->regs.set_ip (pt->ip);
|
||||
- ec->regs.set_pt (pt->node_base);
|
||||
+ ec->regs.set_pt (ec->local_pt_id(ec, pt, s->pt()));
|
||||
ec->make_current();
|
||||
}
|
||||
|
@ -1,48 +0,0 @@
|
||||
diff --git a/include/space_mem.h b/include/space_mem.h
|
||||
index e155dad..224917c 100644
|
||||
--- a/include/space_mem.h
|
||||
+++ b/include/space_mem.h
|
||||
@@ -70,6 +70,8 @@ class Space_mem : public Space
|
||||
|
||||
bool insert_utcb (mword);
|
||||
|
||||
+ bool remove_utcb (mword);
|
||||
+
|
||||
void update (Mdb *, mword = 0);
|
||||
|
||||
static void shootdown();
|
||||
diff --git a/src/space_mem.cpp b/src/space_mem.cpp
|
||||
index 5341836..bcae116 100644
|
||||
--- a/src/space_mem.cpp
|
||||
+++ b/src/space_mem.cpp
|
||||
@@ -146,3 +146,17 @@ bool Space_mem::insert_utcb (mword b)
|
||||
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+bool Space_mem::remove_utcb (mword b)
|
||||
+{
|
||||
+ if (!b)
|
||||
+ return false;
|
||||
+
|
||||
+ Mdb *mdb = tree_lookup(b >> PAGE_BITS, false);
|
||||
+ if (!tree_remove (mdb))
|
||||
+ return false;
|
||||
+
|
||||
+ delete mdb;
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
diff --git a/src/syscall.cpp b/src/syscall.cpp
|
||||
index 564e249..13f1134 100644
|
||||
--- a/src/syscall.cpp
|
||||
+++ b/src/syscall.cpp
|
||||
@@ -254,6 +277,8 @@ void Ec::sys_create_ec()
|
||||
|
||||
if (!Space_obj::insert_root (ec)) {
|
||||
trace (TRACE_ERROR, "%s: Non-NULL CAP (%#lx)", __func__, r->sel());
|
||||
+ if (!pd->remove_utcb(r->utcb()))
|
||||
+ trace (TRACE_ERROR, "%s: Cannot remove UTCB", __func__);
|
||||
delete ec;
|
||||
sys_finish<Sys_regs::BAD_CAP>();
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
diff --git a/src/pd.cpp b/src/pd.cpp
|
||||
index 8160d73..be6fd41 100644
|
||||
--- a/src/pd.cpp
|
||||
+++ b/src/pd.cpp
|
||||
@@ -167,6 +167,20 @@ void Pd::xlt_crd (Pd *pd, Crd xlt, Crd &crd)
|
||||
if ((ro = clamp (node->node_base, rb, node->node_order, ro)) != ~0UL)
|
||||
break;
|
||||
|
||||
+ if (!node) {
|
||||
+ /* Special handling on Genode:
|
||||
+ * If a translate of an item inside the same PD (receiver/sender in same PD)
|
||||
+ * are of no success, then return the very same item.
|
||||
+ */
|
||||
+ Mdb *first = snd->tree_lookup (crd.base());
|
||||
+ if (first && first->space == rcv && first == mdb) {
|
||||
+ rb = xlt.base();
|
||||
+ ro = xlt.order();
|
||||
+ if ((ro = clamp (first->node_base, rb, first->node_order, ro)) != ~0UL)
|
||||
+ node = first;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (node) {
|
||||
|
||||
so = clamp (mdb->node_base, sb, mdb->node_order, so);
|
@ -1,48 +0,0 @@
|
||||
diff --git a/src/pd.cpp b/src/pd.cpp
|
||||
index 8160d73..be9aa63 100644
|
||||
--- a/src/pd.cpp
|
||||
+++ b/src/pd.cpp
|
||||
@@ -173,6 +173,7 @@ void Pd::xlt_crd (Pd *pd, Crd xlt, Crd &crd)
|
||||
sb = (sb - mdb->node_base) + (mdb->node_phys - node->node_phys) + node->node_base;
|
||||
|
||||
if ((ro = clamp (sb, rb, so, ro)) != ~0UL) {
|
||||
+ trace (TRACE_DEL, "XLT OBJ PD:%p->%p SB:%#010lx RB:%#010lx O:%#04lx", pd, this, crd.base(), rb, so);
|
||||
crd = Crd (crd.type(), rb, ro, mdb->node_attr);
|
||||
return;
|
||||
}
|
||||
@@ -245,22 +246,32 @@ void Pd::rev_crd (Crd crd, bool self)
|
||||
|
||||
void Pd::xfer_items (Pd *src, Crd xlt, Crd del, Xfer *s, Xfer *d, unsigned long ti)
|
||||
{
|
||||
- for (Crd crd; ti--; s--) {
|
||||
+ mword set_as_del;
|
||||
|
||||
+ for (Crd crd; ti--; s--) {
|
||||
+
|
||||
crd = *s;
|
||||
+ set_as_del = 0;
|
||||
|
||||
- switch (s->flags() & 1) {
|
||||
+ switch (s->flags() & 3) {
|
||||
|
||||
case 0:
|
||||
xlt_crd (src, xlt, crd);
|
||||
break;
|
||||
|
||||
+ case 2:
|
||||
+ xlt_crd (src, xlt, crd);
|
||||
+ if (crd.type()) break;
|
||||
+
|
||||
+ crd = *s;
|
||||
+ set_as_del = 1;
|
||||
+
|
||||
case 1:
|
||||
del_crd (src == &root && s->flags() & 0x800 ? &kern : src, del, crd, s->flags() >> 9 & 3, s->hotspot());
|
||||
break;
|
||||
};
|
||||
|
||||
if (d)
|
||||
- *d-- = Xfer (crd, s->flags());
|
||||
+ *d-- = Xfer (crd, s->flags() | set_as_del);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user