158 |
|
void interrupt(uint32 entry); |
159 |
|
void handle_interrupt(); |
160 |
|
|
161 |
– |
// Lazy memory allocator (one item at a time) |
162 |
– |
void *operator new(size_t size) |
163 |
– |
{ return allocator_helper< sheepshaver_cpu, lazy_allocator >::allocate(); } |
164 |
– |
void operator delete(void *p) |
165 |
– |
{ allocator_helper< sheepshaver_cpu, lazy_allocator >::deallocate(p); } |
166 |
– |
// FIXME: really make surre array allocation fail at link time? |
167 |
– |
void *operator new[](size_t); |
168 |
– |
void operator delete[](void *p); |
169 |
– |
|
161 |
|
// Make sure the SIGSEGV handler can access CPU registers |
162 |
|
friend sigsegv_return_t sigsegv_handler(sigsegv_address_t, sigsegv_address_t); |
163 |
|
}; |
164 |
|
|
165 |
< |
// FIXME: this specialization doesn't work with GCC |
166 |
< |
// template<> lazy_allocator< sheepshaver_cpu > allocator_helper< sheepshaver_cpu, lazy_allocator >::allocator; |
167 |
< |
template< class data_type, template< class > class allocator_type > |
168 |
< |
allocator_type< data_type > allocator_helper< data_type, allocator_type >::allocator; |
165 |
> |
// Memory allocator returning areas aligned on 16-byte boundaries |
166 |
> |
void *operator new(size_t size) |
167 |
> |
{ |
168 |
> |
void *p; |
169 |
> |
|
170 |
> |
/* XXX: try different approaches */ |
171 |
> |
if (posix_memalign(&p, 16, size) != 0) |
172 |
> |
throw std::bad_alloc(); |
173 |
> |
|
174 |
> |
return p; |
175 |
> |
} |
176 |
> |
|
177 |
> |
void operator delete(void *p) |
178 |
> |
{ |
179 |
> |
free(p); |
180 |
> |
} |
181 |
|
|
182 |
|
sheepshaver_cpu::sheepshaver_cpu() |
183 |
|
: powerpc_cpu(enable_jit_p()) |