From dfba6af22c2cff844e1397fb92739be29462c6c4 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 25 Oct 2021 17:34:47 -0700 Subject: [PATCH] kern: implement 13.1.0 kernel changes --- libmesosphere/include/mesosphere/arch/arm64/kern_cpu.hpp | 4 ++++ libmesosphere/include/mesosphere/kern_k_scheduler_lock.hpp | 3 +++ libvapours/include/vapours/svc/svc_version.hpp | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libmesosphere/include/mesosphere/arch/arm64/kern_cpu.hpp b/libmesosphere/include/mesosphere/arch/arm64/kern_cpu.hpp index 35382437..f8c39552 100644 --- a/libmesosphere/include/mesosphere/arch/arm64/kern_cpu.hpp +++ b/libmesosphere/include/mesosphere/arch/arm64/kern_cpu.hpp @@ -52,6 +52,10 @@ namespace ams::kern::arch::arm64::cpu { __asm__ __volatile__("dmb sy" ::: "memory"); } + ALWAYS_INLINE void DataMemoryBarrierInnerShareable() { + __asm__ __volatile__("dmb ish" ::: "memory"); + } + ALWAYS_INLINE void InstructionMemoryBarrier() { __asm__ __volatile__("isb" ::: "memory"); } diff --git a/libmesosphere/include/mesosphere/kern_k_scheduler_lock.hpp b/libmesosphere/include/mesosphere/kern_k_scheduler_lock.hpp index 10896f4f..e12ac118 100644 --- a/libmesosphere/include/mesosphere/kern_k_scheduler_lock.hpp +++ b/libmesosphere/include/mesosphere/kern_k_scheduler_lock.hpp @@ -74,6 +74,9 @@ namespace ams::kern { /* Release an instance of the lock. */ if ((--m_lock_count) == 0) { + /* Perform a memory barrier here. */ + cpu::DataMemoryBarrierInnerShareable(); + /* We're no longer going to hold the lock. Take note of what cores need scheduling. */ const u64 cores_needing_scheduling = SchedulerType::UpdateHighestPriorityThreads(); diff --git a/libvapours/include/vapours/svc/svc_version.hpp b/libvapours/include/vapours/svc/svc_version.hpp index 01b99ef7..a80879fe 100644 --- a/libvapours/include/vapours/svc/svc_version.hpp +++ b/libvapours/include/vapours/svc/svc_version.hpp @@ -58,7 +58,7 @@ namespace ams::svc { /* This is the highest SVC version supported by Atmosphere, to be updated on new kernel releases. */ /* NOTE: Official kernel versions have SVC major = SDK major + 4, SVC minor = SDK minor. */ constexpr inline u32 SupportedKernelMajorVersion = ConvertToSvcMajorVersion(13); - constexpr inline u32 SupportedKernelMinorVersion = ConvertToSvcMinorVersion( 3); + constexpr inline u32 SupportedKernelMinorVersion = ConvertToSvcMinorVersion( 4); constexpr inline u32 SupportedKernelVersion = EncodeKernelVersion(SupportedKernelMajorVersion, SupportedKernelMinorVersion);