1 |
|
/* |
2 |
|
* rsrc_patches.cpp - Resource patches |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2000 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2004 Christian Bauer |
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 |
37 |
|
#include "debug.h" |
38 |
|
|
39 |
|
|
40 |
– |
#if !EMULATED_68K |
41 |
– |
// Assembly functions |
42 |
– |
extern "C" void Scod060Patch1(void); |
43 |
– |
extern "C" void Scod060Patch2(void); |
44 |
– |
extern "C" void ThInitFPUPatch(void); |
45 |
– |
#endif |
46 |
– |
|
47 |
– |
|
40 |
|
/* |
41 |
|
* Search resource for byte string, return offset (or 0) |
42 |
|
*/ |
60 |
|
{ |
61 |
|
uint16 *p16; |
62 |
|
uint32 base; |
63 |
< |
D(bug("vCheckLoad %c%c%c%c (%08x) ID %d, data %08x, size %d\n", (char)(type >> 24), (char)((type >> 16) & 0xff), (char )((type >> 8) & 0xff), (char )(type & 0xff), type, id, p, size)); |
63 |
> |
D(bug("vCheckLoad %c%c%c%c (%08x) ID %d, data %p, size %d\n", (char)(type >> 24), (char)((type >> 16) & 0xff), (char )((type >> 8) & 0xff), (char )(type & 0xff), type, id, p, size)); |
64 |
|
|
65 |
|
if (type == FOURCC('b','o','o','t') && id == 3) { |
66 |
|
D(bug(" boot 3 found\n")); |
76 |
|
} |
77 |
|
|
78 |
|
#if !ROM_IS_WRITE_PROTECTED |
79 |
< |
// Set fake handle at 0x0000 to some safe place (so broken Mac programs won't write into Mac ROM) (7.5, 8.0) |
79 |
> |
// Set fake handle at 0x0000 to some safe place (so broken Mac programs won't write into Mac ROM) (7.1, 7.5, 8.0) |
80 |
|
static const uint8 dat2[] = {0x20, 0x78, 0x02, 0xae, 0xd1, 0xfc, 0x00, 0x01, 0x00, 0x00, 0x21, 0xc8, 0x00, 0x00}; |
81 |
|
base = find_rsrc_data(p, size, dat2, sizeof(dat2)); |
82 |
|
if (base) { |
83 |
|
p16 = (uint16 *)(p + base); |
84 |
|
|
85 |
< |
#if defined(AMIGA) || defined(__NetBSD__) || defined(USE_SCRATCHMEM_SUBTERFUGE) |
85 |
> |
#if defined(USE_SCRATCHMEM_SUBTERFUGE) |
86 |
|
// Set 0x0000 to scratch memory area |
87 |
|
extern uint8 *ScratchMem; |
88 |
|
const uint32 ScratchMemBase = Host2MacAddr(ScratchMem); |
101 |
|
} else if (type == FOURCC('b','o','o','t') && id == 2) { |
102 |
|
D(bug(" boot 2 found\n")); |
103 |
|
|
104 |
< |
// Set fake handle at 0x0000 to some safe place (so broken Mac programs won't write into Mac ROM) (7.5, 8.0) |
104 |
> |
// Set fake handle at 0x0000 to some safe place (so broken Mac programs won't write into Mac ROM) (7.1, 7.5, 8.0) |
105 |
|
static const uint8 dat[] = {0x20, 0x78, 0x02, 0xae, 0xd1, 0xfc, 0x00, 0x01, 0x00, 0x00, 0x21, 0xc8, 0x00, 0x00}; |
106 |
|
base = find_rsrc_data(p, size, dat, sizeof(dat)); |
107 |
|
if (base) { |
108 |
|
p16 = (uint16 *)(p + base); |
109 |
|
|
110 |
< |
#if defined(AMIGA) || defined(__NetBSD__) || defined(USE_SCRATCHMEM_SUBTERFUGE) |
110 |
> |
#if defined(USE_SCRATCHMEM_SUBTERFUGE) |
111 |
|
// Set 0x0000 to scratch memory area |
112 |
|
extern uint8 *ScratchMem; |
113 |
|
const uint32 ScratchMemBase = Host2MacAddr(ScratchMem); |
154 |
|
} else if (type == FOURCC('p','t','c','h') && id == 26) { |
155 |
|
D(bug(" ptch 26 found\n")); |
156 |
|
|
157 |
< |
// Trap ABC4 is initialized with absolute ROM address (7.5, 7.6, 7.6.1, 8.0) |
157 |
> |
// Trap ABC4 is initialized with absolute ROM address (7.1, 7.5, 7.6, 7.6.1, 8.0) |
158 |
|
static const uint8 dat[] = {0x40, 0x83, 0x36, 0x10}; |
159 |
|
base = find_rsrc_data(p, size, dat, sizeof(dat)); |
160 |
|
if (base) { |
189 |
|
D(bug(" patch 2 applied\n")); |
190 |
|
} |
191 |
|
|
200 |
– |
#if !EMULATED_68K |
201 |
– |
} else if (CPUIs68060 && (type == FOURCC('g','p','c','h') && id == 669 || type == FOURCC('l','p','c','h') && id == 63)) { |
202 |
– |
D(bug(" gpch 669/lpch 63 found\n")); |
203 |
– |
|
204 |
– |
static uint16 ThPatchSpace[1024]; // Replacement routines are constructed here |
205 |
– |
uint16 *q = ThPatchSpace; |
206 |
– |
uint32 start; |
207 |
– |
int i; |
208 |
– |
|
209 |
– |
// Patch Thread Manager thread switcher for 68060 FPU (7.5, 8.0) |
210 |
– |
static const uint8 dat[] = {0x22, 0x6f, 0x00, 0x08, 0x20, 0x2f, 0x00, 0x04, 0x67, 0x18}; |
211 |
– |
base = find_rsrc_data(p, size, dat, sizeof(dat)); |
212 |
– |
if (base) { // Skip first routine (no FPU -> no FPU) |
213 |
– |
|
214 |
– |
base = find_rsrc_data(p, size - base - 2, dat, sizeof(dat), base + 2); |
215 |
– |
if (base) { // no FPU -> FPU |
216 |
– |
|
217 |
– |
p16 = (uint16 *)(p + base); |
218 |
– |
start = (uint32)q; |
219 |
– |
for (i=0; i<28; i++) *q++ = *p16++; |
220 |
– |
*q++ = htons(0x4a2f); // tst.b 2(sp) (null FPU state or "FPU state saved" flag set?) |
221 |
– |
*q++ = htons(2); |
222 |
– |
*q++ = htons(0x6712); // beq |
223 |
– |
*q++ = htons(0x588f); // addq.l #2,sp (flag set, skip it) |
224 |
– |
*q++ = htons(0xf21f); // fmove.l (sp)+,fpcr (restore FPU registers) |
225 |
– |
*q++ = htons(0x9000); |
226 |
– |
*q++ = htons(0xf21f); // fmove.l (sp)+,fpsr |
227 |
– |
*q++ = htons(0x8800); |
228 |
– |
*q++ = htons(0xf21f); // fmove.l (sp)+,fpiar |
229 |
– |
*q++ = htons(0x8400); |
230 |
– |
*q++ = htons(0xf21f); // fmovem.x (sp)+,fp0-fp7 |
231 |
– |
*q++ = htons(0xd0ff); |
232 |
– |
*q++ = htons(0xf35f); // frestore (sp)+ |
233 |
– |
*q++ = htons(0x4e75); // rts |
234 |
– |
|
235 |
– |
p16 = (uint16 *)(p + base); |
236 |
– |
*p16++ = htons(M68K_JMP); |
237 |
– |
*p16++ = htons(start >> 16); |
238 |
– |
*p16 = htons(start & 0xffff); |
239 |
– |
FlushCodeCache(p + base, 6); |
240 |
– |
D(bug(" patch 1 applied\n")); |
241 |
– |
|
242 |
– |
static const uint8 dat2[] = {0x22, 0x6f, 0x00, 0x08, 0x20, 0x2f, 0x00, 0x04, 0x67, 0x28}; |
243 |
– |
base = find_rsrc_data(p, size, dat2, sizeof(dat2)); |
244 |
– |
if (base) { // FPU -> FPU |
245 |
– |
|
246 |
– |
p16 = (uint16 *)(p + base); |
247 |
– |
start = (uint32)q; |
248 |
– |
for (i=0; i<4; i++) *q++ = *p16++; |
249 |
– |
*q++ = htons(0x6736); // beq |
250 |
– |
*q++ = htons(0xf327); // fsave -(sp) (save FPU state frame) |
251 |
– |
*q++ = htons(0x4a2f); // tst.b 2(sp) (null FPU state?) |
252 |
– |
*q++ = htons(2); |
253 |
– |
*q++ = htons(0x6716); // beq |
254 |
– |
*q++ = htons(0xf227); // fmovem.x fp0-fp7,-(sp) (no, save FPU registers) |
255 |
– |
*q++ = htons(0xe0ff); |
256 |
– |
*q++ = htons(0xf227); // fmove.l fpiar,-(sp) |
257 |
– |
*q++ = htons(0xa400); |
258 |
– |
*q++ = htons(0xf227); // fmove.l fpsr,-(sp) |
259 |
– |
*q++ = htons(0xa800); |
260 |
– |
*q++ = htons(0xf227); // fmove.l fpcr,-(sp) |
261 |
– |
*q++ = htons(0xb000); |
262 |
– |
*q++ = htons(0x4879); // pea -1 (push "FPU state saved" flag) |
263 |
– |
*q++ = htons(0xffff); |
264 |
– |
*q++ = htons(0xffff); |
265 |
– |
p16 += 9; |
266 |
– |
for (i=0; i<23; i++) *q++ = *p16++; |
267 |
– |
*q++ = htons(0x4a2f); // tst.b 2(sp) (null FPU state or "FPU state saved" flag set?) |
268 |
– |
*q++ = htons(2); |
269 |
– |
*q++ = htons(0x6712); // beq |
270 |
– |
*q++ = htons(0x588f); // addq.l #2,sp (flag set, skip it) |
271 |
– |
*q++ = htons(0xf21f); // fmove.l (sp)+,fpcr (restore FPU registers) |
272 |
– |
*q++ = htons(0x9000); |
273 |
– |
*q++ = htons(0xf21f); // fmove.l (sp)+,fpsr |
274 |
– |
*q++ = htons(0x8800); |
275 |
– |
*q++ = htons(0xf21f); // fmove.l (sp)+,fpiar |
276 |
– |
*q++ = htons(0x8400); |
277 |
– |
*q++ = htons(0xf21f); // fmovem.x (sp)+,fp0-fp7 |
278 |
– |
*q++ = htons(0xd0ff); |
279 |
– |
*q++ = htons(0xf35f); // frestore (sp)+ |
280 |
– |
*q++ = htons(0x4e75); // rts |
281 |
– |
|
282 |
– |
p16 = (uint16 *)(p + base); |
283 |
– |
*p16++ = htons(M68K_JMP); |
284 |
– |
*p16++ = htons(start >> 16); |
285 |
– |
*p16 = htons(start & 0xffff); |
286 |
– |
FlushCodeCache(p + base, 6); |
287 |
– |
D(bug(" patch 2 applied\n")); |
288 |
– |
|
289 |
– |
base = find_rsrc_data(p, size - base - 2, dat2, sizeof(dat2), base + 2); |
290 |
– |
if (base) { // FPU -> no FPU |
291 |
– |
|
292 |
– |
p16 = (uint16 *)(p + base); |
293 |
– |
start = (uint32)q; |
294 |
– |
for (i=0; i<4; i++) *q++ = *p16++; |
295 |
– |
*q++ = htons(0x6736); // beq |
296 |
– |
*q++ = htons(0xf327); // fsave -(sp) (save FPU state frame) |
297 |
– |
*q++ = htons(0x4a2f); // tst.b 2(sp) (null FPU state?) |
298 |
– |
*q++ = htons(2); |
299 |
– |
*q++ = htons(0x6716); // beq |
300 |
– |
*q++ = htons(0xf227); // fmovem.x fp0-fp7,-(sp) (no, save FPU registers) |
301 |
– |
*q++ = htons(0xe0ff); |
302 |
– |
*q++ = htons(0xf227); // fmove.l fpiar,-(sp) |
303 |
– |
*q++ = htons(0xa400); |
304 |
– |
*q++ = htons(0xf227); // fmove.l fpsr,-(sp) |
305 |
– |
*q++ = htons(0xa800); |
306 |
– |
*q++ = htons(0xf227); // fmove.l fpcr,-(sp) |
307 |
– |
*q++ = htons(0xb000); |
308 |
– |
*q++ = htons(0x4879); // pea -1 (push "FPU state saved" flag) |
309 |
– |
*q++ = htons(0xffff); |
310 |
– |
*q++ = htons(0xffff); |
311 |
– |
p16 += 9; |
312 |
– |
for (i=0; i<24; i++) *q++ = *p16++; |
313 |
– |
|
314 |
– |
p16 = (uint16 *)(p + base); |
315 |
– |
*p16++ = htons(M68K_JMP); |
316 |
– |
*p16++ = htons(start >> 16); |
317 |
– |
*p16 = htons(start & 0xffff); |
318 |
– |
FlushCodeCache(p + base, 6); |
319 |
– |
D(bug(" patch 3 applied\n")); |
320 |
– |
} |
321 |
– |
} |
322 |
– |
} |
323 |
– |
} |
324 |
– |
|
325 |
– |
// Patch Thread Manager thread switcher for 68060 FPU (additional routines under 8.0 for Mixed Mode Manager) |
326 |
– |
static const uint8 dat3[] = {0x22, 0x6f, 0x00, 0x08, 0x20, 0x2f, 0x00, 0x04, 0x67, 0x40}; |
327 |
– |
base = find_rsrc_data(p, size, dat3, sizeof(dat3)); |
328 |
– |
if (base) { // Skip first routine (no FPU -> no FPU) |
329 |
– |
|
330 |
– |
base = find_rsrc_data(p, size - base - 2, dat3, sizeof(dat3), base + 2); |
331 |
– |
if (base) { // no FPU -> FPU |
332 |
– |
|
333 |
– |
p16 = (uint16 *)(p + base); |
334 |
– |
start = (uint32)q; |
335 |
– |
for (i=0; i<48; i++) *q++ = *p16++; |
336 |
– |
*q++ = htons(0x4a2f); // tst.b 2(sp) (null FPU state or "FPU state saved" flag set?) |
337 |
– |
*q++ = htons(2); |
338 |
– |
*q++ = htons(0x6712); // beq |
339 |
– |
*q++ = htons(0x588f); // addq.l #2,sp (flag set, skip it) |
340 |
– |
*q++ = htons(0xf21f); // fmove.l (sp)+,fpcr (restore FPU registers) |
341 |
– |
*q++ = htons(0x9000); |
342 |
– |
*q++ = htons(0xf21f); // fmove.l (sp)+,fpsr |
343 |
– |
*q++ = htons(0x8800); |
344 |
– |
*q++ = htons(0xf21f); // fmove.l (sp)+,fpiar |
345 |
– |
*q++ = htons(0x8400); |
346 |
– |
*q++ = htons(0xf21f); // fmovem.x (sp)+,fp0-fp7 |
347 |
– |
*q++ = htons(0xd0ff); |
348 |
– |
p16 += 7; |
349 |
– |
for (i=0; i<20; i++) *q++ = *p16++; |
350 |
– |
|
351 |
– |
p16 = (uint16 *)(p + base); |
352 |
– |
*p16++ = htons(M68K_JMP); |
353 |
– |
*p16++ = htons(start >> 16); |
354 |
– |
*p16 = htons(start & 0xffff); |
355 |
– |
FlushCodeCache(p + base, 6); |
356 |
– |
D(bug(" patch 4 applied\n")); |
357 |
– |
|
358 |
– |
static const uint8 dat4[] = {0x22, 0x6f, 0x00, 0x08, 0x20, 0x2f, 0x00, 0x04, 0x67, 0x50}; |
359 |
– |
base = find_rsrc_data(p, size, dat4, sizeof(dat4)); |
360 |
– |
if (base) { // FPU -> FPU |
361 |
– |
|
362 |
– |
p16 = (uint16 *)(p + base); |
363 |
– |
start = (uint32)q; |
364 |
– |
for (i=0; i<4; i++) *q++ = *p16++; |
365 |
– |
*q++ = htons(0x675e); // beq |
366 |
– |
p16++; |
367 |
– |
for (i=0; i<21; i++) *q++ = *p16++; |
368 |
– |
*q++ = htons(0x4a2f); // tst.b 2(sp) (null FPU state?) |
369 |
– |
*q++ = htons(2); |
370 |
– |
*q++ = htons(0x6716); // beq |
371 |
– |
*q++ = htons(0xf227); // fmovem.x fp0-fp7,-(sp) (no, save FPU registers) |
372 |
– |
*q++ = htons(0xe0ff); |
373 |
– |
*q++ = htons(0xf227); // fmove.l fpiar,-(sp) |
374 |
– |
*q++ = htons(0xa400); |
375 |
– |
*q++ = htons(0xf227); // fmove.l fpsr,-(sp) |
376 |
– |
*q++ = htons(0xa800); |
377 |
– |
*q++ = htons(0xf227); // fmove.l fpcr,-(sp) |
378 |
– |
*q++ = htons(0xb000); |
379 |
– |
*q++ = htons(0x4879); // pea -1 (push "FPU state saved" flag) |
380 |
– |
*q++ = htons(0xffff); |
381 |
– |
*q++ = htons(0xffff); |
382 |
– |
p16 += 7; |
383 |
– |
for (i=0; i<23; i++) *q++ = *p16++; |
384 |
– |
*q++ = htons(0x4a2f); // tst.b 2(sp) (null FPU state or "FPU state saved" flag set?) |
385 |
– |
*q++ = htons(2); |
386 |
– |
*q++ = htons(0x6712); // beq |
387 |
– |
*q++ = htons(0x588f); // addq.l #2,sp (flag set, skip it) |
388 |
– |
*q++ = htons(0xf21f); // fmove.l (sp)+,fpcr (restore FPU registers) |
389 |
– |
*q++ = htons(0x9000); |
390 |
– |
*q++ = htons(0xf21f); // fmove.l (sp)+,fpsr |
391 |
– |
*q++ = htons(0x8800); |
392 |
– |
*q++ = htons(0xf21f); // fmove.l (sp)+,fpiar |
393 |
– |
*q++ = htons(0x8400); |
394 |
– |
*q++ = htons(0xf21f); // fmovem.x (sp)+,fp0-fp7 |
395 |
– |
*q++ = htons(0xd0ff); |
396 |
– |
p16 += 7; |
397 |
– |
for (i=0; i<20; i++) *q++ = *p16++; |
398 |
– |
|
399 |
– |
p16 = (uint16 *)(p + base); |
400 |
– |
*p16++ = htons(M68K_JMP); |
401 |
– |
*p16++ = htons(start >> 16); |
402 |
– |
*p16 = htons(start & 0xffff); |
403 |
– |
FlushCodeCache(p + base, 6); |
404 |
– |
D(bug(" patch 5 applied\n")); |
405 |
– |
|
406 |
– |
base = find_rsrc_data(p, size - base - 2, dat4, sizeof(dat4), base + 2); |
407 |
– |
if (base) { // FPU -> no FPU |
408 |
– |
|
409 |
– |
p16 = (uint16 *)(p + base); |
410 |
– |
start = (uint32)q; |
411 |
– |
for (i=0; i<4; i++) *q++ = *p16++; |
412 |
– |
*q++ = htons(0x675e); // beq |
413 |
– |
p16++; |
414 |
– |
for (i=0; i<21; i++) *q++ = *p16++; |
415 |
– |
*q++ = htons(0x4a2f); // tst.b 2(sp) (null FPU state?) |
416 |
– |
*q++ = htons(2); |
417 |
– |
*q++ = htons(0x6716); // beq |
418 |
– |
*q++ = htons(0xf227); // fmovem.x fp0-fp7,-(sp) (no, save FPU registers) |
419 |
– |
*q++ = htons(0xe0ff); |
420 |
– |
*q++ = htons(0xf227); // fmove.l fpiar,-(sp) |
421 |
– |
*q++ = htons(0xa400); |
422 |
– |
*q++ = htons(0xf227); // fmove.l fpsr,-(sp) |
423 |
– |
*q++ = htons(0xa800); |
424 |
– |
*q++ = htons(0xf227); // fmove.l fpcr,-(sp) |
425 |
– |
*q++ = htons(0xb000); |
426 |
– |
*q++ = htons(0x4879); // pea -1 (push "FPU state saved" flag) |
427 |
– |
*q++ = htons(0xffff); |
428 |
– |
*q++ = htons(0xffff); |
429 |
– |
p16 += 7; |
430 |
– |
for (i=0; i<42; i++) *q++ = *p16++; |
431 |
– |
|
432 |
– |
p16 = (uint16 *)(p + base); |
433 |
– |
*p16++ = htons(M68K_JMP); |
434 |
– |
*p16++ = htons(start >> 16); |
435 |
– |
*p16 = htons(start & 0xffff); |
436 |
– |
FlushCodeCache(p + base, 6); |
437 |
– |
D(bug(" patch 6 applied\n")); |
438 |
– |
} |
439 |
– |
} |
440 |
– |
} |
441 |
– |
} |
442 |
– |
|
443 |
– |
FlushCodeCache(ThPatchSpace, 1024); |
444 |
– |
|
445 |
– |
// Patch Thread Manager FPU init for 68060 FPU (7.5, 8.0) |
446 |
– |
static const uint8 dat5[] = {0x4a, 0x28, 0x00, 0xa4, 0x67, 0x0a, 0x4a, 0x2c, 0x00, 0x40}; |
447 |
– |
base = find_rsrc_data(p, size, dat5, sizeof(dat5)); |
448 |
– |
if (base) { |
449 |
– |
p16 = (uint16 *)(p + base + 6); |
450 |
– |
*p16++ = htons(M68K_JSR); |
451 |
– |
*p16++ = htons((uint32)ThInitFPUPatch >> 16); |
452 |
– |
*p16++ = htons((uint32)ThInitFPUPatch & 0xffff); |
453 |
– |
*p16++ = htons(M68K_NOP); |
454 |
– |
*p16 = htons(M68K_NOP); |
455 |
– |
FlushCodeCache(p + base + 6, 10); |
456 |
– |
D(bug(" patch 7 applied\n")); |
457 |
– |
} |
458 |
– |
#endif |
459 |
– |
|
192 |
|
} else if (type == FOURCC('g','p','c','h') && id == 750) { |
193 |
|
D(bug(" gpch 750 found\n")); |
194 |
|
|
195 |
|
// Don't use PTEST instruction in BlockMove() (7.5, 7.6, 7.6.1, 8.0) |
196 |
< |
static const uint8 dat[] = {0xa0, 0x8d, 0x0c, 0x81, 0x00, 0x00, 0x0c, 0x00, 0x65, 0x06, 0x4e, 0x71, 0xf4, 0xf8}; |
196 |
> |
static const uint8 dat[] = {0x20, 0x5f, 0x22, 0x5f, 0x0c, 0x38, 0x00, 0x04, 0x01, 0x2f}; |
197 |
|
base = find_rsrc_data(p, size, dat, sizeof(dat)); |
198 |
|
if (base) { |
199 |
< |
p16 = (uint16 *)(p + base + 8); |
200 |
< |
*p16 = htons(M68K_NOP); |
201 |
< |
FlushCodeCache(p + base + 8, 2); |
199 |
> |
p16 = (uint16 *)(p + base + 4); |
200 |
> |
*p16++ = htons(M68K_EMUL_OP_BLOCK_MOVE); |
201 |
> |
*p16++ = htons(0x7000); |
202 |
> |
*p16 = htons(M68K_RTS); |
203 |
> |
FlushCodeCache(p + base + 4, 6); |
204 |
|
D(bug(" patch 1 applied\n")); |
205 |
|
} |
206 |
|
|
246 |
|
D(bug(" patch 2 applied\n")); |
247 |
|
} |
248 |
|
|
515 |
– |
#if !EMULATED_68K |
516 |
– |
} else if (CPUIs68060 && type == FOURCC('s','c','o','d') && (id == -16463 || id == -16464)) { |
517 |
– |
D(bug(" scod -16463/-16464 found\n")); |
518 |
– |
|
519 |
– |
// Correct 68060 FP frame handling in Process Manager task switches (7.1, 7.5, 8.0) |
520 |
– |
static const uint8 dat[] = {0xf3, 0x27, 0x4a, 0x17}; |
521 |
– |
base = find_rsrc_data(p, size, dat, sizeof(dat)); |
522 |
– |
if (base) { |
523 |
– |
p16 = (uint16 *)(p + base); |
524 |
– |
*p16++ = htons(M68K_JMP); |
525 |
– |
*p16++ = htons((uint32)Scod060Patch1 >> 16); |
526 |
– |
*p16 = htons((uint32)Scod060Patch1 & 0xffff); |
527 |
– |
FlushCodeCache(p + base, 6); |
528 |
– |
D(bug(" patch 1 applied\n")); |
529 |
– |
} |
530 |
– |
|
531 |
– |
// Even a null FP frame is 3 longwords on the 68060 (7.1, 7.5, 8.0) |
532 |
– |
static const uint8 dat2[] = {0xf3, 0x5f, 0x4e, 0x75}; |
533 |
– |
base = find_rsrc_data(p, size, dat2, sizeof(dat2)); |
534 |
– |
if (base) { |
535 |
– |
p16 = (uint16 *)(p + base - 2); |
536 |
– |
*p16++ = htons(M68K_JMP); |
537 |
– |
*p16++ = htons((uint32)Scod060Patch2 >> 16); |
538 |
– |
*p16 = htons((uint32)Scod060Patch2 & 0xffff); |
539 |
– |
FlushCodeCache(p + base - 2, 6); |
540 |
– |
D(bug(" patch 2 applied\n")); |
541 |
– |
} |
542 |
– |
#endif |
543 |
– |
|
249 |
|
} else if (type == FOURCC('t','h','n','g') && id == -16563) { |
250 |
|
D(bug(" thng -16563 found\n")); |
251 |
|
|