449 |
|
|
450 |
|
#if EMULATED_PPC |
451 |
|
#define SERIAL_TRAMPOLINES 1 |
452 |
< |
static uint32 serial_nothing_tvect[2] = {POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_NOTHING), 0}; |
453 |
< |
static uint32 serial_open_tvect[2] = {POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_OPEN), 0}; |
454 |
< |
static uint32 serial_prime_in_tvect[2] = {POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_PRIME_IN), 0}; |
455 |
< |
static uint32 serial_prime_out_tvect[2] = {POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_PRIME_OUT), 0}; |
456 |
< |
static uint32 serial_control_tvect[2] = {POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_CONTROL), 0}; |
457 |
< |
static uint32 serial_status_tvect[2] = {POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_STATUS), 0}; |
458 |
< |
static uint32 serial_close_tvect[2] = {POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_CLOSE), 0}; |
452 |
> |
static uint32 serial_nothing_tvect[2] = {tswap32(POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_NOTHING)), 0}; |
453 |
> |
static uint32 serial_open_tvect[2] = {tswap32(POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_OPEN)), 0}; |
454 |
> |
static uint32 serial_prime_in_tvect[2] = {tswap32(POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_PRIME_IN)), 0}; |
455 |
> |
static uint32 serial_prime_out_tvect[2] = {tswap32(POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_PRIME_OUT)), 0}; |
456 |
> |
static uint32 serial_control_tvect[2] = {tswap32(POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_CONTROL)), 0}; |
457 |
> |
static uint32 serial_status_tvect[2] = {tswap32(POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_STATUS)), 0}; |
458 |
> |
static uint32 serial_close_tvect[2] = {tswap32(POWERPC_NATIVE_OP_FUNC(NATIVE_SERIAL_CLOSE)), 0}; |
459 |
|
#elif defined(__linux__) |
460 |
|
#define SERIAL_TRAMPOLINES 1 |
461 |
|
static uint32 serial_nothing_tvect[2] = {(uint32)SerialNothing, 0}; |
679 |
|
|
680 |
|
|
681 |
|
/* |
682 |
+ |
* Copy PowerPC code to ROM image and reverse bytes if necessary |
683 |
+ |
*/ |
684 |
+ |
|
685 |
+ |
static inline void memcpy_powerpc_code(void *dst, const void *src, size_t len) |
686 |
+ |
{ |
687 |
+ |
#ifdef WORDS_BIGENDIAN |
688 |
+ |
(void)memcpy(dst, src, len); |
689 |
+ |
#else |
690 |
+ |
uint32 *d = (uint32 *)dst; |
691 |
+ |
uint32 *s = (uint32 *)src; |
692 |
+ |
for (int i = 0; i < len/4; i++) |
693 |
+ |
d[i] = htonl(s[i]); |
694 |
+ |
#endif |
695 |
+ |
} |
696 |
+ |
|
697 |
+ |
|
698 |
+ |
/* |
699 |
|
* Install ROM patches (RAMBase and KernelDataAddr must be set) |
700 |
|
*/ |
701 |
|
|
1983 |
|
memcpy((void *)(ROM_BASE + sony_offset + 0x200), cdrom_driver, sizeof(cdrom_driver)); |
1984 |
|
|
1985 |
|
// Install serial drivers |
1986 |
< |
memcpy((void *)(ROM_BASE + sony_offset + 0x300), ain_driver, sizeof(ain_driver)); |
1987 |
< |
memcpy((void *)(ROM_BASE + sony_offset + 0x400), aout_driver, sizeof(aout_driver)); |
1988 |
< |
memcpy((void *)(ROM_BASE + sony_offset + 0x500), bin_driver, sizeof(bin_driver)); |
1989 |
< |
memcpy((void *)(ROM_BASE + sony_offset + 0x600), bout_driver, sizeof(bout_driver)); |
1986 |
> |
memcpy_powerpc_code((void *)(ROM_BASE + sony_offset + 0x300), ain_driver, sizeof(ain_driver)); |
1987 |
> |
memcpy_powerpc_code((void *)(ROM_BASE + sony_offset + 0x400), aout_driver, sizeof(aout_driver)); |
1988 |
> |
memcpy_powerpc_code((void *)(ROM_BASE + sony_offset + 0x500), bin_driver, sizeof(bin_driver)); |
1989 |
> |
memcpy_powerpc_code((void *)(ROM_BASE + sony_offset + 0x600), bout_driver, sizeof(bout_driver)); |
1990 |
|
|
1991 |
|
// Copy icons to ROM |
1992 |
|
SonyDiskIconAddr = ROM_BASE + sony_offset + 0x800; |