X-Git-Url: http://git.buserror.net/cgi-bin/gitweb.cgi?p=polintos%2Fscott%2Fpriv.git;a=blobdiff_plain;f=kernel%2Finclude%2Fkern%2Forb.h;h=f9654341589af29f27fb95ff5de3c62b54e2af76;hp=7618dc72e725d0b138cb079f1a5ee32b14334d3a;hb=1ac390fe1e18444008857b056c947710be9621a8;hpb=7da27a216a7f4bb3331fe315cdbec69bfcf2c762 diff --git a/kernel/include/kern/orb.h b/kernel/include/kern/orb.h index 7618dc7..f965434 100644 --- a/kernel/include/kern/orb.h +++ b/kernel/include/kern/orb.h @@ -2,13 +2,19 @@ #define _KERN_ORB_H #include -#include +#include +#include #include +#include +#include +#include + #include +#include namespace Mem { - class AddrSpace; + class ProcAddrSpace; }; namespace Threads { @@ -16,22 +22,15 @@ namespace Threads { }; namespace ORB { - typedef ulong ID; + typedef u32 ID; struct CallFrame { // Address Space and PC to return to - Mem::AddrSpace *ret_aspace; - ulong ret_pc; + Mem::ProcAddrSpace *ret_aspace; + 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 { @@ -49,6 +48,53 @@ namespace ORB { CallFrame frames[0]; }; + + struct ObjectHdr { + ID id; + + union { + struct { + u32 Valid:1; + u32 Pointer:1; + }; + + u32 flags; + }; + }; + + struct Object : public ObjectHdr { + Mem::ProcAddrSpace *aspace; + }; + + struct ObjectPtr : public ObjectHdr { + Object *object; + }; + + union ObjTableEntry { + ObjectHdr hdr; + Object obj; + ObjectPtr ptr; + }; + + typedef Util::RadixTree IDTable; + typedef Util::RBPtr IDRMap; + typedef Util::BitmapTree IDAlloc; + + class IDSpace { + Lock::SpinLock lock; // For add/del only; not needed for lookup + IDTable table; // Forward mapping of local IDs to object ptrs + 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(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