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.4 by gbeauche, 2003-09-29T15:46:09Z vs.
Revision 1.5 by gbeauche, 2003-09-29T22:50:31Z

# Line 273 | Line 273 | void sheepshaver_cpu::interrupt(uint32 e
273          gpr(1) = SheepStack1Base - 64;
274  
275          // Build trampoline to return from interrupt
276 <        uint32 trampoline[] = { POWERPC_EMUL_OP | 1 };
276 >        uint32 trampoline[] = { htonl(POWERPC_EMUL_OP | 1) };
277  
278          // Prepare registers for nanokernel interrupt routine
279 <        kernel_data->v[0x004 >> 2] = gpr(1);
280 <        kernel_data->v[0x018 >> 2] = gpr(6);
279 >        kernel_data->v[0x004 >> 2] = htonl(gpr(1));
280 >        kernel_data->v[0x018 >> 2] = htonl(gpr(6));
281  
282 <        gpr(6) = kernel_data->v[0x65c >> 2];
282 >        gpr(6) = ntohl(kernel_data->v[0x65c >> 2]);
283          assert(gpr(6) != 0);
284          WriteMacInt32(gpr(6) + 0x13c, gpr(7));
285          WriteMacInt32(gpr(6) + 0x144, gpr(8));
# Line 290 | Line 290 | void sheepshaver_cpu::interrupt(uint32 e
290          WriteMacInt32(gpr(6) + 0x16c, gpr(13));
291  
292          gpr(1)  = KernelDataAddr;
293 <        gpr(7)  = kernel_data->v[0x660 >> 2];
293 >        gpr(7)  = ntohl(kernel_data->v[0x660 >> 2]);
294          gpr(8)  = 0;
295          gpr(10) = (uint32)trampoline;
296          gpr(12) = (uint32)trampoline;
# Line 335 | Line 335 | void sheepshaver_cpu::execute_68k(uint32
335          WriteMacInt32(gpr(1), sp);
336  
337          // Save PowerPC registers
338 <        memcpy(Mac2HostAddr(gpr(1)+56), &gpr(13), sizeof(uint32)*(32-13));
338 >        for (int i = 13; i < 32; i++)
339 >                WriteMacInt32(gpr(1) + 56 + i*4, gpr(i));
340   #if SAVE_FP_EXEC_68K
341          memcpy(Mac2HostAddr(gpr(1)+56+19*4), &fpr(14), sizeof(double)*(32-14));
342   #endif
# Line 351 | Line 352 | void sheepshaver_cpu::execute_68k(uint32
352          gpr(25) = ReadMacInt32(XLM_68K_R25);            // MSB of SR
353          gpr(26) = 0;
354          gpr(28) = 0;                                                            // VBR
355 <        gpr(29) = kernel_data->ed.v[0x74 >> 2];         // Pointer to opcode table
356 <        gpr(30) = kernel_data->ed.v[0x78 >> 2];         // Address of emulator
355 >        gpr(29) = ntohl(kernel_data->ed.v[0x74 >> 2]);          // Pointer to opcode table
356 >        gpr(30) = ntohl(kernel_data->ed.v[0x78 >> 2]);          // Address of emulator
357          gpr(31) = KernelDataAddr + 0x1000;
358  
359          // Push return address (points to EXEC_RETURN opcode) on stack
# Line 384 | Line 385 | void sheepshaver_cpu::execute_68k(uint32
385            r->a[i] = gpr(16 + i);
386  
387          // Restore PowerPC registers
388 <        memcpy(&gpr(13), Mac2HostAddr(gpr(1)+56), sizeof(uint32)*(32-13));
388 >        for (int i = 13; i < 32; i++)
389 >                gpr(i) = ReadMacInt32(gpr(1) + 56 + i*4);
390   #if SAVE_FP_EXEC_68K
391          memcpy(&fpr(14), Mac2HostAddr(gpr(1)+56+19*4), sizeof(double)*(32-14));
392   #endif
# Line 407 | Line 409 | uint32 sheepshaver_cpu::execute_macos_co
409          uint32 saved_ctr= ctr();
410  
411          // Build trampoline with EXEC_RETURN
412 <        uint32 trampoline[] = { POWERPC_EMUL_OP | 1 };
412 >        uint32 trampoline[] = { htonl(POWERPC_EMUL_OP | 1) };
413          lr() = (uint32)trampoline;
414  
415          gpr(1) -= 64;                                                           // Create stack frame
# Line 449 | Line 451 | inline void sheepshaver_cpu::execute_ppc
451          uint32 saved_lr = lr();
452          uint32 saved_ctr= ctr();
453  
454 <        const uint32 trampoline[] = { POWERPC_EMUL_OP | 1 };
454 >        const uint32 trampoline[] = { htonl(POWERPC_EMUL_OP | 1) };
455  
456          lr() = (uint32)trampoline;
457          ctr()= entry;
# Line 461 | Line 463 | inline void sheepshaver_cpu::execute_ppc
463   }
464  
465   // Resource Manager thunk
466 < extern "C" void check_load_invoc(uint32 type, int16 id, uint16 **h);
466 > extern "C" void check_load_invoc(uint32 type, int16 id, uint32 h);
467  
468   inline void sheepshaver_cpu::get_resource(uint32 old_get_resource)
469   {
# Line 473 | Line 475 | inline void sheepshaver_cpu::get_resourc
475  
476          // Call old routine
477          execute_ppc(old_get_resource);
476        uint16 **handle = (uint16 **)gpr(3);
478  
479          // Call CheckLoad()
480 +        uint32 handle = gpr(3);
481          check_load_invoc(type, id, handle);
482 <        gpr(3) = (uint32)handle;
482 >        gpr(3) = handle;
483  
484          // Cleanup stack
485          gpr(1) += 56;
# Line 829 | Line 831 | void Execute68k(uint32 pc, M68kRegisters
831  
832   void Execute68kTrap(uint16 trap, M68kRegisters *r)
833   {
834 <        uint16 proc[2] = {trap, M68K_RTS};
834 >        uint16 proc[2];
835 >        proc[0] = htons(trap);
836 >        proc[1] = htons(M68K_RTS);
837          Execute68k((uint32)proc, r);
838   }
839  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines