diff --git a/src/core/hle/kernel/k_page_table_base.cpp b/src/core/hle/kernel/k_page_table_base.cpp index 19cdf4f3a..af5be1713 100644 --- a/src/core/hle/kernel/k_page_table_base.cpp +++ b/src/core/hle/kernel/k_page_table_base.cpp @@ -172,6 +172,7 @@ Result KPageTableBase::InitializeForKernel(bool is_64_bit, KVirtualAddress start m_mapped_unsafe_physical_memory = 0; m_mapped_insecure_memory = 0; m_mapped_ipc_server_memory = 0; + m_alias_region_extra_size = 0; m_memory_block_slab_manager = m_kernel.GetSystemSystemResource().GetMemoryBlockSlabManagerPointer(); @@ -269,6 +270,12 @@ Result KPageTableBase::InitializeForProcess(Svc::CreateProcessFlag as_type, bool process_code_end = m_code_region_end; } + m_alias_region_extra_size = 0; + if (as_type == Svc::CreateProcessFlag::EnableReservedRegionExtraSize) { + m_alias_region_extra_size = GetAddressSpaceSize() / 8; + alias_region_size += m_alias_region_extra_size; + } + // Set other basic fields. m_enable_aslr = enable_aslr; m_enable_device_address_space_merge = enable_das_merge; diff --git a/src/core/hle/kernel/k_page_table_base.h b/src/core/hle/kernel/k_page_table_base.h index 748419f86..fd6b7216b 100644 --- a/src/core/hle/kernel/k_page_table_base.h +++ b/src/core/hle/kernel/k_page_table_base.h @@ -208,6 +208,7 @@ private: size_t m_mapped_unsafe_physical_memory{}; size_t m_mapped_insecure_memory{}; size_t m_mapped_ipc_server_memory{}; + size_t m_alias_region_extra_size{}; mutable KLightLock m_general_lock; mutable KLightLock m_map_physical_memory_lock; KLightLock m_device_map_lock; @@ -682,6 +683,9 @@ public: size_t GetAliasRegionSize() const { return m_alias_region_end - m_alias_region_start; } + size_t GetReservedRegionExtraSize() const { + return m_alias_region_extra_size; + } size_t GetStackRegionSize() const { return m_stack_region_end - m_stack_region_start; } diff --git a/src/core/hle/kernel/k_process_page_table.h b/src/core/hle/kernel/k_process_page_table.h index 346d7ca08..38c5fb816 100644 --- a/src/core/hle/kernel/k_process_page_table.h +++ b/src/core/hle/kernel/k_process_page_table.h @@ -410,6 +410,9 @@ public: size_t GetAliasRegionSize() const { return m_page_table.GetAliasRegionSize(); } + size_t GetReservedRegionExtraSize() const { + return m_page_table.GetReservedRegionExtraSize(); + } size_t GetStackRegionSize() const { return m_page_table.GetStackRegionSize(); } diff --git a/src/core/hle/kernel/svc/svc_info.cpp b/src/core/hle/kernel/svc/svc_info.cpp index 231e4d0e1..007bb9f70 100644 --- a/src/core/hle/kernel/svc/svc_info.cpp +++ b/src/core/hle/kernel/svc/svc_info.cpp @@ -37,7 +37,8 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle case InfoType::TotalNonSystemMemorySize: case InfoType::UsedNonSystemMemorySize: case InfoType::IsApplication: - case InfoType::FreeThreadCount: { + case InfoType::FreeThreadCount: + case InfoType::ReservedRegionExtraSize: { R_UNLESS(info_sub_id == 0, ResultInvalidEnumValue); const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable(); @@ -134,6 +135,10 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle } R_SUCCEED(); + case InfoType::ReservedRegionExtraSize: + *result = process->GetPageTable().GetReservedRegionExtraSize(); + R_SUCCEED(); + default: break; } diff --git a/src/core/hle/kernel/svc_types.h b/src/core/hle/kernel/svc_types.h index ab432ea78..df92fa008 100644 --- a/src/core/hle/kernel/svc_types.h +++ b/src/core/hle/kernel/svc_types.h @@ -153,6 +153,7 @@ enum class InfoType : u32 { ThreadTickCount = 25, IsSvcPermitted = 26, IoRegionHint = 27, + ReservedRegionExtraSize = 28, MesosphereMeta = 65000, MesosphereCurrentProcess = 65001, @@ -642,9 +643,12 @@ enum class CreateProcessFlag : u32 { // 11.x+ DisableDeviceAddressSpaceMerge. DisableDeviceAddressSpaceMerge = (1 << 12), + EnableReservedRegionExtraSize = (1 << 13), + // Mask of all flags. All = Is64Bit | AddressSpaceMask | EnableDebug | EnableAslr | IsApplication | - PoolPartitionMask | OptimizeMemoryAllocation | DisableDeviceAddressSpaceMerge, + PoolPartitionMask | OptimizeMemoryAllocation | DisableDeviceAddressSpaceMerge | + EnableReservedRegionExtraSize, }; DECLARE_ENUM_FLAG_OPERATORS(CreateProcessFlag); diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 14ecca945..4464e4af9 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -325,7 +325,7 @@ public: {11, &IProfileCommon::LoadImage, "LoadImage"}, {20, &IProfileCommon::GetImageSize, "GetLargeImageSize"}, // 18.0.0+ {21, &IProfileCommon::LoadImage, "LoadLargeImage"}, // 18.0.0+ - {30, nullptr, "GetImageId"} // 18.0.0+ + {30, &IProfileCommon::Unknown, "GetImageId"} // 18.0.0+ }; RegisterHandlers(functions); @@ -496,6 +496,13 @@ protected: rb.Push(ResultSuccess); } + void Unknown(HLERequestContext& ctx) { + LOG_WARNING(Service_ACC, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(0); + } + ProfileManager& profile_manager; Common::UUID user_id{}; ///< The user id this profile refers to. }; @@ -511,7 +518,15 @@ class IProfileEditor final : public IProfileCommon { public: explicit IProfileEditor(Core::System& system_, Common::UUID user_id_, ProfileManager& profile_manager_) - : IProfileCommon{system_, "IProfileEditor", true, user_id_, profile_manager_} {} + : IProfileCommon{system_, "IProfileEditor", true, user_id_, profile_manager_} { + // clang-format off + static const FunctionInfo functions[] = { + {30, &IProfileEditor::Unknown, "Unknown"}, + }; + // clang-format on + + RegisterHandlers(functions); + } }; class ISessionObject final : public ServiceFramework {