[CPU] Use reserved form of sc for imports.
This commit is contained in:
parent
e2346ee539
commit
cc47704a6b
|
@ -423,9 +423,16 @@ int InstrEmit_mcrf(PPCHIRBuilder& f, const InstrData& i) {
|
||||||
// System linkage (A-24)
|
// System linkage (A-24)
|
||||||
|
|
||||||
int InstrEmit_sc(PPCHIRBuilder& f, const InstrData& i) {
|
int InstrEmit_sc(PPCHIRBuilder& f, const InstrData& i) {
|
||||||
|
// Game code should only ever use LEV=0.
|
||||||
|
// LEV=2 is to signify 'call import' from Xenia.
|
||||||
|
// TODO(gibbed): syscalls!
|
||||||
|
if (i.SC.LEV == 2) {
|
||||||
f.CallExtern(f.function());
|
f.CallExtern(f.function());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
XEINSTRNOTIMPLEMENTED();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Trap (A-25)
|
// Trap (A-25)
|
||||||
|
|
||||||
|
|
|
@ -1225,15 +1225,17 @@ bool XexModule::SetupLibraryImports(const char* name,
|
||||||
// bctr
|
// bctr
|
||||||
// Real consoles rewrite this with some code that sets r11.
|
// Real consoles rewrite this with some code that sets r11.
|
||||||
// If we did that we'd still have to put a thunk somewhere and do the
|
// If we did that we'd still have to put a thunk somewhere and do the
|
||||||
// dynamic lookup. Instead, we rewrite it to use syscalls, as they
|
// dynamic lookup. Instead, we rewrite it to use syscalls.
|
||||||
// aren't used on the 360. CPU backends can either take the syscall
|
// We use sc with a LEV operand of 2, which is reserved usage and
|
||||||
// or do something smarter.
|
// should never see actual usage outside of our rewrite.
|
||||||
// sc
|
// CPU backends can either take the special form syscall or do
|
||||||
|
// something smarter.
|
||||||
|
// sc 2
|
||||||
// blr
|
// blr
|
||||||
// nop
|
// nop
|
||||||
// nop
|
// nop
|
||||||
uint8_t* p = memory()->TranslateVirtual(record_addr);
|
uint8_t* p = memory()->TranslateVirtual(record_addr);
|
||||||
xe::store_and_swap<uint32_t>(p + 0x0, 0x44000002);
|
xe::store_and_swap<uint32_t>(p + 0x0, 0x44000042);
|
||||||
xe::store_and_swap<uint32_t>(p + 0x4, 0x4E800020);
|
xe::store_and_swap<uint32_t>(p + 0x4, 0x4E800020);
|
||||||
xe::store_and_swap<uint32_t>(p + 0x8, 0x60000000);
|
xe::store_and_swap<uint32_t>(p + 0x8, 0x60000000);
|
||||||
xe::store_and_swap<uint32_t>(p + 0xC, 0x60000000);
|
xe::store_and_swap<uint32_t>(p + 0xC, 0x60000000);
|
||||||
|
|
Loading…
Reference in New Issue