Use X9 rather than LR when jumping to the guest

The homebrew ABI expects LR to be zero otherwise on exit it will jump to
it upon exit rather than exiting. Use X9 instead to fix this.
This commit is contained in:
Billy Laws 2020-06-27 17:05:23 +01:00 committed by ◱ PixelyIon
parent b823f1cd0d
commit f381883c0b

View File

@ -289,9 +289,9 @@ namespace skyline::guest {
ctx->state = ThreadState::Running; ctx->state = ThreadState::Running;
asm("MOV LR, %0\n\t" asm("MOV LR, XZR\n\t"
"MOV X0, %1\n\t" "MOV X0, %0\n\t"
"MOV X1, %2\n\t" "MOV X1, %1\n\t"
"MOV X2, XZR\n\t" "MOV X2, XZR\n\t"
"MOV X3, XZR\n\t" "MOV X3, XZR\n\t"
"MOV X4, XZR\n\t" "MOV X4, XZR\n\t"
@ -299,7 +299,7 @@ namespace skyline::guest {
"MOV X6, XZR\n\t" "MOV X6, XZR\n\t"
"MOV X7, XZR\n\t" "MOV X7, XZR\n\t"
"MOV X8, XZR\n\t" "MOV X8, XZR\n\t"
"MOV X9, XZR\n\t" "MOV X9, %2\n\t"
"MOV X10, XZR\n\t" "MOV X10, XZR\n\t"
"MOV X11, XZR\n\t" "MOV X11, XZR\n\t"
"MOV X12, XZR\n\t" "MOV X12, XZR\n\t"
@ -320,7 +320,7 @@ namespace skyline::guest {
"MOV X27, XZR\n\t" "MOV X27, XZR\n\t"
"MOV X28, XZR\n\t" "MOV X28, XZR\n\t"
"MOV X29, XZR\n\t" "MOV X29, XZR\n\t"
"RET"::"r"(address), "r"(ctx->registers.x0), "r"(ctx->registers.x1) : "x0", "x1", "lr"); "BR X9"::"r"(ctx->registers.x0), "r"(ctx->registers.x1), "r"(address) : "x0", "x1", "x9");
__builtin_unreachable(); __builtin_unreachable();
} }