mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-09 22:56:35 +00:00
kern: KSupervisorPageTable now checks wxn instead of setting it
This commit is contained in:
parent
85b5f20395
commit
b7384a8667
3 changed files with 7 additions and 10 deletions
|
@ -372,6 +372,10 @@ namespace ams::kern::arch::arm64::cpu {
|
||||||
this->SetBit(19, en);
|
this->SetBit(19, en);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr ALWAYS_INLINE bool GetWxn() const {
|
||||||
|
return this->GetBits(19, 1) != 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Accessors for timer registers. */
|
/* Accessors for timer registers. */
|
||||||
|
|
|
@ -23,9 +23,8 @@ namespace ams::kern::arch::arm64 {
|
||||||
class KSupervisorPageTable {
|
class KSupervisorPageTable {
|
||||||
private:
|
private:
|
||||||
KPageTable m_page_table;
|
KPageTable m_page_table;
|
||||||
u64 m_ttbr0_identity[cpu::NumCores];
|
|
||||||
public:
|
public:
|
||||||
constexpr KSupervisorPageTable() : m_page_table(util::ConstantInitialize), m_ttbr0_identity() { /* ... */ }
|
constexpr KSupervisorPageTable() : m_page_table(util::ConstantInitialize) { /* ... */ }
|
||||||
|
|
||||||
NOINLINE void Initialize(s32 core_id);
|
NOINLINE void Initialize(s32 core_id);
|
||||||
|
|
||||||
|
@ -61,8 +60,6 @@ namespace ams::kern::arch::arm64 {
|
||||||
return m_page_table.GetPhysicalAddress(out, address);
|
return m_page_table.GetPhysicalAddress(out, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr u64 GetIdentityMapTtbr0(s32 core_id) const { return m_ttbr0_identity[core_id]; }
|
|
||||||
|
|
||||||
void DumpMemoryBlocks() const {
|
void DumpMemoryBlocks() const {
|
||||||
return m_page_table.DumpMemoryBlocks();
|
return m_page_table.DumpMemoryBlocks();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,12 +18,8 @@
|
||||||
namespace ams::kern::arch::arm64 {
|
namespace ams::kern::arch::arm64 {
|
||||||
|
|
||||||
void KSupervisorPageTable::Initialize(s32 core_id) {
|
void KSupervisorPageTable::Initialize(s32 core_id) {
|
||||||
/* Get the identity mapping ttbr0. */
|
/* Verify that sctlr_el1 has the wxn bit set. */
|
||||||
m_ttbr0_identity[core_id] = cpu::GetTtbr0El1();
|
MESOSPHERE_ABORT_UNLESS(cpu::SystemControlRegisterAccessor().GetWxn());
|
||||||
|
|
||||||
/* Set sctlr_el1 */
|
|
||||||
cpu::SystemControlRegisterAccessor().SetWxn(true).Store();
|
|
||||||
cpu::EnsureInstructionConsistency();
|
|
||||||
|
|
||||||
/* Invalidate the entire TLB. */
|
/* Invalidate the entire TLB. */
|
||||||
cpu::InvalidateEntireTlb();
|
cpu::InvalidateEntireTlb();
|
||||||
|
|
Loading…
Reference in a new issue