ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp
(Generate patch)

Comparing SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp (file contents):
Revision 1.5 by gbeauche, 2003-09-29T22:50:31Z vs.
Revision 1.6 by gbeauche, 2003-10-11T09:33:27Z

# Line 330 | Line 330 | void sheepshaver_cpu::execute_68k(uint32
330          uint32 saved_ctr= ctr();
331  
332          // Create MacOS stack frame
333 +        // FIXME: make sure MacOS doesn't expect PPC registers to live on top
334          uint32 sp = gpr(1);
335 <        gpr(1) -= 56 + 19*4 + 18*8;
335 >        gpr(1) -= 56;
336          WriteMacInt32(gpr(1), sp);
337  
338          // Save PowerPC registers
339 <        for (int i = 13; i < 32; i++)
340 <                WriteMacInt32(gpr(1) + 56 + i*4, gpr(i));
339 >        uint32 saved_GPRs[19];
340 >        memcpy(&saved_GPRs[0], &gpr(13), sizeof(uint32)*(32-13));
341   #if SAVE_FP_EXEC_68K
342 <        memcpy(Mac2HostAddr(gpr(1)+56+19*4), &fpr(14), sizeof(double)*(32-14));
342 >        double saved_FPRs[18];
343 >        memcpy(&saved_FPRs[0], &fpr(14), sizeof(double)*(32-14));
344   #endif
345  
346          // Setup registers for 68k emulator
# Line 385 | Line 387 | void sheepshaver_cpu::execute_68k(uint32
387            r->a[i] = gpr(16 + i);
388  
389          // Restore PowerPC registers
390 <        for (int i = 13; i < 32; i++)
389 <                gpr(i) = ReadMacInt32(gpr(1) + 56 + i*4);
390 >        memcpy(&gpr(13), &saved_GPRs[0], sizeof(uint32)*(32-13));
391   #if SAVE_FP_EXEC_68K
392 <        memcpy(&fpr(14), Mac2HostAddr(gpr(1)+56+19*4), sizeof(double)*(32-14));
392 >        memcpy(&fpr(14), &saved_FPRs[0], sizeof(double)*(32-14));
393   #endif
394  
395          // Cleanup stack
396 <        gpr(1) += 56 + 19*4 + 18*8;
396 >        gpr(1) += 56;
397  
398          // Restore program counters and branch registers
399          pc() = saved_pc;
# Line 449 | Line 450 | inline void sheepshaver_cpu::execute_ppc
450   {
451          // Save branch registers
452          uint32 saved_lr = lr();
452        uint32 saved_ctr= ctr();
453  
454          const uint32 trampoline[] = { htonl(POWERPC_EMUL_OP | 1) };
455
455          lr() = (uint32)trampoline;
456 <        ctr()= entry;
456 >
457          execute(entry);
458  
459          // Restore branch registers
460          lr() = saved_lr;
462        ctr()= saved_ctr;
461   }
462  
463   // Resource Manager thunk

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines