kern: add (and use) generic KSystemControlBase

This commit is contained in:
Michael Scire 2021-10-25 15:07:24 -07:00 committed by SciresM
parent 1f8bf41f0b
commit 273f4a87ae
23 changed files with 704 additions and 988 deletions

View file

@ -15,6 +15,7 @@
*/
#pragma once
#include <mesosphere/kern_common.hpp>
#include <mesosphere/kern_k_system_control_base.hpp>
#ifdef ATMOSPHERE_BOARD_NINTENDO_NX
#include <mesosphere/board/nintendo/nx/kern_k_system_control.hpp>
@ -33,3 +34,18 @@
#else
#error "Unknown board for KSystemControl"
#endif
namespace ams::kern {
ALWAYS_INLINE u32 KSystemControlBase::ReadRegisterPrivileged(ams::svc::PhysicalAddress address) {
u32 v;
KSystemControl::ReadWriteRegisterPrivileged(std::addressof(v), address, 0x00000000u, 0);
return v;
}
ALWAYS_INLINE void KSystemControlBase::WriteRegisterPrivileged(ams::svc::PhysicalAddress address, u32 value) {
u32 v;
KSystemControl::ReadWriteRegisterPrivileged(std::addressof(v), address, 0xFFFFFFFFu, value);
}
}