X-Git-Url: http://git.buserror.net/cgi-bin/gitweb.cgi?p=polintos%2Fscott%2Fpriv.git;a=blobdiff_plain;f=include%2Fc%2B%2B%2Forb.h;h=1078555f625a9d33727365f138a8ac3db636cf9f;hp=87bcd246ca713ed6f024bc948144517d6a9be8ed;hb=1ac390fe1e18444008857b056c947710be9621a8;hpb=b4bfc871337ca32ce83407916a87db2524729ca9 diff --git a/include/c++/orb.h b/include/c++/orb.h index 87bcd24..1078555 100644 --- a/include/c++/orb.h +++ b/include/c++/orb.h @@ -25,15 +25,10 @@ namespace System { ORBMM(); - void *alloc(size_t size, AllocGroup *group = NULL); - - void retain(Region region); - void release(Region region); - void super_retain(Region region); - void super_release(Region region); - AllocGroup *create_group(); - void destroy_group(AllocGroup *group); - void *add_region(Region region); + void *alloc(size_t size, int refs = 1); + void retain(void *ptr, int refs = 1); + void release(void *ptr, int refs = 1); + void add_region(Region region, bool unmap_orig, int refs = 1); }; extern ORBMM *orbmm; @@ -283,30 +278,61 @@ namespace System { struct ParamInfoBlock { uintptr_t buffer_size; - uintptr_t *objlist_ptr; + uintptr_t copy_size; + uintptr_t *objlist; uintptr_t objlist_len; uintptr_t num_segments; struct Segment { - void *ptr; + unsigned char *ptr; uintptr_t len; uintptr_t flags; uintptr_t reserved; + + enum { + In = 1, + Out = 2, + Inline = 4, + Copy = 8 + }; } segments[0]; }; } + + namespace Priv { + static inline bool in_kernel() + { +#ifdef _KERNEL + return true; +#else + return false; +#endif + } + }; } inline void *operator new(size_t len, ::System::RunTime::ORBMM *orbmm, - ::System::RunTime::ORBMM::AllocGroup *group = NULL) + int refs = 1) { - return orbmm->alloc(len, group); + return orbmm->alloc(len, refs); } inline void *operator new[](size_t len, ::System::RunTime::ORBMM *orbmm, - ::System::RunTime::ORBMM::AllocGroup *group = NULL) + int refs = 1) +{ + return orbmm->alloc(len, refs); +} + +inline void operator delete(void *ptr, ::System::RunTime::ORBMM *orbmm, + int refs = 1) +{ + orbmm->release(ptr, refs); +} + +inline void operator delete[](void *ptr, ::System::RunTime::ORBMM *orbmm, + int refs = 1) { - return orbmm->alloc(len, group); + orbmm->release(ptr, refs); } // This is a macro rather than an inline template function so that the @@ -316,9 +342,6 @@ inline void *operator new[](size_t len, ::System::RunTime::ORBMM *orbmm, // // To throw an IDL exception of type Foo, do this: // throw_idl(Foo, args, to, foo); -// -// FIXME: Instead, maybe a static throw method with noinline and -// builtin_return_address. #ifndef POLINTOS_NO_THROW_IDL #define throw_idl(T, args...) do { \ @@ -326,7 +349,7 @@ inline void *operator new[](size_t len, ::System::RunTime::ORBMM *orbmm, new(::System::RunTime::orbmm) \ ::System::Exceptions::NativeCodeExceptionOriginInfo \ (::System::RunTime::get_pc()), \ - _KERNEL ? 1 : 0, ##args); \ + ::System::Priv::in_kernel(), ##args); \ } while (0) #define rethrow_idl(oldex, T, args...) do { \ @@ -334,7 +357,7 @@ inline void *operator new[](size_t len, ::System::RunTime::ORBMM *orbmm, new(::System::RunTime::orbmm) \ ::System::Exceptions::NativeCodeExceptionOriginInfo \ (::System::RunTime::get_pc()), \ - _KERNEL ? 1 : 0, ##args); \ + ::System::Priv::in_kernel(), ##args); \ } while (0) #endif