1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-24 03:06:17 +00:00

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

@ -220,6 +220,10 @@ namespace ams::kern::arch::arm64 {
return this->page_table.DumpTable(); return this->page_table.DumpTable();
} }
void DumpMemoryBlocks() const {
return this->page_table.DumpMemoryBlocks();
}
bool GetPhysicalAddress(KPhysicalAddress *out, KProcessAddress address) const { bool GetPhysicalAddress(KPhysicalAddress *out, KProcessAddress address) const {
return this->page_table.GetPhysicalAddress(out, address); return this->page_table.GetPhysicalAddress(out, address);
} }

View file

@ -355,6 +355,16 @@ namespace ams::kern {
KScopedLightLock lk(this->general_lock); KScopedLightLock lk(this->general_lock);
this->GetImpl().Dump(GetInteger(this->address_space_start), this->address_space_end - this->address_space_start); this->GetImpl().Dump(GetInteger(this->address_space_start), this->address_space_end - this->address_space_start);
} }
void DumpMemoryBlocks() const {
KScopedLightLock lk(this->general_lock);
this->DumpMemoryBlocksLocked();
}
void DumpMemoryBlocksLocked() const {
MESOSPHERE_ASSERT(this->IsLockedByCurrentThread());
this->memory_block_manager.DumpBlocks();
}
public: public:
KProcessAddress GetAddressSpaceStart() const { return this->address_space_start; } KProcessAddress GetAddressSpaceStart() const { return this->address_space_start; }
KProcessAddress GetHeapRegionStart() const { return this->heap_region_start; } KProcessAddress GetHeapRegionStart() const { return this->heap_region_start; }

View file

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

View file

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