]> git.buserror.net Git - polintos/scott/priv.git/blobdiff - kernel/include/kern/orb.h
Lots of stuff.
[polintos/scott/priv.git] / kernel / include / kern / orb.h
index 7618dc72e725d0b138cb079f1a5ee32b14334d3a..dc832c385c1566d0e8122c389408eea6e1d1522b 100644 (file)
@@ -5,10 +5,11 @@
 #include <orb.h>
 
 #include <util/list.h>
+#include <util/rbtree.h>
 #include <System/Objects.h>
 
 namespace Mem {
-       class AddrSpace;
+       class ProcAddrSpace;
 };
 
 namespace Threads {
@@ -16,11 +17,11 @@ namespace Threads {
 };
 
 namespace ORB {
-       typedef ulong ID;
+       typedef u32 ID;
 
        struct CallFrame {
                // Address Space and PC to return to
-               Mem::AddrSpace *ret_aspace;
+               Mem::ProcAddrSpace *ret_aspace;
                ulong ret_pc;
                
                // Caller's PIB Pointer
@@ -49,6 +50,42 @@ namespace ORB {
                
                CallFrame frames[0];
        };
+       
+       struct ObjectHdr;
+       struct Object;
+       
+       typedef Util::RBTree<ObjectHdr, Object *, Object *> IDRMap;
+
+       struct ObjectHdr {
+               IDRMap::Node rbtree_node;
+               u32 id;
+
+               union {
+                       struct {
+                               u32 Pointer:1;
+                       };
+                       
+                       u32 flags;
+               };
+       };
+       
+       struct Object : public ObjectHdr {
+               Mem::ProcAddrSpace *aspace;
+               uintptr_t entry;
+       };
+
+       struct ObjectPtr : public ObjectHdr {
+               Object *object;
+       };
+
+       class IDSpace {
+               // Reverse mapping of object pointers to local IDs
+               IDRMap id_rmap;
+       
+       public:
+               Object *lookup(u32 id);
+               u32 rlookup(Object *obj);
+       };
 }
 
 #endif