diff options
author | arades79 <scravers@protonmail.com> | 2023-02-14 17:13:47 +0100 |
---|---|---|
committer | arades79 <scravers@protonmail.com> | 2023-02-14 18:35:39 +0100 |
commit | 683019878fc939b418a65e1c5d84b066596d7655 (patch) | |
tree | 6b2a2e8ea34cb00a3fccf3613a52475550997035 /src/core/hle/kernel | |
parent | apply clang-format (diff) | |
download | yuzu-683019878fc939b418a65e1c5d84b066596d7655.tar yuzu-683019878fc939b418a65e1c5d84b066596d7655.tar.gz yuzu-683019878fc939b418a65e1c5d84b066596d7655.tar.bz2 yuzu-683019878fc939b418a65e1c5d84b066596d7655.tar.lz yuzu-683019878fc939b418a65e1c5d84b066596d7655.tar.xz yuzu-683019878fc939b418a65e1c5d84b066596d7655.tar.zst yuzu-683019878fc939b418a65e1c5d84b066596d7655.zip |
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r-- | src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/init/init_slab_setup.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/k_capabilities.cpp | 6 | ||||
-rw-r--r-- | src/core/hle/kernel/k_memory_manager.h | 6 | ||||
-rw-r--r-- | src/core/hle/kernel/k_page_heap.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/k_page_table.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/kernel.cpp | 43 | ||||
-rw-r--r-- | src/core/hle/kernel/process_capability.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/svc/svc_activity.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/svc/svc_info.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/svc/svc_memory.cpp | 2 |
11 files changed, 38 insertions, 39 deletions
diff --git a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp index 49098d2c9..c10b7bf30 100644 --- a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp +++ b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp @@ -114,13 +114,13 @@ size_t KSystemControl::Init::GetAppletPoolSize() { }(); // Return (possibly) adjusted size. - constexpr static size_t ExtraSystemMemoryForAtmosphere = 33_MiB; + constexpr size_t ExtraSystemMemoryForAtmosphere = 33_MiB; return base_pool_size - ExtraSystemMemoryForAtmosphere - KTraceBufferSize; } size_t KSystemControl::Init::GetMinimumNonSecureSystemPoolSize() { // Verify that our minimum is at least as large as Nintendo's. - constexpr static size_t MinimumSize = RequiredNonSecureSystemMemorySize; + constexpr size_t MinimumSize = RequiredNonSecureSystemMemorySize; static_assert(MinimumSize >= 0x29C8000); return MinimumSize; diff --git a/src/core/hle/kernel/init/init_slab_setup.cpp b/src/core/hle/kernel/init/init_slab_setup.cpp index 951326a85..571acf4b2 100644 --- a/src/core/hle/kernel/init/init_slab_setup.cpp +++ b/src/core/hle/kernel/init/init_slab_setup.cpp @@ -129,7 +129,7 @@ VAddr InitializeSlabHeap(Core::System& system, KMemoryLayout& memory_layout, VAd } size_t CalculateSlabHeapGapSize() { - constexpr static size_t KernelSlabHeapGapSize = 2_MiB - 320_KiB; + constexpr size_t KernelSlabHeapGapSize = 2_MiB - 320_KiB; static_assert(KernelSlabHeapGapSize <= KernelSlabHeapGapsSizeMax); return KernelSlabHeapGapSize; } @@ -272,7 +272,7 @@ void KPageBufferSlabHeap::Initialize(Core::System& system) { kernel.GetSystemResourceLimit()->Reserve(LimitableResource::PhysicalMemoryMax, slab_size)); // Allocate memory for the slab. - constexpr static auto AllocateOption = KMemoryManager::EncodeOption( + constexpr auto AllocateOption = KMemoryManager::EncodeOption( KMemoryManager::Pool::System, KMemoryManager::Direction::FromFront); const PAddr slab_address = kernel.MemoryManager().AllocateAndOpenContinuous(num_pages, 1, AllocateOption); diff --git a/src/core/hle/kernel/k_capabilities.cpp b/src/core/hle/kernel/k_capabilities.cpp index 374bc2c06..2907cc6e3 100644 --- a/src/core/hle/kernel/k_capabilities.cpp +++ b/src/core/hle/kernel/k_capabilities.cpp @@ -21,8 +21,8 @@ Result KCapabilities::InitializeForKIP(std::span<const u32> kern_caps, KPageTabl m_program_type = 0; // Initial processes may run on all cores. - constexpr static u64 VirtMask = Core::Hardware::VirtualCoreMask; - constexpr static u64 PhysMask = Core::Hardware::ConvertVirtualCoreMaskToPhysical(VirtMask); + constexpr u64 VirtMask = Core::Hardware::VirtualCoreMask; + constexpr u64 PhysMask = Core::Hardware::ConvertVirtualCoreMaskToPhysical(VirtMask); m_core_mask = VirtMask; m_phys_core_mask = PhysMask; @@ -170,7 +170,7 @@ Result KCapabilities::MapIoPage_(const u32 cap, KPageTable* page_table) { template <typename F> Result KCapabilities::ProcessMapRegionCapability(const u32 cap, F f) { // Define the allowed memory regions. - constexpr static std::array<KMemoryRegionType, 4> MemoryRegions{ + constexpr std::array<KMemoryRegionType, 4> MemoryRegions{ KMemoryRegionType_None, KMemoryRegionType_KernelTraceBuffer, KMemoryRegionType_OnMemoryBootImage, diff --git a/src/core/hle/kernel/k_memory_manager.h b/src/core/hle/kernel/k_memory_manager.h index d13549b5e..401d4e644 100644 --- a/src/core/hle/kernel/k_memory_manager.h +++ b/src/core/hle/kernel/k_memory_manager.h @@ -121,7 +121,7 @@ public: } size_t GetSize(Pool pool) { - constexpr static Direction GetSizeDirection = Direction::FromFront; + constexpr Direction GetSizeDirection = Direction::FromFront; size_t total = 0; for (auto* manager = this->GetFirstManager(pool, GetSizeDirection); manager != nullptr; manager = this->GetNextManager(manager, GetSizeDirection)) { @@ -142,7 +142,7 @@ public: size_t GetFreeSize(Pool pool) { KScopedLightLock lk(m_pool_locks[static_cast<size_t>(pool)]); - constexpr static Direction GetSizeDirection = Direction::FromFront; + constexpr Direction GetSizeDirection = Direction::FromFront; size_t total = 0; for (auto* manager = this->GetFirstManager(pool, GetSizeDirection); manager != nullptr; manager = this->GetNextManager(manager, GetSizeDirection)) { @@ -154,7 +154,7 @@ public: void DumpFreeList(Pool pool) { KScopedLightLock lk(m_pool_locks[static_cast<size_t>(pool)]); - constexpr static Direction DumpDirection = Direction::FromFront; + constexpr Direction DumpDirection = Direction::FromFront; for (auto* manager = this->GetFirstManager(pool, DumpDirection); manager != nullptr; manager = this->GetNextManager(manager, DumpDirection)) { manager->DumpFreeList(); diff --git a/src/core/hle/kernel/k_page_heap.cpp b/src/core/hle/kernel/k_page_heap.cpp index ffebf0a35..7b02c7d8b 100644 --- a/src/core/hle/kernel/k_page_heap.cpp +++ b/src/core/hle/kernel/k_page_heap.cpp @@ -68,7 +68,7 @@ PAddr KPageHeap::AllocateByRandom(s32 index, size_t num_pages, size_t align_page const size_t align_shift = std::countr_zero(align_size); // Decide on a block to allocate from. - constexpr static size_t MinimumPossibleAlignmentsForRandomAllocation = 4; + constexpr size_t MinimumPossibleAlignmentsForRandomAllocation = 4; { // By default, we'll want to look at all blocks larger than our current one. s32 max_blocks = static_cast<s32>(m_num_blocks); diff --git a/src/core/hle/kernel/k_page_table.cpp b/src/core/hle/kernel/k_page_table.cpp index d3e0334ed..2e13d5d0d 100644 --- a/src/core/hle/kernel/k_page_table.cpp +++ b/src/core/hle/kernel/k_page_table.cpp @@ -134,7 +134,7 @@ Result KPageTable::InitializeForProcess(FileSys::ProgramAddressSpaceType as_type } // Set code regions and determine remaining - constexpr static size_t RegionAlignment{2_MiB}; + constexpr size_t RegionAlignment{2_MiB}; VAddr process_code_start{}; VAddr process_code_end{}; size_t stack_region_size{}; @@ -2624,7 +2624,7 @@ Result KPageTable::SetMemoryAttribute(VAddr addr, size_t size, u32 mask, u32 att KMemoryPermission old_perm; KMemoryAttribute old_attr; size_t num_allocator_blocks; - constexpr static auto AttributeTestMask = + constexpr auto AttributeTestMask = ~(KMemoryAttribute::SetMask | KMemoryAttribute::DeviceShared); R_TRY(this->CheckMemoryState( std::addressof(old_state), std::addressof(old_perm), std::addressof(old_attr), diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index e9270c6f3..5b72eaaa1 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -254,7 +254,7 @@ struct KernelCore::Impl { system_resource_limit->Reserve(LimitableResource::PhysicalMemoryMax, kernel_size); // Reserve secure applet memory, introduced in firmware 5.0.0 - constexpr static u64 secure_applet_memory_size{4_MiB}; + constexpr u64 secure_applet_memory_size{4_MiB}; ASSERT(system_resource_limit->Reserve(LimitableResource::PhysicalMemoryMax, secure_applet_memory_size)); } @@ -477,9 +477,9 @@ struct KernelCore::Impl { const VAddr code_end_virt_addr = KernelVirtualAddressCodeEnd; // Setup the containing kernel region. - constexpr static size_t KernelRegionSize = 1_GiB; - constexpr static size_t KernelRegionAlign = 1_GiB; - constexpr static VAddr kernel_region_start = + constexpr size_t KernelRegionSize = 1_GiB; + constexpr size_t KernelRegionAlign = 1_GiB; + constexpr VAddr kernel_region_start = Common::AlignDown(code_start_virt_addr, KernelRegionAlign); size_t kernel_region_size = KernelRegionSize; if (!(kernel_region_start + KernelRegionSize - 1 <= KernelVirtualAddressSpaceLast)) { @@ -489,12 +489,11 @@ struct KernelCore::Impl { kernel_region_start, kernel_region_size, KMemoryRegionType_Kernel)); // Setup the code region. - constexpr static size_t CodeRegionAlign = PageSize; - constexpr static VAddr code_region_start = + constexpr size_t CodeRegionAlign = PageSize; + constexpr VAddr code_region_start = Common::AlignDown(code_start_virt_addr, CodeRegionAlign); - constexpr static VAddr code_region_end = - Common::AlignUp(code_end_virt_addr, CodeRegionAlign); - constexpr static size_t code_region_size = code_region_end - code_region_start; + constexpr VAddr code_region_end = Common::AlignUp(code_end_virt_addr, CodeRegionAlign); + constexpr size_t code_region_size = code_region_end - code_region_start; ASSERT(memory_layout->GetVirtualMemoryRegionTree().Insert( code_region_start, code_region_size, KMemoryRegionType_KernelCode)); @@ -525,8 +524,8 @@ struct KernelCore::Impl { } // Decide on the actual size for the misc region. - constexpr static size_t MiscRegionAlign = KernelAslrAlignment; - constexpr static size_t MiscRegionMinimumSize = 32_MiB; + constexpr size_t MiscRegionAlign = KernelAslrAlignment; + constexpr size_t MiscRegionMinimumSize = 32_MiB; const size_t misc_region_size = Common::AlignUp( std::max(misc_region_needed_size, MiscRegionMinimumSize), MiscRegionAlign); ASSERT(misc_region_size > 0); @@ -542,8 +541,8 @@ struct KernelCore::Impl { const bool use_extra_resources = KSystemControl::Init::ShouldIncreaseThreadResourceLimit(); // Setup the stack region. - constexpr static size_t StackRegionSize = 14_MiB; - constexpr static size_t StackRegionAlign = KernelAslrAlignment; + constexpr size_t StackRegionSize = 14_MiB; + constexpr size_t StackRegionAlign = KernelAslrAlignment; const VAddr stack_region_start = memory_layout->GetVirtualMemoryRegionTree().GetRandomAlignedRegion( StackRegionSize, StackRegionAlign, KMemoryRegionType_Kernel); @@ -564,7 +563,7 @@ struct KernelCore::Impl { const PAddr code_end_phys_addr = code_start_phys_addr + code_region_size; const PAddr slab_start_phys_addr = code_end_phys_addr; const PAddr slab_end_phys_addr = slab_start_phys_addr + slab_region_size; - constexpr static size_t SlabRegionAlign = KernelAslrAlignment; + constexpr size_t SlabRegionAlign = KernelAslrAlignment; const size_t slab_region_needed_size = Common::AlignUp(code_end_phys_addr + slab_region_size, SlabRegionAlign) - Common::AlignDown(code_end_phys_addr, SlabRegionAlign); @@ -576,8 +575,8 @@ struct KernelCore::Impl { slab_region_start, slab_region_size, KMemoryRegionType_KernelSlab)); // Setup the temp region. - constexpr static size_t TempRegionSize = 128_MiB; - constexpr static size_t TempRegionAlign = KernelAslrAlignment; + constexpr size_t TempRegionSize = 128_MiB; + constexpr size_t TempRegionAlign = KernelAslrAlignment; const VAddr temp_region_start = memory_layout->GetVirtualMemoryRegionTree().GetRandomAlignedRegion( TempRegionSize, TempRegionAlign, KMemoryRegionType_Kernel); @@ -657,7 +656,7 @@ struct KernelCore::Impl { ASSERT(linear_extents.GetEndAddress() != 0); // Setup the linear mapping region. - constexpr static size_t LinearRegionAlign = 1_GiB; + constexpr size_t LinearRegionAlign = 1_GiB; const PAddr aligned_linear_phys_start = Common::AlignDown(linear_extents.GetAddress(), LinearRegionAlign); const size_t linear_region_size = @@ -738,11 +737,11 @@ struct KernelCore::Impl { void InitializeHackSharedMemory() { // Setup memory regions for emulated processes // TODO(bunnei): These should not be hardcoded regions initialized within the kernel - constexpr static std::size_t hid_size{0x40000}; - constexpr static std::size_t font_size{0x1100000}; - constexpr static std::size_t irs_size{0x8000}; - constexpr static std::size_t time_size{0x1000}; - constexpr static std::size_t hidbus_size{0x1000}; + constexpr std::size_t hid_size{0x40000}; + constexpr std::size_t font_size{0x1100000}; + constexpr std::size_t irs_size{0x8000}; + constexpr std::size_t time_size{0x1000}; + constexpr std::size_t hidbus_size{0x1000}; hid_shared_mem = KSharedMemory::Create(system.Kernel()); font_shared_mem = KSharedMemory::Create(system.Kernel()); diff --git a/src/core/hle/kernel/process_capability.cpp b/src/core/hle/kernel/process_capability.cpp index de322cbf9..773319ad8 100644 --- a/src/core/hle/kernel/process_capability.cpp +++ b/src/core/hle/kernel/process_capability.cpp @@ -306,7 +306,7 @@ Result ProcessCapabilities::HandleMapRegionFlags(u32 flags, KPageTable& page_tab } Result ProcessCapabilities::HandleInterruptFlags(u32 flags) { - constexpr static u32 interrupt_ignore_value = 0x3FF; + constexpr u32 interrupt_ignore_value = 0x3FF; const u32 interrupt0 = (flags >> 12) & 0x3FF; const u32 interrupt1 = (flags >> 22) & 0x3FF; diff --git a/src/core/hle/kernel/svc/svc_activity.cpp b/src/core/hle/kernel/svc/svc_activity.cpp index 0fd1b3d4c..baafefaeb 100644 --- a/src/core/hle/kernel/svc/svc_activity.cpp +++ b/src/core/hle/kernel/svc/svc_activity.cpp @@ -16,7 +16,7 @@ Result SetThreadActivity(Core::System& system, Handle thread_handle, thread_activity); // Validate the activity. - constexpr static auto IsValidThreadActivity = [](ThreadActivity activity) { + static constexpr auto IsValidThreadActivity = [](ThreadActivity activity) { return activity == ThreadActivity::Runnable || activity == ThreadActivity::Paused; }; R_UNLESS(IsValidThreadActivity(thread_activity), ResultInvalidEnumValue); diff --git a/src/core/hle/kernel/svc/svc_info.cpp b/src/core/hle/kernel/svc/svc_info.cpp index c30ba0295..ad56e2fe6 100644 --- a/src/core/hle/kernel/svc/svc_info.cpp +++ b/src/core/hle/kernel/svc/svc_info.cpp @@ -193,7 +193,7 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle return ResultSuccess; case InfoType::ThreadTickCount: { - constexpr static u64 num_cpus = 4; + constexpr u64 num_cpus = 4; if (info_sub_id != 0xFFFFFFFFFFFFFFFF && info_sub_id >= num_cpus) { LOG_ERROR(Kernel_SVC, "Core count is out of range, expected {} but got {}", num_cpus, info_sub_id); diff --git a/src/core/hle/kernel/svc/svc_memory.cpp b/src/core/hle/kernel/svc/svc_memory.cpp index 7045c5e69..21f818da6 100644 --- a/src/core/hle/kernel/svc/svc_memory.cpp +++ b/src/core/hle/kernel/svc/svc_memory.cpp @@ -132,7 +132,7 @@ Result SetMemoryAttribute(Core::System& system, VAddr address, u64 size, u32 mas R_UNLESS((address < address + size), ResultInvalidCurrentMemory); // Validate the attribute and mask. - constexpr static u32 SupportedMask = static_cast<u32>(MemoryAttribute::Uncached); + constexpr u32 SupportedMask = static_cast<u32>(MemoryAttribute::Uncached); R_UNLESS((mask | attr) == mask, ResultInvalidCombination); R_UNLESS((mask | attr | SupportedMask) == SupportedMask, ResultInvalidCombination); |