]> git.buserror.net Git - polintos/scott/priv.git/blobdiff - kernel/include/kern/orb.h
Random stuff.
[polintos/scott/priv.git] / kernel / include / kern / orb.h
index e420fc77e11f72e10597797808a6146b36288f49..22664ec2d006dac80c92d67ce6dae7a24939c4e5 100644 (file)
@@ -3,11 +3,15 @@
 
 #include <kern/types.h>
 #include <kern/radix.h>
-#include <orb.h>
+#include <kern/lock.h>
 
 #include <util/list.h>
 #include <util/rbtree.h>
+#include <util/radix.h>
+#include <util/bmaptree.h>
+
 #include <System/Objects.h>
+#include <orb.h>
 
 namespace Mem {
        class ProcAddrSpace;
@@ -23,17 +27,10 @@ namespace ORB {
        struct CallFrame {
                // Address Space and PC to return to
                Mem::ProcAddrSpace *ret_aspace;
-               ulong ret_pc;
+               uintptr_t ret_stack;
                
                // Caller's PIB Pointer
                System::RunTime::ParamInfoBlock *caller_user_pib;
-               
-               // Object and Method that were called -- it probably isn't strictly
-               // necessary to keep track of this here, but it'd help in doing a
-               // "traceforward" of the method invocation stack in order to
-               // debug a stalled method call.
-               
-               ID object, method;
        };
        
        struct CallStackHeader {
@@ -51,42 +48,41 @@ namespace ORB {
                
                CallFrame frames[0];
        };
-       
-       struct ObjectHdr;
-       struct Object;
-       
-       typedef u32 ID;
-       typedef Util::RadixTree<ObjectHdr, ID> IDRMap;
 
+       static const ID invalid_id = 0xffffffff;
        struct ObjectHdr {
                ID id;
-
-               union {
-                       struct {
-                               u32 Pointer:1;
-                       };
-                       
-                       u32 flags;
-               };
        };
        
        struct Object : public ObjectHdr {
                Mem::ProcAddrSpace *aspace;
-               uintptr_t entry;
        };
 
        struct ObjectPtr : public ObjectHdr {
                Object *object;
        };
+       
+       typedef Util::RadixTree<Object, ID, 6> LocalIDTable;
+       typedef Util::RadixTree<ObjectPtr, ID, 6> RemoteIDTable;
+       typedef Util::RBPtr<Object *, ObjectPtr *> IDRMap;
+       typedef Util::BitmapTree<ID> IDAlloc;
 
        class IDSpace {
-               // Reverse mapping of object pointers to local IDs
-               IDRMap idrmap;
+               Lock::SpinLock lock; // For add/del only; not needed for lookup
+               LocalIDTable locals; // Objects that live in this address space
+               RemoteIDTable remotes; // Objects that live in other address spaces
+               IDRMap rmap; // Reverse mapping of remote object pointers to local IDs
+               IDAlloc alloc; // Bitmap for allocating IDs
        
        public:
                Object *lookup(u32 id);
-               ObjectHdr *get_local_hdr(Object *obj);
+               ObjectHdr *get_local(Object *obj);
+               Object *newobj(Mem::ProcAddrSpace *aspace);
        };
+       
+       void invoke_method(System::RunTime::ParamInfoBlock *pib, uintptr_t &stack);
+       uintptr_t return_from_method(uintptr_t &exptr, size_t &exlen);
+       void init();
 }
 
 #endif