| 40 |
#include "audio_defs.h" |
#include "audio_defs.h" |
| 41 |
#include "serial.h" |
#include "serial.h" |
| 42 |
#include "macos_util.h" |
#include "macos_util.h" |
| 43 |
|
#include "thunks.h" |
| 44 |
|
|
| 45 |
#define DEBUG 0 |
#define DEBUG 0 |
| 46 |
#include "debug.h" |
#include "debug.h" |
| 448 |
0x4e, 0x75 // rts |
0x4e, 0x75 // rts |
| 449 |
}; |
}; |
| 450 |
|
|
| 451 |
#if EMULATED_PPC |
static uint32 long_ptr; |
|
#define SERIAL_TRAMPOLINES 1 |
|
|
static uint32 serial_nothing_tvect[2] = {tswap32(POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_NOTHING)), 0}; |
|
|
static uint32 serial_open_tvect[2] = {tswap32(POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_OPEN)), 0}; |
|
|
static uint32 serial_prime_in_tvect[2] = {tswap32(POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_PRIME_IN)), 0}; |
|
|
static uint32 serial_prime_out_tvect[2] = {tswap32(POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_PRIME_OUT)), 0}; |
|
|
static uint32 serial_control_tvect[2] = {tswap32(POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_CONTROL)), 0}; |
|
|
static uint32 serial_status_tvect[2] = {tswap32(POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_STATUS)), 0}; |
|
|
static uint32 serial_close_tvect[2] = {tswap32(POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_CLOSE)), 0}; |
|
|
#elif defined(__linux__) |
|
|
#define SERIAL_TRAMPOLINES 1 |
|
|
static uint32 serial_nothing_tvect[2] = {(uint32)SerialNothing, 0}; |
|
|
static uint32 serial_open_tvect[2] = {(uint32)SerialOpen, 0}; |
|
|
static uint32 serial_prime_in_tvect[2] = {(uint32)SerialPrimeIn, 0}; |
|
|
static uint32 serial_prime_out_tvect[2] = {(uint32)SerialPrimeOut, 0}; |
|
|
static uint32 serial_control_tvect[2] = {(uint32)SerialControl, 0}; |
|
|
static uint32 serial_status_tvect[2] = {(uint32)SerialStatus, 0}; |
|
|
static uint32 serial_close_tvect[2] = {(uint32)SerialClose, 0}; |
|
|
#endif |
|
| 452 |
|
|
| 453 |
static const uint32 ain_driver[] = { // .AIn driver header |
static void SetLongBase(uint32 addr) |
| 454 |
0x4d000000, 0x00000000, |
{ |
| 455 |
0x00200040, 0x00600080, |
long_ptr = addr; |
| 456 |
0x00a0042e, 0x41496e00, |
} |
| 457 |
0x00000000, 0x00000000, |
|
| 458 |
0xaafe0700, 0x00000000, |
static void Long(uint32 value) |
| 459 |
0x00000000, 0x00179822, |
{ |
| 460 |
#ifdef SERIAL_TRAMPOLINES |
WriteMacInt32(long_ptr, value); |
| 461 |
0x00010004, (uint32)serial_nothing_tvect, |
long_ptr += 4; |
| 462 |
#else |
} |
| 463 |
0x00010004, (uint32)SerialNothing, |
|
| 464 |
#endif |
static void gen_ain_driver(uintptr addr) |
| 465 |
0x00000000, 0x00000000, |
{ |
| 466 |
0xaafe0700, 0x00000000, |
SetLongBase(addr); |
| 467 |
0x00000000, 0x00179822, |
|
| 468 |
#ifdef SERIAL_TRAMPOLINES |
// .AIn driver header |
| 469 |
0x00010004, (uint32)serial_prime_in_tvect, |
Long(0x4d000000); Long(0x00000000); |
| 470 |
#else |
Long(0x00200040); Long(0x00600080); |
| 471 |
0x00010004, (uint32)SerialPrimeIn, |
Long(0x00a0042e); Long(0x41496e00); |
| 472 |
#endif |
Long(0x00000000); Long(0x00000000); |
| 473 |
0x00000000, 0x00000000, |
Long(0xaafe0700); Long(0x00000000); |
| 474 |
0xaafe0700, 0x00000000, |
Long(0x00000000); Long(0x00179822); |
| 475 |
0x00000000, 0x00179822, |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_NOTHING)); |
| 476 |
#ifdef SERIAL_TRAMPOLINES |
Long(0x00000000); Long(0x00000000); |
| 477 |
0x00010004, (uint32)serial_control_tvect, |
Long(0xaafe0700); Long(0x00000000); |
| 478 |
#else |
Long(0x00000000); Long(0x00179822); |
| 479 |
0x00010004, (uint32)SerialControl, |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_PRIME_IN)); |
| 480 |
#endif |
Long(0x00000000); Long(0x00000000); |
| 481 |
0x00000000, 0x00000000, |
Long(0xaafe0700); Long(0x00000000); |
| 482 |
0xaafe0700, 0x00000000, |
Long(0x00000000); Long(0x00179822); |
| 483 |
0x00000000, 0x00179822, |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_CONTROL)); |
| 484 |
#ifdef SERIAL_TRAMPOLINES |
Long(0x00000000); Long(0x00000000); |
| 485 |
0x00010004, (uint32)serial_status_tvect, |
Long(0xaafe0700); Long(0x00000000); |
| 486 |
#else |
Long(0x00000000); Long(0x00179822); |
| 487 |
0x00010004, (uint32)SerialStatus, |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_STATUS)); |
| 488 |
#endif |
Long(0x00000000); Long(0x00000000); |
| 489 |
0x00000000, 0x00000000, |
Long(0xaafe0700); Long(0x00000000); |
| 490 |
0xaafe0700, 0x00000000, |
Long(0x00000000); Long(0x00179822); |
| 491 |
0x00000000, 0x00179822, |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_NOTHING)); |
| 492 |
#ifdef SERIAL_TRAMPOLINES |
Long(0x00000000); Long(0x00000000); |
|
0x00010004, (uint32)serial_nothing_tvect, |
|
|
#else |
|
|
0x00010004, (uint32)SerialNothing, |
|
|
#endif |
|
|
0x00000000, 0x00000000, |
|
| 493 |
}; |
}; |
| 494 |
|
|
| 495 |
static const uint32 aout_driver[] = { // .AOut driver header |
static void gen_aout_driver(uintptr addr) |
| 496 |
0x4d000000, 0x00000000, |
{ |
| 497 |
0x00200040, 0x00600080, |
SetLongBase(addr); |
| 498 |
0x00a0052e, 0x414f7574, |
|
| 499 |
0x00000000, 0x00000000, |
// .AOut driver header |
| 500 |
0xaafe0700, 0x00000000, |
Long(0x4d000000); Long(0x00000000); |
| 501 |
0x00000000, 0x00179822, |
Long(0x00200040); Long(0x00600080); |
| 502 |
#ifdef SERIAL_TRAMPOLINES |
Long(0x00a0052e); Long(0x414f7574); |
| 503 |
0x00010004, (uint32)serial_open_tvect, |
Long(0x00000000); Long(0x00000000); |
| 504 |
#else |
Long(0xaafe0700); Long(0x00000000); |
| 505 |
0x00010004, (uint32)SerialOpen, |
Long(0x00000000); Long(0x00179822); |
| 506 |
#endif |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_OPEN)); |
| 507 |
0x00000000, 0x00000000, |
Long(0x00000000); Long(0x00000000); |
| 508 |
0xaafe0700, 0x00000000, |
Long(0xaafe0700); Long(0x00000000); |
| 509 |
0x00000000, 0x00179822, |
Long(0x00000000); Long(0x00179822); |
| 510 |
#ifdef SERIAL_TRAMPOLINES |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_PRIME_OUT)); |
| 511 |
0x00010004, (uint32)serial_prime_out_tvect, |
Long(0x00000000); Long(0x00000000); |
| 512 |
#else |
Long(0xaafe0700); Long(0x00000000); |
| 513 |
0x00010004, (uint32)SerialPrimeOut, |
Long(0x00000000); Long(0x00179822); |
| 514 |
#endif |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_CONTROL)); |
| 515 |
0x00000000, 0x00000000, |
Long(0x00000000); Long(0x00000000); |
| 516 |
0xaafe0700, 0x00000000, |
Long(0xaafe0700); Long(0x00000000); |
| 517 |
0x00000000, 0x00179822, |
Long(0x00000000); Long(0x00179822); |
| 518 |
#ifdef SERIAL_TRAMPOLINES |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_STATUS)); |
| 519 |
0x00010004, (uint32)serial_control_tvect, |
Long(0x00000000); Long(0x00000000); |
| 520 |
#else |
Long(0xaafe0700); Long(0x00000000); |
| 521 |
0x00010004, (uint32)SerialControl, |
Long(0x00000000); Long(0x00179822); |
| 522 |
#endif |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_CLOSE)); |
| 523 |
0x00000000, 0x00000000, |
Long(0x00000000); Long(0x00000000); |
|
0xaafe0700, 0x00000000, |
|
|
0x00000000, 0x00179822, |
|
|
#ifdef SERIAL_TRAMPOLINES |
|
|
0x00010004, (uint32)serial_status_tvect, |
|
|
#else |
|
|
0x00010004, (uint32)SerialStatus, |
|
|
#endif |
|
|
0x00000000, 0x00000000, |
|
|
0xaafe0700, 0x00000000, |
|
|
0x00000000, 0x00179822, |
|
|
#ifdef SERIAL_TRAMPOLINES |
|
|
0x00010004, (uint32)serial_close_tvect, |
|
|
#else |
|
|
0x00010004, (uint32)SerialClose, |
|
|
#endif |
|
|
0x00000000, 0x00000000, |
|
| 524 |
}; |
}; |
| 525 |
|
|
| 526 |
static const uint32 bin_driver[] = { // .BIn driver header |
static void gen_bin_driver(uintptr addr) |
| 527 |
0x4d000000, 0x00000000, |
{ |
| 528 |
0x00200040, 0x00600080, |
SetLongBase(addr); |
| 529 |
0x00a0042e, 0x42496e00, |
|
| 530 |
0x00000000, 0x00000000, |
// .BIn driver header |
| 531 |
0xaafe0700, 0x00000000, |
Long(0x4d000000); Long(0x00000000); |
| 532 |
0x00000000, 0x00179822, |
Long(0x00200040); Long(0x00600080); |
| 533 |
#ifdef SERIAL_TRAMPOLINES |
Long(0x00a0042e); Long(0x42496e00); |
| 534 |
0x00010004, (uint32)serial_nothing_tvect, |
Long(0x00000000); Long(0x00000000); |
| 535 |
#else |
Long(0xaafe0700); Long(0x00000000); |
| 536 |
0x00010004, (uint32)SerialNothing, |
Long(0x00000000); Long(0x00179822); |
| 537 |
#endif |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_NOTHING)); |
| 538 |
0x00000000, 0x00000000, |
Long(0x00000000); Long(0x00000000); |
| 539 |
0xaafe0700, 0x00000000, |
Long(0xaafe0700); Long(0x00000000); |
| 540 |
0x00000000, 0x00179822, |
Long(0x00000000); Long(0x00179822); |
| 541 |
#ifdef SERIAL_TRAMPOLINES |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_PRIME_IN)); |
| 542 |
0x00010004, (uint32)serial_prime_in_tvect, |
Long(0x00000000); Long(0x00000000); |
| 543 |
#else |
Long(0xaafe0700); Long(0x00000000); |
| 544 |
0x00010004, (uint32)SerialPrimeIn, |
Long(0x00000000); Long(0x00179822); |
| 545 |
#endif |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_CONTROL)); |
| 546 |
0x00000000, 0x00000000, |
Long(0x00000000); Long(0x00000000); |
| 547 |
0xaafe0700, 0x00000000, |
Long(0xaafe0700); Long(0x00000000); |
| 548 |
0x00000000, 0x00179822, |
Long(0x00000000); Long(0x00179822); |
| 549 |
#ifdef SERIAL_TRAMPOLINES |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_STATUS)); |
| 550 |
0x00010004, (uint32)serial_control_tvect, |
Long(0x00000000); Long(0x00000000); |
| 551 |
#else |
Long(0xaafe0700); Long(0x00000000); |
| 552 |
0x00010004, (uint32)SerialControl, |
Long(0x00000000); Long(0x00179822); |
| 553 |
#endif |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_NOTHING)); |
| 554 |
0x00000000, 0x00000000, |
Long(0x00000000); Long(0x00000000); |
|
0xaafe0700, 0x00000000, |
|
|
0x00000000, 0x00179822, |
|
|
#ifdef SERIAL_TRAMPOLINES |
|
|
0x00010004, (uint32)serial_status_tvect, |
|
|
#else |
|
|
0x00010004, (uint32)SerialStatus, |
|
|
#endif |
|
|
0x00000000, 0x00000000, |
|
|
0xaafe0700, 0x00000000, |
|
|
0x00000000, 0x00179822, |
|
|
#ifdef SERIAL_TRAMPOLINES |
|
|
0x00010004, (uint32)serial_nothing_tvect, |
|
|
#else |
|
|
0x00010004, (uint32)SerialNothing, |
|
|
#endif |
|
|
0x00000000, 0x00000000, |
|
| 555 |
}; |
}; |
| 556 |
|
|
| 557 |
static const uint32 bout_driver[] = { // .BOut driver header |
static void gen_bout_driver(uintptr addr) |
| 558 |
0x4d000000, 0x00000000, |
{ |
| 559 |
0x00200040, 0x00600080, |
SetLongBase(addr); |
| 560 |
0x00a0052e, 0x424f7574, |
|
| 561 |
0x00000000, 0x00000000, |
// .BOut driver header |
| 562 |
0xaafe0700, 0x00000000, |
Long(0x4d000000); Long(0x00000000); |
| 563 |
0x00000000, 0x00179822, |
Long(0x00200040); Long(0x00600080); |
| 564 |
#ifdef SERIAL_TRAMPOLINES |
Long(0x00a0052e); Long(0x424f7574); |
| 565 |
0x00010004, (uint32)serial_open_tvect, |
Long(0x00000000); Long(0x00000000); |
| 566 |
#else |
Long(0xaafe0700); Long(0x00000000); |
| 567 |
0x00010004, (uint32)SerialOpen, |
Long(0x00000000); Long(0x00179822); |
| 568 |
#endif |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_OPEN)); |
| 569 |
0x00000000, 0x00000000, |
Long(0x00000000); Long(0x00000000); |
| 570 |
0xaafe0700, 0x00000000, |
Long(0xaafe0700); Long(0x00000000); |
| 571 |
0x00000000, 0x00179822, |
Long(0x00000000); Long(0x00179822); |
| 572 |
#ifdef SERIAL_TRAMPOLINES |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_PRIME_OUT)); |
| 573 |
0x00010004, (uint32)serial_prime_out_tvect, |
Long(0x00000000); Long(0x00000000); |
| 574 |
#else |
Long(0xaafe0700); Long(0x00000000); |
| 575 |
0x00010004, (uint32)SerialPrimeOut, |
Long(0x00000000); Long(0x00179822); |
| 576 |
#endif |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_CONTROL)); |
| 577 |
0x00000000, 0x00000000, |
Long(0x00000000); Long(0x00000000); |
| 578 |
0xaafe0700, 0x00000000, |
Long(0xaafe0700); Long(0x00000000); |
| 579 |
0x00000000, 0x00179822, |
Long(0x00000000); Long(0x00179822); |
| 580 |
#ifdef SERIAL_TRAMPOLINES |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_STATUS)); |
| 581 |
0x00010004, (uint32)serial_control_tvect, |
Long(0x00000000); Long(0x00000000); |
| 582 |
#else |
Long(0xaafe0700); Long(0x00000000); |
| 583 |
0x00010004, (uint32)SerialControl, |
Long(0x00000000); Long(0x00179822); |
| 584 |
#endif |
Long(0x00010004); Long(NativeTVECT(NATIVE_SERIAL_CLOSE)); |
| 585 |
0x00000000, 0x00000000, |
Long(0x00000000); Long(0x00000000); |
|
0xaafe0700, 0x00000000, |
|
|
0x00000000, 0x00179822, |
|
|
#ifdef SERIAL_TRAMPOLINES |
|
|
0x00010004, (uint32)serial_status_tvect, |
|
|
#else |
|
|
0x00010004, (uint32)SerialStatus, |
|
|
#endif |
|
|
0x00000000, 0x00000000, |
|
|
0xaafe0700, 0x00000000, |
|
|
0x00000000, 0x00179822, |
|
|
#ifdef SERIAL_TRAMPOLINES |
|
|
0x00010004, (uint32)serial_close_tvect, |
|
|
#else |
|
|
0x00010004, (uint32)SerialClose, |
|
|
#endif |
|
|
0x00000000, 0x00000000, |
|
| 586 |
}; |
}; |
| 587 |
|
|
| 588 |
static const uint8 adbop_patch[] = { // Call ADBOp() completion procedure |
static const uint8 adbop_patch[] = { // Call ADBOp() completion procedure |
| 1039 |
lp = (uint32 *)(ROM_BASE + 0x36f900); |
lp = (uint32 *)(ROM_BASE + 0x36f900); |
| 1040 |
*lp++ = htonl(0x7c2903a6); // mtctr r1 |
*lp++ = htonl(0x7c2903a6); // mtctr r1 |
| 1041 |
#if EMULATED_PPC |
#if EMULATED_PPC |
| 1042 |
*lp++ = POWERPC_NATIVE_OP(NATIVE_DISABLE_INTERRUPT); |
*lp++ = htonl(NativeOpcode(NATIVE_DISABLE_INTERRUPT)); |
| 1043 |
#else |
#else |
| 1044 |
*lp++ = htonl(0x80200000 + XLM_IRQ_NEST); // lwz r1,XLM_IRQ_NEST |
*lp++ = htonl(0x80200000 + XLM_IRQ_NEST); // lwz r1,XLM_IRQ_NEST |
| 1045 |
*lp++ = htonl(0x38210001); // addi r1,r1,1 |
*lp++ = htonl(0x38210001); // addi r1,r1,1 |
| 1073 |
lp = (uint32 *)(ROM_BASE + 0x36fa00); |
lp = (uint32 *)(ROM_BASE + 0x36fa00); |
| 1074 |
*lp++ = htonl(0x7c2903a6); // mtctr r1 |
*lp++ = htonl(0x7c2903a6); // mtctr r1 |
| 1075 |
#if EMULATED_PPC |
#if EMULATED_PPC |
| 1076 |
*lp++ = POWERPC_NATIVE_OP(NATIVE_DISABLE_INTERRUPT); |
*lp++ = htonl(NativeOpcode(NATIVE_DISABLE_INTERRUPT)); |
| 1077 |
#else |
#else |
| 1078 |
*lp++ = htonl(0x80200000 + XLM_IRQ_NEST); // lwz r1,XLM_IRQ_NEST |
*lp++ = htonl(0x80200000 + XLM_IRQ_NEST); // lwz r1,XLM_IRQ_NEST |
| 1079 |
*lp++ = htonl(0x38210001); // addi r1,r1,1 |
*lp++ = htonl(0x38210001); // addi r1,r1,1 |
| 1107 |
lp = (uint32 *)(ROM_BASE + 0x36fb00); |
lp = (uint32 *)(ROM_BASE + 0x36fb00); |
| 1108 |
*lp++ = htonl(0x7c2903a6); // mtctr r1 |
*lp++ = htonl(0x7c2903a6); // mtctr r1 |
| 1109 |
#if EMULATED_PPC |
#if EMULATED_PPC |
| 1110 |
*lp++ = POWERPC_NATIVE_OP(NATIVE_DISABLE_INTERRUPT); |
*lp++ = htonl(NativeOpcode(NATIVE_DISABLE_INTERRUPT)); |
| 1111 |
#else |
#else |
| 1112 |
*lp++ = htonl(0x80200000 + XLM_IRQ_NEST); // lwz r1,XLM_IRQ_NEST |
*lp++ = htonl(0x80200000 + XLM_IRQ_NEST); // lwz r1,XLM_IRQ_NEST |
| 1113 |
*lp++ = htonl(0x38210001); // addi r1,r1,1 |
*lp++ = htonl(0x38210001); // addi r1,r1,1 |
| 1141 |
lp = (uint32 *)(ROM_BASE + 0x36fc00); |
lp = (uint32 *)(ROM_BASE + 0x36fc00); |
| 1142 |
*lp++ = htonl(0x7c2903a6); // mtctr r1 |
*lp++ = htonl(0x7c2903a6); // mtctr r1 |
| 1143 |
#if EMULATED_PPC |
#if EMULATED_PPC |
| 1144 |
*lp++ = POWERPC_NATIVE_OP(NATIVE_DISABLE_INTERRUPT); |
*lp++ = htonl(NativeOpcode(NATIVE_DISABLE_INTERRUPT)); |
| 1145 |
#else |
#else |
| 1146 |
*lp++ = htonl(0x80200000 + XLM_IRQ_NEST); // lwz r1,XLM_IRQ_NEST |
*lp++ = htonl(0x80200000 + XLM_IRQ_NEST); // lwz r1,XLM_IRQ_NEST |
| 1147 |
*lp++ = htonl(0x38210001); // addi r1,r1,1 |
*lp++ = htonl(0x38210001); // addi r1,r1,1 |
| 1282 |
|
|
| 1283 |
lp = (uint32 *)(ROM_BASE + 0x318000); |
lp = (uint32 *)(ROM_BASE + 0x318000); |
| 1284 |
#if EMULATED_PPC |
#if EMULATED_PPC |
| 1285 |
*lp++ = POWERPC_NATIVE_OP(NATIVE_ENABLE_INTERRUPT); |
*lp++ = htonl(NativeOpcode(NATIVE_ENABLE_INTERRUPT)); |
| 1286 |
*lp = htonl(0x48000000 + ((xlp - 0x8004) & 0x03fffffc)); // b ROM_BASE+0x312c2c |
*lp = htonl(0x48000000 + ((xlp - 0x8004) & 0x03fffffc)); // b ROM_BASE+0x312c2c |
| 1287 |
#else |
#else |
| 1288 |
*lp++ = htonl(0x81400000 + XLM_IRQ_NEST); // lwz r10,XLM_IRQ_NEST |
*lp++ = htonl(0x81400000 + XLM_IRQ_NEST); // lwz r10,XLM_IRQ_NEST |
| 1962 |
memcpy((void *)(ROM_BASE + sony_offset + 0x200), cdrom_driver, sizeof(cdrom_driver)); |
memcpy((void *)(ROM_BASE + sony_offset + 0x200), cdrom_driver, sizeof(cdrom_driver)); |
| 1963 |
|
|
| 1964 |
// Install serial drivers |
// Install serial drivers |
| 1965 |
memcpy_powerpc_code((void *)(ROM_BASE + sony_offset + 0x300), ain_driver, sizeof(ain_driver)); |
gen_ain_driver( ROM_BASE + sony_offset + 0x300); |
| 1966 |
memcpy_powerpc_code((void *)(ROM_BASE + sony_offset + 0x400), aout_driver, sizeof(aout_driver)); |
gen_aout_driver(ROM_BASE + sony_offset + 0x400); |
| 1967 |
memcpy_powerpc_code((void *)(ROM_BASE + sony_offset + 0x500), bin_driver, sizeof(bin_driver)); |
gen_bin_driver( ROM_BASE + sony_offset + 0x500); |
| 1968 |
memcpy_powerpc_code((void *)(ROM_BASE + sony_offset + 0x600), bout_driver, sizeof(bout_driver)); |
gen_bout_driver(ROM_BASE + sony_offset + 0x600); |
| 1969 |
|
|
| 1970 |
// Copy icons to ROM |
// Copy icons to ROM |
| 1971 |
SonyDiskIconAddr = ROM_BASE + sony_offset + 0x800; |
SonyDiskIconAddr = ROM_BASE + sony_offset + 0x800; |
| 2167 |
{ |
{ |
| 2168 |
D(bug("Installing drivers...\n")); |
D(bug("Installing drivers...\n")); |
| 2169 |
M68kRegisters r; |
M68kRegisters r; |
| 2170 |
uint8 pb[SIZEOF_IOParam]; |
SheepArray<SIZEOF_IOParam> pb_var; |
| 2171 |
|
const uintptr pb = pb_var.addr(); |
| 2172 |
|
|
| 2173 |
// Install floppy driver |
// Install floppy driver |
| 2174 |
if (ROMType == ROMTYPE_NEWWORLD || ROMType == ROMTYPE_GOSSAMER) { |
if (ROMType == ROMTYPE_NEWWORLD || ROMType == ROMTYPE_GOSSAMER) { |
| 2191 |
#endif |
#endif |
| 2192 |
|
|
| 2193 |
// Open .Sony driver |
// Open .Sony driver |
| 2194 |
WriteMacInt8((uint32)pb + ioPermssn, 0); |
SheepString sony_str("\005.Sony"); |
| 2195 |
WriteMacInt32((uint32)pb + ioNamePtr, (uint32)"\005.Sony"); |
WriteMacInt8(pb + ioPermssn, 0); |
| 2196 |
r.a[0] = (uint32)pb; |
WriteMacInt32(pb + ioNamePtr, sony_str.addr()); |
| 2197 |
|
r.a[0] = pb; |
| 2198 |
Execute68kTrap(0xa000, &r); // Open() |
Execute68kTrap(0xa000, &r); // Open() |
| 2199 |
|
|
| 2200 |
// Install disk driver |
// Install disk driver |
| 2208 |
WriteMacInt16(dce + dCtlFlags, DiskDriverFlags); |
WriteMacInt16(dce + dCtlFlags, DiskDriverFlags); |
| 2209 |
|
|
| 2210 |
// Open disk driver |
// Open disk driver |
| 2211 |
WriteMacInt32((uint32)pb + ioNamePtr, (uint32)"\005.Disk"); |
SheepString disk_str("\005.Disk"); |
| 2212 |
r.a[0] = (uint32)pb; |
WriteMacInt32(pb + ioNamePtr, disk_str.addr()); |
| 2213 |
|
r.a[0] = pb; |
| 2214 |
Execute68kTrap(0xa000, &r); // Open() |
Execute68kTrap(0xa000, &r); // Open() |
| 2215 |
|
|
| 2216 |
// Install CD-ROM driver unless nocdrom option given |
// Install CD-ROM driver unless nocdrom option given |
| 2227 |
WriteMacInt16(dce + dCtlFlags, CDROMDriverFlags); |
WriteMacInt16(dce + dCtlFlags, CDROMDriverFlags); |
| 2228 |
|
|
| 2229 |
// Open CD-ROM driver |
// Open CD-ROM driver |
| 2230 |
WriteMacInt32((uint32)pb + ioNamePtr, (uint32)"\010.AppleCD"); |
SheepString apple_cd("\010.AppleCD"); |
| 2231 |
r.a[0] = (uint32)pb; |
WriteMacInt32(pb + ioNamePtr, apple_cd.addr()); |
| 2232 |
|
r.a[0] = pb; |
| 2233 |
Execute68kTrap(0xa000, &r); // Open() |
Execute68kTrap(0xa000, &r); // Open() |
| 2234 |
} |
} |
| 2235 |
|
|