]> git.buserror.net Git - polintos/scott/priv.git/commitdiff
ORBMM changes and other stuff
authorScott Wood <scott@buserror.net>
Wed, 11 Apr 2007 23:57:04 +0000 (18:57 -0500)
committerScott Wood <scott@buserror.net>
Wed, 11 Apr 2007 23:57:04 +0000 (18:57 -0500)
include/c++/orb.h

index 87bcd246ca713ed6f024bc948144517d6a9be8ed..31348f2227a3f6680ac31e8ce281c464468ea32b 100644 (file)
@@ -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