kern: fix ARM vs THUMB mode selection on 32-bit entry

This commit is contained in:
Michael Scire 2020-07-29 15:29:01 -07:00 committed by SciresM
parent 36a3909a24
commit 5de853b662
4 changed files with 18 additions and 2 deletions

View file

@ -48,6 +48,7 @@ namespace ams::kern::arch::arm64 {
/* Dump the page tables. */
/* GetCurrentProcess().GetPageTable().DumpTable(); */
GetCurrentProcess().GetPageTable().DumpMemoryBlocks();
MESOSPHERE_PANIC("Unhandled Exception in User Mode\n");

View file

@ -77,9 +77,10 @@ namespace ams::kern::arch::arm64 {
if (is_64_bit) {
ctx->psr = 0;
} else {
constexpr u64 PsrArmValue = 0x20;
constexpr u64 PsrThumbValue = 0x00;
constexpr u64 PsrArmValue = 0x00;
constexpr u64 PsrThumbValue = 0x20;
ctx->psr = ((pc & 1) == 0 ? PsrArmValue : PsrThumbValue) | (0x10);
MESOSPHERE_LOG("Creating User 32-Thread, %016lx\n", GetInteger(pc));
}
/* Set stack pointer. */