40 |
|
#include "ether.h" |
41 |
|
|
42 |
|
#include <stdio.h> |
43 |
+ |
#include <stdlib.h> |
44 |
|
|
45 |
|
#if ENABLE_MON |
46 |
|
#include "mon.h" |
168 |
|
{ |
169 |
|
void *p; |
170 |
|
|
171 |
< |
/* XXX: try different approaches */ |
171 |
> |
#if defined(HAVE_POSIX_MEMALIGN) |
172 |
|
if (posix_memalign(&p, 16, size) != 0) |
173 |
|
throw std::bad_alloc(); |
174 |
+ |
#elif defined(HAVE_MEMALIGN) |
175 |
+ |
p = memalign(16, size); |
176 |
+ |
#elif defined(HAVE_VALLOC) |
177 |
+ |
p = valloc(size); // page-aligned! |
178 |
+ |
#else |
179 |
+ |
/* XXX: handle padding ourselves */ |
180 |
+ |
p = malloc(size); |
181 |
+ |
#endif |
182 |
|
|
183 |
|
return p; |
184 |
|
} |
185 |
|
|
186 |
|
void operator delete(void *p) |
187 |
|
{ |
188 |
+ |
#if defined(HAVE_MEMALIGN) || defined(HAVE_VALLOC) |
189 |
+ |
#if defined(__GLIBC__) |
190 |
+ |
// this is known to work only with GNU libc |
191 |
+ |
free(p); |
192 |
+ |
#endif |
193 |
+ |
#else |
194 |
|
free(p); |
195 |
+ |
#endif |
196 |
|
} |
197 |
|
|
198 |
|
sheepshaver_cpu::sheepshaver_cpu() |
731 |
|
else if (pc == ROM_BASE + 0x4a10a0 && (cpu->gpr(20) == 0xf3012002 || cpu->gpr(20) == 0xf3012000)) |
732 |
|
return SIGSEGV_RETURN_SKIP_INSTRUCTION; |
733 |
|
|
734 |
+ |
// Ignore writes to the zero page |
735 |
+ |
else if ((uint32)(addr - SheepMem::ZeroPage()) < (uint32)SheepMem::PageSize()) |
736 |
+ |
return SIGSEGV_RETURN_SKIP_INSTRUCTION; |
737 |
+ |
|
738 |
|
// Ignore all other faults, if requested |
739 |
|
if (PrefsFindBool("ignoresegv")) |
740 |
|
return SIGSEGV_RETURN_SKIP_INSTRUCTION; |
985 |
|
case NATIVE_ETHER_RSRV: |
986 |
|
GPR(3) = ether_rsrv((queue_t *)GPR(3)); |
987 |
|
break; |
988 |
+ |
case NATIVE_SYNC_HOOK: |
989 |
+ |
GPR(3) = NQD_sync_hook(GPR(3)); |
990 |
+ |
break; |
991 |
+ |
case NATIVE_BITBLT_HOOK: |
992 |
+ |
GPR(3) = NQD_bitblt_hook(GPR(3)); |
993 |
+ |
break; |
994 |
+ |
case NATIVE_BITBLT: |
995 |
+ |
NQD_bitblt(GPR(3)); |
996 |
+ |
break; |
997 |
+ |
#if 0 |
998 |
+ |
case NATIVE_FILLRECT_HOOK: |
999 |
+ |
GPR(3) = NQD_fillrect_hook(GPR(3)); |
1000 |
+ |
break; |
1001 |
+ |
case NATIVE_INVRECT: |
1002 |
+ |
NQD_invrect(GPR(3)); |
1003 |
+ |
break; |
1004 |
+ |
case NATIVE_FILLRECT_8: |
1005 |
+ |
NQD_fillrect8(GPR(3)); |
1006 |
+ |
break; |
1007 |
+ |
case NATIVE_FILLRECT_32: |
1008 |
+ |
NQD_fillrect32(GPR(3)); |
1009 |
+ |
break; |
1010 |
+ |
#endif |
1011 |
|
#else |
1012 |
|
case NATIVE_ETHER_INIT: |
1013 |
|
// FIXME: needs more complicated thunks |