#define _KERN_ORB_H
#include <kern/types.h>
+#include <kern/radix.h>
#include <orb.h>
#include <util/list.h>
+#include <util/rbtree.h>
+#include <util/radix.h>
+#include <util/bmaptree.h>
+
#include <System/Objects.h>
namespace Mem {
- class AddrSpace;
+ class ProcAddrSpace;
};
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
CallFrame frames[0];
};
+
+ struct ObjectHdr;
+ struct Object;
+ typedef u32 ID;
+
+ 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;
+ };
+
+ union ObjTableEntry {
+ ObjectHdr hdr;
+ Object obj;
+ ObjectPtr ptr;
+ };
+
+ typedef Util::RadixTree<ObjTableEntry, ID, 6> IDTable;
+ typedef Util::RadixTree<ObjectHdr *, ID, 4> IDRMap;
+ typedef Util::BitmapTree<ID> IDAlloc;
+
+ class IDSpace {
+ // Reverse mapping of object pointers to local IDs
+ IDTable table;
+ IDRMap rmap;
+ IDAlloc alloc;
+
+ public:
+ Object *lookup(u32 id);
+ ObjectHdr *get_local_hdr(Object *obj);
+ Object *newobj(Mem::ProcAddrSpace *aspace, uintptr_t entry);
+ };
}
#endif