cpp_output_name(file, t);
if (array)
- file << ">";
+ file << ", ::System::RunTime::ORBMM>";
file << ' ';
}
}
if (is_array(t))
- file << '>';
+ file << ", ::System::RunTime::ORBMM>";
file << ' ';
}
case trav_nsdecl:
extra_newline();
- file << indent << "int _marshall(::System::RunTime::GrowableArray<uint8_t> &buf,\n"
- << indent << " ::System::RunTime::GrowableArray< ::System::RunTime::ID> &objlist,\n"
- << indent << " ::System::RunTime::GrowableArray< ::System::RunTime::NewObject> &newobjlist,\n"
+ file << indent << "int _marshall(::System::RunTime::GrowableArray<uint8_t, ::System::RunTime::ORBMM> &buf,\n"
+ << indent << " ::System::RunTime::GrowableArray< ::System::RunTime::ID, ::System::RunTime::ORBMM> &objlist,\n"
+ << indent << " ::System::RunTime::GrowableArray< ::System::RunTime::NewObject, ::System::RunTime::ORBMM> &newobjlist,\n"
<< indent << " ::System::RunTime::ParamInfoBlock::Segment *segs,\n"
<< indent << " int nsegs);\n";
- file << indent << "void _unmarshall(::System::RunTime::Array<uint8_t> buf,\n"
- << indent << " ::System::RunTime::Array< ::System::_i_Object *> objlist,\n"
+ file << indent << "void _unmarshall(::System::RunTime::Array<uint8_t, ::System::RunTime::ORBMM> buf,\n"
+ << indent << " ::System::RunTime::Array< ::System::_i_Object *, ::System::RunTime::ORBMM> objlist,\n"
<< indent << " ::System::RunTime::ParamInfoBlock::Segment *segs,\n"
<< indent << " int nsegs);\n";
using namespace System::IO::FileStream_ns;
using System::RunTime::Array;
using System::RunTime::MutableArray;
-
+using System::RunTime::ORBMM;
namespace Stuff {
using System::Notifiers::Notifier;
f.size(size);
}
- void read(Array<uint8_t> *buf, uint64_t *len)
+ void read(Array<uint8_t, ORBMM> *buf, uint64_t *len)
{
if (!f) {
// throw exc
pos += *len;
}
- void read_foo(MutableArray<uint8_t> buf, uint64_t len, Notifier n)
+ void read_foo(MutableArray<uint8_t, ORBMM> buf, uint64_t len, Notifier n)
{
if (!f) {
// throw exc
pos += len;
}
- void write(Array<uint8_t> buf, uint64_t *len)
+ void write(Array<uint8_t, ORBMM> buf, uint64_t *len)
{
if (!f) {
// throw exc
pos += *len;
}
- void write_foo(Array<uint8_t> buf, uint64_t len, Notifier n)
+ void write_foo(Array<uint8_t, ORBMM> buf, uint64_t len, Notifier n)
{
printf("write_foo, this %p\n", this);
}
printf("fs is %p\n", (void *)fs);
- fs.write_async(Array<uint8_t>(NULL, 0), 0, NULL);
+ fs.write_async(nullarray, 0, NULL);
printf("fs is %p\n", (void *)fs);
System::IO::OStream ostr = fs;
printf("ostr is %p\n", (void *)ostr);
- ostr.write_async(Array<uint8_t>(NULL, 0), 0, NULL);
+ ostr.write_async(nullarray, 0, NULL);
System::Object obj = fs;
System::IO::FileStream fs2 = System::IO::FileStream::downcast(obj);
System::IO::OStream os2 = System::IO::OStream::downcast(obj);
struct methods {
void (*read)(::System::IO::_i_IStream *_this,
- Array<char> *buf, uint64_t *len);
+ Array<char, ::System::RunTime::ORBMM> *buf, uint64_t *len);
void (*read_async)(::System::IO::_i_IStream *_this,
- Array<unsigned char> *buf,
+ Array<unsigned char, ::System::RunTime::ORBMM> *buf,
::System::Notifier *notifier);
} methods;
} info;
struct methods {
void (*read)(::System::IO::_i_IStream *_this,
- Array<char> *buf, uint64_t *len);
+ Array<char, ::System::RunTime::ORBMM> *buf, uint64_t *len);
void (*read_async)(::System::IO::_i_IStream *_this,
- Array<unsigned char> *buf,
+ Array<unsigned char, ::System::RunTime::ORBMM> *buf,
::System::Notifier *notifier);
void (*write)(::System::IO::_i_OStream *_this, unsigned char *buf,
#include <lowlevel/barriers.h>
#include <lowlevel/bitops.h>
+#include <util/array.h>
+
namespace System {
struct _i_Object;
}
namespace RunTime {
+ using namespace ::Util::Arrays;
+
class ORBMM {
- void *priv;
+ static void *priv;
public:
- class AllocGroup {
- friend class ORBMM;
- };
-
typedef ::System::Mem::Region Region;
- ORBMM();
-
- 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;
-
- // FIXME: should be an IDL exception
- struct ArrayException
- {
- };
-
- class NullArray {
- };
-
- static const NullArray nullarray = {};
-
- template<typename T> struct MutableArray {
- T *ptr;
- size_t count;
-
- bool valid_index(size_t index)
- {
- return index >= 0 && index < count;
- }
-
- T &operator[](size_t index)
- {
-#ifndef POLINTOS_NO_ARRAY_BOUNDS_CHECK
- if (!valid_index(index))
- throw ArrayException();
-#endif
-
- return ptr[index];
- }
-
- MutableArray()
- {
- ptr = NULL;
- count = 0;
- }
-
- MutableArray(NullArray na)
- {
- ptr = NULL;
- count = 0;
- }
-
- MutableArray(T *PTR, size_t COUNT)
- {
- ptr = PTR;
- count = COUNT;
- }
-
- MutableArray &slice_nocheck(size_t first, size_t newcount)
- {
- MutableArray ret;
- ret.ptr = ptr + first;
- ret.count = newcount;
- return ret;
- }
-
- MutableArray &slice_nocheck(size_t first)
- {
- MutableArray ret;
- ret.ptr = ptr + first;
- ret.count = count - first;
- return ret;
- }
-
- MutableArray &slice(size_t first, size_t count)
- {
-#ifndef POLINTOS_NO_ARRAY_BOUNDS_CHECK
- if (!valid_index(first) || !valid_index(first + count - 1))
- throw ArrayException();
-#endif
-
- return slice_nocheck(first, count);
- }
-
- MutableArray &slice(size_t first)
- {
-#ifndef POLINTOS_NO_ARRAY_BOUNDS_CHECK
- if (!valid_index(first))
- throw ArrayException();
-#endif
-
- return slice_nocheck(first);
- }
-
- MutableArray copy()
- {
- MutableArray new_arr;
- new_arr.ptr = new(orbmm) T[count];
- new_arr.count = count;
- memcpy(new_arr.ptr, ptr, count);
- return new_arr;
- }
- };
-
- template<typename T>
- struct GrowableArray : public MutableArray<T> {
- using MutableArray<T>::ptr;
- using MutableArray<T>::count;
- size_t bufsize;
-
- GrowableArray()
- {
- bufsize = 0;
- }
-
- GrowableArray(NullArray na) : MutableArray<T>(na)
- {
- bufsize = 0;
- }
-
- GrowableArray(T *PTR, size_t COUNT) : MutableArray<T>(PTR, COUNT)
- {
- bufsize = COUNT;
- }
-
- GrowableArray(T *PTR, size_t COUNT, size_t BUFSIZE) :
- MutableArray<T>(PTR, COUNT)
- {
- bufsize = BUFSIZE;
- }
-
- GrowableArray(MutableArray<T> &ma) : MutableArray<T>(ma)
- {
- bufsize = count;
- }
-
- void grow(size_t newsize)
- {
- if (newsize <= bufsize)
- return;
-
- T *oldptr = ptr;
- T *newptr = new(orbmm) T[newsize];
- memcpy(newptr, ptr, count * sizeof(T));
- ptr = newptr;
- ll_smp_membar_store_after_store();
- bufsize = newsize;
- // FIXME: Should release imply membar?
- ll_smp_membar_any_after_store();
- orbmm->release(oldptr);
- }
-
- // Caller must sync against all writers.
- void append(T *newptr, size_t len, size_t max = ULONG_MAX)
- {
- if (count + len < count)
- throw ArrayException();
-
- if (count + len > max)
- throw ArrayException();
-
- if (count + len > bufsize)
- grow(ll_get_order_round_up(count + len));
-
- memcpy(ptr + count, newptr, len * sizeof(T));
- count += len;
- }
+ static void *alloc(size_t size, int refs = 1);
+ static void retain(void *ptr, int refs = 1);
+ static void release(void *ptr, int refs = 1);
+ static void add_region(Region region, bool unmap_orig, int refs = 1);
};
-
- template<typename T> struct Array {
- const T *ptr;
- size_t count;
-
- bool valid_index(size_t index)
- {
- return index >= 0 && index < count;
- }
-
- const T &operator[](size_t index)
- {
-#ifndef POLINTOS_NO_ARRAY_BOUNDS_CHECK
- if (!valid_index(index))
- throw ArrayException();
-#endif
-
- return ptr[index];
- }
-
- Array()
- {
- ptr = NULL;
- count = 0;
- }
-
- Array(NullArray na)
- {
- ptr = NULL;
- count = 0;
- }
-
- Array(const T *PTR, size_t COUNT)
- {
- ptr = PTR;
- count = COUNT;
- }
-
- Array(MutableArray<T> ma)
- {
- ptr = ma.ptr;
- count = ma.count;
- }
-
- MutableArray<T> constcast()
- {
- MutableArray<T> ma;
- ma.ptr = const_cast<T>(ptr);
- ma.count = count;
- return ma;
- }
-
- Array &slice_nocheck(size_t first, size_t newcount)
- {
- Array ret;
- ret.ptr = ptr + first;
- ret.count = newcount;
- return ret;
- }
-
- Array &slice_nocheck(size_t first)
- {
- Array ret;
- ret.ptr = ptr + first;
- ret.count = count - first;
- return ret;
- }
-
- Array &slice(size_t first, size_t count)
- {
-#ifndef POLINTOS_NO_ARRAY_BOUNDS_CHECK
- if (!valid_index(first) || !valid_index(first + count - 1))
- throw ArrayException();
-#endif
-
- return slice_nocheck(first, count);
- }
-
- Array &slice(size_t first)
- {
-#ifndef POLINTOS_NO_ARRAY_BOUNDS_CHECK
- if (!valid_index(first))
- throw ArrayException();
-#endif
-
- return slice_nocheck(first);
- }
-
- MutableArray<T> copy()
- {
- MutableArray<T> new_arr;
- new_arr.ptr = new(orbmm) T[count];
- new_arr.count = count;
- memcpy(new_arr.ptr, ptr, count);
- return new_arr;
- }
- };
-
- static inline Array<uint8_t> countarray(const char *ptr)
- {
- Array<uint8_t> ret;
- ret.ptr = reinterpret_cast<const uint8_t *>(ptr);
- ret.count = strlen(ptr);
- return ret;
- }
-
- static inline MutableArray<uint8_t> countarray(char *ptr)
- {
- MutableArray<uint8_t> ret;
- ret.ptr = reinterpret_cast<uint8_t *>(ptr);
- ret.count = strlen(ptr);
- return ret;
- }
struct IFaceInfo;
typedef uint32_t ID;
struct IFaceInfo {
const GUID *guid;
- void (*invoke)(Array<ID> objlist,
+ void (*invoke)(Array<ID, ORBMM> objlist,
ParamInfoBlock::Segment *segs,
int nsegs);
::System::_i_Object *(*wrapper)(ID id);
const int chainlen;
- int (*marshall)(GrowableArray<uint8_t> &buf,
- GrowableArray<ID> &objlist,
- GrowableArray<NewObject> &newobjlist,
+ int (*marshall)(GrowableArray<uint8_t, ORBMM> &buf,
+ GrowableArray<ID, ORBMM> &objlist,
+ GrowableArray<NewObject, ORBMM> &newobjlist,
ParamInfoBlock::Segment *segs,
int nsegs);
- void (*unmarshall)(Array<uint8_t> buf,
- Array< ::System::_i_Object *> objlist,
+ void (*unmarshall)(Array<uint8_t, ORBMM> buf,
+ Array< ::System::_i_Object *, ORBMM> objlist,
ParamInfoBlock::Segment *segs,
int nsegs);
};
};
}
-inline void *operator new(size_t len, ::System::RunTime::ORBMM *orbmm,
+inline void *operator new(size_t len, ::System::RunTime::ORBMM orbmm,
int refs = 1)
{
- return orbmm->alloc(len, refs);
-}
-
-inline void *operator new[](size_t len, ::System::RunTime::ORBMM *orbmm,
- int refs = 1)
-{
- return orbmm->alloc(len, refs);
+ return ::System::RunTime::ORBMM::alloc(len, refs);
}
-// FIXME: This isn't safe on anything with a descructor.
-inline void operator delete(void *ptr, ::System::RunTime::ORBMM *orbmm,
+inline void *operator new[](size_t len, ::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);
+ return ::System::RunTime::ORBMM::alloc(len, refs);
}
// This is a macro rather than an inline template function so that the
#ifndef POLINTOS_NO_THROW_IDL
#define throw_idl(T, args...) do { \
throw T(NULL, NULL, \
- new(::System::RunTime::orbmm) \
+ new(::System::RunTime::ORBMM()) \
::System::Exceptions::NativeCodeExceptionOriginInfo \
(::System::RunTime::Priv::get_pc()), \
::System::RunTime::Priv::in_kernel(), ##args); \
} while (0)
#define rethrow_idl(oldex, T, args...) do { \
- throw T(new(::System::RunTime::orbmm) typeof(oldex)(oldex), NULL, \
- new(::System::RunTime::orbmm) \
+ throw T(new(::System::RunTime::ORBMM()) typeof(oldex)(oldex), NULL, \
+ new(::System::RunTime::ORBMM()) \
::System::Exceptions::NativeCodeExceptionOriginInfo \
(::System::RunTime::Priv::get_pc()), \
::System::RunTime::Priv::in_kernel(), ##args); \
--- /dev/null
+// util/array.h -- Dynamically sized arrays
+//
+// This software is copyright (c) 2007 Scott Wood <scott@buserror.net>.
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors or contributors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is hereby granted to everyone, free of charge, to use, copy,
+// modify, prepare derivative works of, publish, distribute, perform,
+// sublicense, and/or sell copies of the Software, provided that the above
+// copyright notice and disclaimer of warranty be included in all copies or
+// substantial portions of this software.
+
+#ifndef _UTIL_ARRAY_H
+#define _UTIL_ARRAY_H
+
+namespace System {
+namespace RunTime {
+ class ORBMM;
+}}
+
+namespace Util {
+ namespace Arrays {
+ struct ArrayException
+ {
+ };
+
+ class NullArray {
+ };
+
+ static const NullArray nullarray = {};
+
+ template<typename T, typename Alloc = ::System::RunTime::ORBMM> struct MutableArray {
+ T *ptr;
+ size_t count;
+
+ bool valid_index(size_t index)
+ {
+ return index >= 0 && index < count;
+ }
+
+ T &operator[](size_t index)
+ {
+#ifndef POLINTOS_NO_ARRAY_BOUNDS_CHECK
+ if (!valid_index(index))
+ throw ArrayException();
+#endif
+
+ return ptr[index];
+ }
+
+ MutableArray()
+ {
+ ptr = NULL;
+ count = 0;
+ }
+
+ MutableArray(NullArray na)
+ {
+ ptr = NULL;
+ count = 0;
+ }
+
+ MutableArray(T *PTR, size_t COUNT)
+ {
+ ptr = PTR;
+ count = COUNT;
+ }
+
+ MutableArray &slice_nocheck(size_t first, size_t newcount)
+ {
+ MutableArray ret;
+ ret.ptr = ptr + first;
+ ret.count = newcount;
+ return ret;
+ }
+
+ MutableArray &slice_nocheck(size_t first)
+ {
+ MutableArray ret;
+ ret.ptr = ptr + first;
+ ret.count = count - first;
+ return ret;
+ }
+
+ MutableArray &slice(size_t first, size_t count)
+ {
+#ifndef POLINTOS_NO_ARRAY_BOUNDS_CHECK
+ if (!valid_index(first) || !valid_index(first + count - 1))
+ throw ArrayException();
+#endif
+
+ return slice_nocheck(first, count);
+ }
+
+ MutableArray &slice(size_t first)
+ {
+#ifndef POLINTOS_NO_ARRAY_BOUNDS_CHECK
+ if (!valid_index(first))
+ throw ArrayException();
+#endif
+
+ return slice_nocheck(first);
+ }
+
+ MutableArray copy()
+ {
+ MutableArray new_arr;
+ new_arr.ptr = new(Alloc()) T[count];
+ new_arr.count = count;
+ memcpy(new_arr.ptr, ptr, count);
+ return new_arr;
+ }
+ };
+
+ template<typename T, typename Alloc = ::System::RunTime::ORBMM>
+ struct GrowableArray : public MutableArray<T, Alloc> {
+ using MutableArray<T, Alloc>::ptr;
+ using MutableArray<T, Alloc>::count;
+ size_t bufsize;
+
+ GrowableArray()
+ {
+ bufsize = 0;
+ }
+
+ GrowableArray(NullArray na) : MutableArray<T, Alloc>(na)
+ {
+ bufsize = 0;
+ }
+
+ GrowableArray(T *PTR, size_t COUNT) : MutableArray<T, Alloc>(PTR, COUNT)
+ {
+ bufsize = COUNT;
+ }
+
+ GrowableArray(T *PTR, size_t COUNT, size_t BUFSIZE) :
+ MutableArray<T, Alloc>(PTR, COUNT)
+ {
+ bufsize = BUFSIZE;
+ }
+
+ GrowableArray(MutableArray<T, Alloc> &ma) : MutableArray<T, Alloc>(ma)
+ {
+ bufsize = count;
+ }
+
+ void grow(size_t newsize)
+ {
+ if (newsize <= bufsize)
+ return;
+
+ T *oldptr = ptr;
+ T *newptr = new(Alloc()) T[newsize];
+
+ memcpy(newptr, ptr, count * sizeof(T));
+
+ ptr = newptr;
+ ll_smp_membar_store_after_store();
+ bufsize = newsize;
+ ll_smp_membar_any_after_store();
+
+ Alloc::release(oldptr);
+ }
+
+ // Caller must sync against all writers.
+ void append(T *newptr, size_t len, size_t max = ULONG_MAX)
+ {
+ if (count + len < count)
+ throw ArrayException();
+
+ if (count + len > max)
+ throw ArrayException();
+
+ if (count + len > bufsize)
+ grow(ll_get_order_round_up(count + len));
+
+ memcpy(ptr + count, newptr, len * sizeof(T));
+ count += len;
+ }
+ };
+
+ template<typename T, typename Alloc = ::System::RunTime::ORBMM> struct Array {
+ const T *ptr;
+ size_t count;
+
+ bool valid_index(size_t index)
+ {
+ return index >= 0 && index < count;
+ }
+
+ const T &operator[](size_t index)
+ {
+#ifndef POLINTOS_NO_ARRAY_BOUNDS_CHECK
+ if (!valid_index(index))
+ throw ArrayException();
+#endif
+
+ return ptr[index];
+ }
+
+ Array()
+ {
+ ptr = NULL;
+ count = 0;
+ }
+
+ Array(NullArray na)
+ {
+ ptr = NULL;
+ count = 0;
+ }
+
+ Array(const T *PTR, size_t COUNT)
+ {
+ ptr = PTR;
+ count = COUNT;
+ }
+
+ Array(MutableArray<T, Alloc> ma)
+ {
+ ptr = ma.ptr;
+ count = ma.count;
+ }
+
+ MutableArray<T, Alloc> constcast()
+ {
+ MutableArray<T, Alloc> ma;
+ ma.ptr = const_cast<T>(ptr);
+ ma.count = count;
+ return ma;
+ }
+
+ Array &slice_nocheck(size_t first, size_t newcount)
+ {
+ Array ret;
+ ret.ptr = ptr + first;
+ ret.count = newcount;
+ return ret;
+ }
+
+ Array &slice_nocheck(size_t first)
+ {
+ Array ret;
+ ret.ptr = ptr + first;
+ ret.count = count - first;
+ return ret;
+ }
+
+ Array &slice(size_t first, size_t count)
+ {
+#ifndef POLINTOS_NO_ARRAY_BOUNDS_CHECK
+ if (!valid_index(first) || !valid_index(first + count - 1))
+ throw ArrayException();
+#endif
+
+ return slice_nocheck(first, count);
+ }
+
+ Array &slice(size_t first)
+ {
+#ifndef POLINTOS_NO_ARRAY_BOUNDS_CHECK
+ if (!valid_index(first))
+ throw ArrayException();
+#endif
+
+ return slice_nocheck(first);
+ }
+
+ MutableArray<T, Alloc> copy()
+ {
+ MutableArray<T, Alloc> new_arr;
+ new_arr.ptr = new(Alloc()) T[count];
+ new_arr.count = count;
+ memcpy(new_arr.ptr, ptr, count);
+ return new_arr;
+ }
+ };
+
+ template<typename Alloc>
+ static inline Array<uint8_t, Alloc>
+ countarray(const char *ptr)
+ {
+ Array<uint8_t, Alloc> ret;
+ ret.ptr = reinterpret_cast<const uint8_t *>(ptr);
+ ret.count = strlen(ptr);
+ return ret;
+ }
+
+ template<typename Alloc>
+ static inline MutableArray<uint8_t, Alloc>
+ countarray(char *ptr)
+ {
+ MutableArray<uint8_t, Alloc> ret;
+ ret.ptr = reinterpret_cast<uint8_t *>(ptr);
+ ret.count = strlen(ptr);
+ return ret;
+ }
+ }
+
+ using namespace Arrays;
+}
+
+#endif
while (list) {
if (list == irq)
- throw_idl(ResourceBusy, -1, countarray("IRQ in use"));
+ throw_idl(ResourceBusy, -1, countarray<ORBMM>("IRQ in use"));
insert = &list->next;
list = *insert;
{
}
- virtual void write(Array<octet> buf, u64 *len) = 0;
+ virtual void write(Array<octet, ORBMM> buf, u64 *len) = 0;
void write(const char *data, size_t len);
};
using System::RunTime::countarray;
using System::RunTime::Array;
using System::RunTime::nullarray;
-using System::RunTime::orbmm;
+using System::RunTime::ORBMM;
using System::Object;
using System::Objects::Factory;
using namespace System::Exceptions::Std;
extern Factory addr_space_factory, proc_addr_space_factory;
- using ::System::RunTime::orbmm;
-
static inline bool page_aligned(u64 addr)
{
return !(addr & (u64)(Arch::page_size - 1));
void Console::write(const char *data, size_t len)
{
u64 len64 = len;
- write(Array<octet>((octet *)data, len), &len64);
+ write(Array<octet, ORBMM>((octet *)data, len), &len64);
}
// All consoles will set this to themselves; the last console
if (mflags.Replace)
throw_idl(InvalidArgument, 3,
- countarray("Replace unimplemented"));
+ countarray<ORBMM>("Replace unimplemented"));
Mappable *cma = Mappable::classptr(ma);
if (!cma) {
mflags.Fixed = 1;
if (!page_aligned(region.start))
- throw_idl(InvalidArgument, 1, countarray("unaligned start"));
+ throw_idl(InvalidArgument, 1, countarray<ORBMM>("unaligned start"));
if (!page_aligned(region.end + 1))
- throw_idl(InvalidArgument, 1, countarray("unaligned end"));
+ throw_idl(InvalidArgument, 1, countarray<ORBMM>("unaligned end"));
Lock::AutoLock autolock(lock);
Region vregion;
if (is_process) {
if (!valid_addr(vregion.start))
throw_idl(InvalidArgument, 2,
- countarray("invalid virtual start"));
+ countarray<ORBMM>("invalid virtual start"));
if (!valid_addr(vregion.end))
throw_idl(InvalidArgument, 2,
- countarray("invalid virtual end"));
+ countarray<ORBMM>("invalid virtual end"));
}
if (check_overlap(vregion, prev))
if (*vstart == System::Mem::AddrSpace_ns::unspecified_start) {
if (fixed)
- throw_idl(ResourceBusy, 2, countarray("varea overlap"));
+ throw_idl(ResourceBusy, 2, countarray<ORBMM>("varea overlap"));
if (!get_free_region(region.end - region.start + 1, vregion, prev))
- throw_idl(OutOfSpace, countarray("out of vspace"));
+ throw_idl(OutOfSpace, countarray<ORBMM>("out of vspace"));
*vstart = vregion.start;
}
ORBMM orbmm_real;
ORBMM *orbmm = &orbmm_real;
- ORBMM::ORBMM()
- {
- priv = NULL;
- }
-
void *ORBMM::alloc(size_t size, int refs)
{
return reinterpret_cast<void *>(new u8[size]);
size_t len = round_up(spib->segments[i].len, 3);
if (len + copied > bufsize || len + copied < copied)
- throw_idl(InvalidArgument, 0, countarray("copy_data: bad size"));
+ throw_idl(InvalidArgument, 0, countarray<ORBMM>("copy_data: bad size"));
dpib->segments[i].ptr = vaddr;
dpib->segments[i].len = len;
printf("objlist len %u\n", pib.objlist_len);
if (pib.objlist_len == 0)
- throw_idl(InvalidArgument, 0, countarray("no objects"));
+ throw_idl(InvalidArgument, 0, countarray<ORBMM>("no objects"));
// FIXME: declare constants somewhere
if (pib.num_segments > 64)
- throw_idl(InvalidArgument, 0, countarray("too many segments"));
+ throw_idl(InvalidArgument, 0, countarray<ORBMM>("too many segments"));
if (pib.objlist_len > 4096)
- throw_idl(InvalidArgument, 0, countarray("too many objects"));
+ throw_idl(InvalidArgument, 0, countarray<ORBMM>("too many objects"));
printf("&pib.objlist[0] %p\n", &pib.objlist[0]);
buflen += sizeof(ParamInfoBlock);
buflen += pib.num_segments * sizeof(ParamInfoBlock::Segment);
- u8 *args = new(orbmm) u8[buflen];
- u8 *copy = new(orbmm) u8[pib.copy_size];
+ u8 *args = new(ORBMM()) u8[buflen];
+ u8 *copy = new(ORBMM()) u8[pib.copy_size];
ParamInfoBlock *dpib = reinterpret_cast<ParamInfoBlock *>
(args + piboff);
dpib->objlist = reinterpret_cast<ID *>(args + datalen);
return reinterpret_cast<unsigned long>(__builtin_return_address(0));
}
- void exception_to_array(::System::VStruct *ex, Array<uint8_t> *ar)
+ void exception_to_array(::System::VStruct *ex, Array<uint8_t, ORBMM> *ar)
{
// FIXME: marshall struct
}
extern "C" void abort();
extern "C" void handle_message(::System::RunTime::ParamInfoBlock *pib,
- ::System::RunTime::Array<uint8_t> *ex_arr)
+ ::System::RunTime::Array<uint8_t, ::System::RunTime::ORBMM> *ex_arr)
{
try {
::System::RunTime::Priv::handle_message(pib);