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.2 by gbeauche, 2003-12-04T23:37:35Z vs.
Revision 1.3 by gbeauche, 2004-01-07T18:24:44Z

# Line 96 | Line 96 | uint32 NativeOpcode(int selector)
96   struct native_op_t {
97          uint32 tvect;
98          uint32 func;
99 +        SheepRoutineDescriptor *desc;
100   };
101   static native_op_t native_op[NATIVE_OP_MAX];
102  
# Line 148 | Line 149 | bool ThunksInit(void)
149          DEFINE_NATIVE_OP(NATIVE_MAKE_EXECUTABLE, MakeExecutable);
150   #undef DEFINE_NATIVE_OP
151   #endif
152 +
153 +        // Initialize routine descriptors
154 +        for (int i = 0; i < NATIVE_OP_MAX; i++)
155 +                native_op[i].desc = new SheepRoutineDescriptor(0, NativeTVECT(i));
156 +
157          return true;
158   }
159  
160  
161   /*
162 + *  Delete generated thunks
163 + */
164 +
165 + void ThunksExit(void)
166 + {
167 +        for (int i = 0; i < NATIVE_OP_MAX; i++) {
168 +                SheepRoutineDescriptor *desc = native_op[i].desc;
169 +                if (desc)
170 +                        delete desc;
171 +        }
172 + }
173 +
174 +
175 + /*
176   *  Return the native function descriptor (TVECT)
177   */
178  
# Line 179 | Line 199 | uint32 NativeFunction(int selector)
199  
200  
201   /*
202 + *  Return the routine descriptor address of the native function
203 + */
204 +
205 + uint32 NativeRoutineDescriptor(int selector)
206 + {
207 +        assert(selector < NATIVE_OP_MAX);
208 +        SheepRoutineDescriptor * const desc = native_op[selector].desc;
209 +        assert(desc != 0);
210 +        return desc->addr();
211 + }
212 +
213 +
214 + /*
215   *  Execute native code from EMUL_OP routine (real mode switch)
216   */
217  
218   void ExecuteNative(int selector)
219   {
187        SheepRoutineDescriptor desc(0, NativeTVECT(selector));
220          M68kRegisters r;
221 <        Execute68k(desc.addr(), &r);
221 >        Execute68k(NativeRoutineDescriptor(selector), &r);
222   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines