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

Comparing SheepShaver/src/thunks.cpp (file contents):
Revision 1.1 by gbeauche, 2003-12-04T17:26:35Z vs.
Revision 1.2 by gbeauche, 2003-12-04T23:37:35Z

# Line 29 | Line 29
29   #include "name_registry.h"
30   #include "serial.h"
31   #include "ether.h"
32 + #include "macos_util.h"
33  
34  
35   /*              NativeOp instruction format:
# Line 41 | Line 42
42   #define POWERPC_NATIVE_OP(LR, OP) \
43                  (POWERPC_EMUL_OP | ((LR) << 11) | (((uint32)OP) << 6) | 2)
44  
45 < // Return the fake PowerPC opcode to handle specified native code
45 > /*
46 > *  Return the fake PowerPC opcode to handle specified native code
47 > */
48 >
49   #if EMULATED_PPC
50   uint32 NativeOpcode(int selector)
51   {
# Line 84 | Line 88 | uint32 NativeOpcode(int selector)
88   }
89   #endif
90  
91 < // NativeOp -> { TVECT, function base } mappings
91 >
92 > /*
93 > *  Initialize the thunks system
94 > */
95 >
96   struct native_op_t {
97          uint32 tvect;
98          uint32 func;
99   };
100   static native_op_t native_op[NATIVE_OP_MAX];
101  
94 // Initialize the thunks system
102   bool ThunksInit(void)
103   {
104   #if EMULATED_PPC
# Line 120 | Line 127 | bool ThunksInit(void)
127   #else
128   #error "FIXME: define NativeOp for your platform"
129   #endif
130 +        DEFINE_NATIVE_OP(NATIVE_PATCH_NAME_REGISTRY, DoPatchNameRegistry);
131 +        DEFINE_NATIVE_OP(NATIVE_VIDEO_INSTALL_ACCEL, VideoInstallAccel);
132 +        DEFINE_NATIVE_OP(NATIVE_VIDEO_VBL, VideoVBL);
133 +        DEFINE_NATIVE_OP(NATIVE_VIDEO_DO_DRIVER_IO, VideoDoDriverIO);
134 +        DEFINE_NATIVE_OP(NATIVE_ETHER_IRQ, EtherIRQ);
135 +        DEFINE_NATIVE_OP(NATIVE_ETHER_INIT, InitStreamModule);
136 +        DEFINE_NATIVE_OP(NATIVE_ETHER_TERM, TerminateStreamModule);
137 +        DEFINE_NATIVE_OP(NATIVE_ETHER_OPEN, ether_open);
138 +        DEFINE_NATIVE_OP(NATIVE_ETHER_CLOSE, ether_close);
139 +        DEFINE_NATIVE_OP(NATIVE_ETHER_WPUT, ether_wput);
140 +        DEFINE_NATIVE_OP(NATIVE_ETHER_RSRV, ether_rsrv);
141          DEFINE_NATIVE_OP(NATIVE_SERIAL_NOTHING, SerialNothing);
142          DEFINE_NATIVE_OP(NATIVE_SERIAL_OPEN, SerialOpen);
143          DEFINE_NATIVE_OP(NATIVE_SERIAL_PRIME_IN, SerialPrimeIn);
# Line 133 | Line 151 | bool ThunksInit(void)
151          return true;
152   }
153  
154 < // Return the native function descriptor (TVECT)
154 >
155 > /*
156 > *  Return the native function descriptor (TVECT)
157 > */
158 >
159   uint32 NativeTVECT(int selector)
160   {
161          assert(selector < NATIVE_OP_MAX);
162          const uint32 tvect = native_op[selector].tvect;
163          assert(tvect != 0);
164 <        return native_op[selector].tvect;
164 >        return tvect;
165   }
166  
167 < // Return the native function address
167 >
168 > /*
169 > *  Return the native function address
170 > */
171 >
172   uint32 NativeFunction(int selector)
173   {
174          assert(selector < NATIVE_OP_MAX);
175          const uint32 func = native_op[selector].func;
176          assert(func != 0);
177 <        return native_op[selector].func;
177 >        return func;
178 > }
179 >
180 >
181 > /*
182 > *  Execute native code from EMUL_OP routine (real mode switch)
183 > */
184 >
185 > void ExecuteNative(int selector)
186 > {
187 >        SheepRoutineDescriptor desc(0, NativeTVECT(selector));
188 >        M68kRegisters r;
189 >        Execute68k(desc.addr(), &r);
190   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines