Merge branch 'f18-changes' into dev

This commit is contained in:
Crimson Hawk 2024-04-18 11:53:16 +08:00
commit 91db3e88e5
No known key found for this signature in database
GPG key ID: 0804DD39BB9BF5AC
6 changed files with 42 additions and 4 deletions

View file

@ -172,6 +172,7 @@ Result KPageTableBase::InitializeForKernel(bool is_64_bit, KVirtualAddress start
m_mapped_unsafe_physical_memory = 0; m_mapped_unsafe_physical_memory = 0;
m_mapped_insecure_memory = 0; m_mapped_insecure_memory = 0;
m_mapped_ipc_server_memory = 0; m_mapped_ipc_server_memory = 0;
m_alias_region_extra_size = 0;
m_memory_block_slab_manager = m_memory_block_slab_manager =
m_kernel.GetSystemSystemResource().GetMemoryBlockSlabManagerPointer(); m_kernel.GetSystemSystemResource().GetMemoryBlockSlabManagerPointer();
@ -269,6 +270,12 @@ Result KPageTableBase::InitializeForProcess(Svc::CreateProcessFlag as_type, bool
process_code_end = m_code_region_end; 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. // Set other basic fields.
m_enable_aslr = enable_aslr; m_enable_aslr = enable_aslr;
m_enable_device_address_space_merge = enable_das_merge; m_enable_device_address_space_merge = enable_das_merge;

View file

@ -208,6 +208,7 @@ private:
size_t m_mapped_unsafe_physical_memory{}; size_t m_mapped_unsafe_physical_memory{};
size_t m_mapped_insecure_memory{}; size_t m_mapped_insecure_memory{};
size_t m_mapped_ipc_server_memory{}; size_t m_mapped_ipc_server_memory{};
size_t m_alias_region_extra_size{};
mutable KLightLock m_general_lock; mutable KLightLock m_general_lock;
mutable KLightLock m_map_physical_memory_lock; mutable KLightLock m_map_physical_memory_lock;
KLightLock m_device_map_lock; KLightLock m_device_map_lock;
@ -682,6 +683,9 @@ public:
size_t GetAliasRegionSize() const { size_t GetAliasRegionSize() const {
return m_alias_region_end - m_alias_region_start; return m_alias_region_end - m_alias_region_start;
} }
size_t GetReservedRegionExtraSize() const {
return m_alias_region_extra_size;
}
size_t GetStackRegionSize() const { size_t GetStackRegionSize() const {
return m_stack_region_end - m_stack_region_start; return m_stack_region_end - m_stack_region_start;
} }

View file

@ -410,6 +410,9 @@ public:
size_t GetAliasRegionSize() const { size_t GetAliasRegionSize() const {
return m_page_table.GetAliasRegionSize(); return m_page_table.GetAliasRegionSize();
} }
size_t GetReservedRegionExtraSize() const {
return m_page_table.GetReservedRegionExtraSize();
}
size_t GetStackRegionSize() const { size_t GetStackRegionSize() const {
return m_page_table.GetStackRegionSize(); return m_page_table.GetStackRegionSize();
} }

View file

@ -37,7 +37,8 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
case InfoType::TotalNonSystemMemorySize: case InfoType::TotalNonSystemMemorySize:
case InfoType::UsedNonSystemMemorySize: case InfoType::UsedNonSystemMemorySize:
case InfoType::IsApplication: case InfoType::IsApplication:
case InfoType::FreeThreadCount: { case InfoType::FreeThreadCount:
case InfoType::ReservedRegionExtraSize: {
R_UNLESS(info_sub_id == 0, ResultInvalidEnumValue); R_UNLESS(info_sub_id == 0, ResultInvalidEnumValue);
const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable(); 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(); R_SUCCEED();
case InfoType::ReservedRegionExtraSize:
*result = process->GetPageTable().GetReservedRegionExtraSize();
R_SUCCEED();
default: default:
break; break;
} }

View file

@ -153,6 +153,7 @@ enum class InfoType : u32 {
ThreadTickCount = 25, ThreadTickCount = 25,
IsSvcPermitted = 26, IsSvcPermitted = 26,
IoRegionHint = 27, IoRegionHint = 27,
ReservedRegionExtraSize = 28,
MesosphereMeta = 65000, MesosphereMeta = 65000,
MesosphereCurrentProcess = 65001, MesosphereCurrentProcess = 65001,
@ -642,9 +643,12 @@ enum class CreateProcessFlag : u32 {
// 11.x+ DisableDeviceAddressSpaceMerge. // 11.x+ DisableDeviceAddressSpaceMerge.
DisableDeviceAddressSpaceMerge = (1 << 12), DisableDeviceAddressSpaceMerge = (1 << 12),
EnableReservedRegionExtraSize = (1 << 13),
// Mask of all flags. // Mask of all flags.
All = Is64Bit | AddressSpaceMask | EnableDebug | EnableAslr | IsApplication | All = Is64Bit | AddressSpaceMask | EnableDebug | EnableAslr | IsApplication |
PoolPartitionMask | OptimizeMemoryAllocation | DisableDeviceAddressSpaceMerge, PoolPartitionMask | OptimizeMemoryAllocation | DisableDeviceAddressSpaceMerge |
EnableReservedRegionExtraSize,
}; };
DECLARE_ENUM_FLAG_OPERATORS(CreateProcessFlag); DECLARE_ENUM_FLAG_OPERATORS(CreateProcessFlag);

View file

@ -323,7 +323,7 @@ public:
{11, &IProfileCommon::LoadImage, "LoadImage"}, {11, &IProfileCommon::LoadImage, "LoadImage"},
{20, &IProfileCommon::GetImageSize, "GetLargeImageSize"}, // 18.0.0+ {20, &IProfileCommon::GetImageSize, "GetLargeImageSize"}, // 18.0.0+
{21, &IProfileCommon::LoadImage, "LoadLargeImage"}, // 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); RegisterHandlers(functions);
@ -494,6 +494,13 @@ protected:
rb.Push(ResultSuccess); 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; ProfileManager& profile_manager;
Common::UUID user_id{}; ///< The user id this profile refers to. Common::UUID user_id{}; ///< The user id this profile refers to.
}; };
@ -509,7 +516,15 @@ class IProfileEditor final : public IProfileCommon {
public: public:
explicit IProfileEditor(Core::System& system_, Common::UUID user_id_, explicit IProfileEditor(Core::System& system_, Common::UUID user_id_,
ProfileManager& profile_manager_) 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<ISessionObject> { class ISessionObject final : public ServiceFramework<ISessionObject> {