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.22 by gbeauche, 2003-12-04T23:37:38Z vs.
Revision 1.25 by cebix, 2004-01-12T15:37:24Z

# Line 1 | Line 1
1   /*
2   *  sheepshaver_glue.cpp - Glue Kheperix CPU to SheepShaver CPU engine interface
3   *
4 < *  SheepShaver (C) 1997-2002 Christian Bauer and Marc Hellwig
4 > *  SheepShaver (C) 1997-2004 Christian Bauer and Marc Hellwig
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 73 | Line 73 | static void enter_mon(void)
73   #endif
74   }
75  
76 + // From main_*.cpp
77 + extern uintptr SignalStackBase();
78 +
79   // PowerPC EmulOp to exit from emulation looop
80   const uint32 POWERPC_EXEC_RETURN = POWERPC_EMUL_OP | 1;
81  
# Line 124 | Line 127 | public:
127          // Constructor
128          sheepshaver_cpu();
129  
130 <        // Condition Register accessors
130 >        // CR & XER accessors
131          uint32 get_cr() const           { return cr().get(); }
132          void set_cr(uint32 v)           { cr().set(v); }
133 +        uint32 get_xer() const          { return xer().get(); }
134 +        void set_xer(uint32 v)          { xer().set(v); }
135  
136          // Execute 68k routine
137          void execute_68k(uint32 entry, M68kRegisters *r);
# Line 238 | Line 243 | void sheepshaver_cpu::execute_sheep(uint
243                  for (int i = 0; i < 7; i++)
244                          r68.a[i] = gpr(16 + i);
245                  r68.a[7] = gpr(1);
246 +                uint32 saved_cr = get_cr() & CR_field<2>::mask();
247 +                uint32 saved_xer = get_xer();
248                  EmulOp(&r68, gpr(24), EMUL_OP_field::extract(opcode) - 3);
249 +                set_cr(saved_cr);
250 +                set_xer(saved_xer);
251                  for (int i = 0; i < 8; i++)
252                          gpr(8 + i) = r68.d[i];
253                  for (int i = 0; i < 7; i++)
# Line 268 | Line 277 | void sheepshaver_cpu::interrupt(uint32 e
277   #endif
278  
279          // Initialize stack pointer to SheepShaver alternate stack base
280 <        SheepArray<64> stack_area;
272 <        gpr(1) = stack_area.addr();
280 >        gpr(1) = SignalStackBase() - 64;
281  
282          // Build trampoline to return from interrupt
283          SheepVar32 trampoline = POWERPC_EXEC_RETURN;
# Line 621 | Line 629 | void init_emul_ppc(void)
629          // Initialize main CPU emulator
630          main_cpu = new sheepshaver_cpu();
631          main_cpu->set_register(powerpc_registers::GPR(3), any_register((uint32)ROM_BASE + 0x30d000));
632 +        main_cpu->set_register(powerpc_registers::GPR(4), any_register(KernelDataAddr + 0x1000));
633          WriteMacInt32(XLM_RUN_MODE, MODE_68K);
634  
635   #if MULTICORE_CPU
# Line 685 | Line 694 | void exit_emul_ppc(void)
694   void emul_ppc(uint32 entry)
695   {
696          current_cpu = main_cpu;
697 < #if DEBUG
697 > #if 0
698          current_cpu->start_log();
699   #endif
700          // start emulation loop and enable code translation or caching

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines