From d2664c60a3ac9d7963448a083dcd81249fb64d01 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Fri, 17 Sep 2021 16:26:01 -0700 Subject: [PATCH] kern: add new KMemoryState --- .../libmesosphere/include/mesosphere/kern_k_memory_block.hpp | 3 +++ libraries/libmesosphere/source/kern_k_page_table_base.cpp | 3 +++ libraries/libvapours/include/vapours/svc/svc_types_common.hpp | 1 + 3 files changed, 7 insertions(+) diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_memory_block.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_memory_block.hpp index b9b96f5a4..37b7e672d 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_memory_block.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_memory_block.hpp @@ -105,6 +105,8 @@ namespace ams::kern { KMemoryState_GeneratedCode = ams::svc::MemoryState_GeneratedCode | KMemoryState_FlagMapped | KMemoryState_FlagReferenceCounted | KMemoryState_FlagCanDebug, KMemoryState_CodeOut = ams::svc::MemoryState_CodeOut | KMemoryState_FlagMapped | KMemoryState_FlagReferenceCounted, + + KMemoryState_Coverage = ams::svc::MemoryState_Coverage | KMemoryState_FlagMapped, }; #if 1 @@ -130,6 +132,7 @@ namespace ams::kern { static_assert(KMemoryState_Kernel == 0x00002013); static_assert(KMemoryState_GeneratedCode == 0x00402214); static_assert(KMemoryState_CodeOut == 0x00402015); + static_assert(KMemoryState_Coverage == 0x00002016); #endif enum KMemoryPermission : u8 { diff --git a/libraries/libmesosphere/source/kern_k_page_table_base.cpp b/libraries/libmesosphere/source/kern_k_page_table_base.cpp index d47fad006..c331bcea8 100644 --- a/libraries/libmesosphere/source/kern_k_page_table_base.cpp +++ b/libraries/libmesosphere/source/kern_k_page_table_base.cpp @@ -381,6 +381,7 @@ namespace ams::kern { case KMemoryState_SharedCode: case KMemoryState_GeneratedCode: case KMemoryState_CodeOut: + case KMemoryState_Coverage: return m_alias_code_region_start; case KMemoryState_Code: case KMemoryState_CodeData: @@ -414,6 +415,7 @@ namespace ams::kern { case KMemoryState_SharedCode: case KMemoryState_GeneratedCode: case KMemoryState_CodeOut: + case KMemoryState_Coverage: return m_alias_code_region_end - m_alias_code_region_start; case KMemoryState_Code: case KMemoryState_CodeData: @@ -450,6 +452,7 @@ namespace ams::kern { case KMemoryState_SharedCode: case KMemoryState_GeneratedCode: case KMemoryState_CodeOut: + case KMemoryState_Coverage: return is_in_region && !is_in_heap && !is_in_alias; case KMemoryState_Normal: MESOSPHERE_ASSERT(is_in_heap); diff --git a/libraries/libvapours/include/vapours/svc/svc_types_common.hpp b/libraries/libvapours/include/vapours/svc/svc_types_common.hpp index a42a6c033..4ed4a6b71 100644 --- a/libraries/libvapours/include/vapours/svc/svc_types_common.hpp +++ b/libraries/libvapours/include/vapours/svc/svc_types_common.hpp @@ -94,6 +94,7 @@ namespace ams::svc { MemoryState_Kernel = 0x13, MemoryState_GeneratedCode = 0x14, MemoryState_CodeOut = 0x15, + MemoryState_Coverage = 0x16, }; enum MemoryPermission : u32 {