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=31348f2227a3f6680ac31e8ce281c464468ea32b;hp=87bcd246ca713ed6f024bc948144517d6a9be8ed;hb=e4560eb81e14ff6ce67752591ea63ad58bfc45be;hpb=9a0f3d7f714ebabb437c30863548146b307527b7 diff --git a/include/c++/orb.h b/include/c++/orb.h index 87bcd24..31348f2 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,6 +278,7 @@ namespace System { struct ParamInfoBlock { uintptr_t buffer_size; + uintptr_t copy_size; uintptr_t *objlist_ptr; uintptr_t objlist_len; uintptr_t num_segments; @@ -295,18 +291,41 @@ namespace System { } segments[0]; }; } + + namespace Priv { + 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, group); + 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) +{ + orbmm->release(ptr, refs); } // This is a macro rather than an inline template function so that the @@ -316,9 +335,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 +342,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 +350,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