--- SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp 2005/06/30 09:09:59 1.63 +++ SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp 2006/01/21 17:18:53 1.67 @@ -177,50 +177,8 @@ public: // Make sure the SIGSEGV handler can access CPU registers friend sigsegv_return_t sigsegv_handler(sigsegv_address_t, sigsegv_address_t); - - // Memory allocator returning areas aligned on 16-byte boundaries - void *operator new(size_t size); - void operator delete(void *p); }; -// Memory allocator returning sheepshaver_cpu objects aligned on 16-byte boundaries -// FORMAT: [ alignment ] magic identifier, offset to malloc'ed data, sheepshaver_cpu data -void *sheepshaver_cpu::operator new(size_t size) -{ - const int ALIGN = 16; - - // Allocate enough space for sheepshaver_cpu data + signature + align pad - uint8 *ptr = (uint8 *)malloc(size + ALIGN * 2); - if (ptr == NULL) - throw std::bad_alloc(); - - // Align memory - int ofs = 0; - while ((((uintptr)ptr) % ALIGN) != 0) - ofs++, ptr++; - - // Insert signature and offset - struct aligned_block_t { - uint32 pad[(ALIGN - 8) / 4]; - uint32 signature; - uint32 offset; - uint8 data[sizeof(sheepshaver_cpu)]; - }; - aligned_block_t *blk = (aligned_block_t *)ptr; - blk->signature = FOURCC('S','C','P','U'); - blk->offset = ofs + (&blk->data[0] - (uint8 *)blk); - assert((((uintptr)&blk->data) % ALIGN) == 0); - return &blk->data[0]; -} - -void sheepshaver_cpu::operator delete(void *p) -{ - uint32 *blk = (uint32 *)p; - assert(blk[-2] == FOURCC('S','C','P','U')); - void *ptr = (void *)(((uintptr)p) - blk[-1]); - free(ptr); -} - sheepshaver_cpu::sheepshaver_cpu() : powerpc_cpu(enable_jit_p()) { @@ -868,6 +826,7 @@ void exit_emul_ppc(void) #endif delete ppc_cpu; + ppc_cpu = NULL; } #if PPC_ENABLE_JIT && PPC_REENTRANT_JIT @@ -915,6 +874,7 @@ void emul_ppc(uint32 entry) void TriggerInterrupt(void) { + idle_resume(); #if 0 WriteMacInt32(0x16a, ReadMacInt32(0x16a) + 1); #else @@ -1038,6 +998,18 @@ void sheepshaver_cpu::execute_native_op( case NATIVE_VIDEO_DO_DRIVER_IO: gpr(3) = (int32)(int16)VideoDoDriverIO(gpr(3), gpr(4), gpr(5), gpr(6), gpr(7)); break; + case NATIVE_ETHER_AO_GET_HWADDR: + AO_get_ethernet_address(gpr(3)); + break; + case NATIVE_ETHER_AO_ADD_MULTI: + AO_enable_multicast(gpr(3)); + break; + case NATIVE_ETHER_AO_DEL_MULTI: + AO_disable_multicast(gpr(3)); + break; + case NATIVE_ETHER_AO_SEND_PACKET: + AO_transmit_packet(gpr(3)); + break; case NATIVE_ETHER_IRQ: EtherIRQ(); break;