diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_memory_layout.h (renamed from src/core/hle/kernel/memory/memory_layout.h) | 34 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_thread.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 13 |
5 files changed, 30 insertions, 31 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 442618e90..d12260d9c 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -166,6 +166,7 @@ add_library(core STATIC | |||
| 166 | hle/kernel/k_light_condition_variable.h | 166 | hle/kernel/k_light_condition_variable.h |
| 167 | hle/kernel/k_light_lock.cpp | 167 | hle/kernel/k_light_lock.cpp |
| 168 | hle/kernel/k_light_lock.h | 168 | hle/kernel/k_light_lock.h |
| 169 | hle/kernel/k_memory_layout.h | ||
| 169 | hle/kernel/k_page_bitmap.h | 170 | hle/kernel/k_page_bitmap.h |
| 170 | hle/kernel/k_priority_queue.h | 171 | hle/kernel/k_priority_queue.h |
| 171 | hle/kernel/k_readable_event.cpp | 172 | hle/kernel/k_readable_event.cpp |
| @@ -196,7 +197,6 @@ add_library(core STATIC | |||
| 196 | hle/kernel/memory/memory_block.h | 197 | hle/kernel/memory/memory_block.h |
| 197 | hle/kernel/memory/memory_block_manager.cpp | 198 | hle/kernel/memory/memory_block_manager.cpp |
| 198 | hle/kernel/memory/memory_block_manager.h | 199 | hle/kernel/memory/memory_block_manager.h |
| 199 | hle/kernel/memory/memory_layout.h | ||
| 200 | hle/kernel/memory/memory_manager.cpp | 200 | hle/kernel/memory/memory_manager.cpp |
| 201 | hle/kernel/memory/memory_manager.h | 201 | hle/kernel/memory/memory_manager.h |
| 202 | hle/kernel/memory/memory_types.h | 202 | hle/kernel/memory/memory_types.h |
diff --git a/src/core/hle/kernel/memory/memory_layout.h b/src/core/hle/kernel/k_memory_layout.h index c7c0b2f49..0821d2d8c 100644 --- a/src/core/hle/kernel/memory/memory_layout.h +++ b/src/core/hle/kernel/k_memory_layout.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "core/device_memory.h" | 8 | #include "core/device_memory.h" |
| 9 | 9 | ||
| 10 | namespace Kernel::Memory { | 10 | namespace Kernel { |
| 11 | 11 | ||
| 12 | constexpr std::size_t KernelAslrAlignment = 2 * 1024 * 1024; | 12 | constexpr std::size_t KernelAslrAlignment = 2 * 1024 * 1024; |
| 13 | constexpr std::size_t KernelVirtualAddressSpaceWidth = 1ULL << 39; | 13 | constexpr std::size_t KernelVirtualAddressSpaceWidth = 1ULL << 39; |
| @@ -27,8 +27,8 @@ constexpr bool IsKernelAddress(VAddr address) { | |||
| 27 | return KernelVirtualAddressSpaceBase <= address && address < KernelVirtualAddressSpaceEnd; | 27 | return KernelVirtualAddressSpaceBase <= address && address < KernelVirtualAddressSpaceEnd; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | class MemoryRegion final { | 30 | class KMemoryRegion final { |
| 31 | friend class MemoryLayout; | 31 | friend class KMemoryLayout; |
| 32 | 32 | ||
| 33 | public: | 33 | public: |
| 34 | constexpr PAddr StartAddress() const { | 34 | constexpr PAddr StartAddress() const { |
| @@ -40,29 +40,29 @@ public: | |||
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | private: | 42 | private: |
| 43 | constexpr MemoryRegion() = default; | 43 | constexpr KMemoryRegion() = default; |
| 44 | constexpr MemoryRegion(PAddr start_address, PAddr end_address) | 44 | constexpr KMemoryRegion(PAddr start_address, PAddr end_address) |
| 45 | : start_address{start_address}, end_address{end_address} {} | 45 | : start_address{start_address}, end_address{end_address} {} |
| 46 | 46 | ||
| 47 | const PAddr start_address{}; | 47 | const PAddr start_address{}; |
| 48 | const PAddr end_address{}; | 48 | const PAddr end_address{}; |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | class MemoryLayout final { | 51 | class KMemoryLayout final { |
| 52 | public: | 52 | public: |
| 53 | constexpr const MemoryRegion& Application() const { | 53 | constexpr const KMemoryRegion& Application() const { |
| 54 | return application; | 54 | return application; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | constexpr const MemoryRegion& Applet() const { | 57 | constexpr const KMemoryRegion& Applet() const { |
| 58 | return applet; | 58 | return applet; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | constexpr const MemoryRegion& System() const { | 61 | constexpr const KMemoryRegion& System() const { |
| 62 | return system; | 62 | return system; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | static constexpr MemoryLayout GetDefaultLayout() { | 65 | static constexpr KMemoryLayout GetDefaultLayout() { |
| 66 | constexpr std::size_t application_size{0xcd500000}; | 66 | constexpr std::size_t application_size{0xcd500000}; |
| 67 | constexpr std::size_t applet_size{0x1fb00000}; | 67 | constexpr std::size_t applet_size{0x1fb00000}; |
| 68 | constexpr PAddr application_start_address{Core::DramMemoryMap::End - application_size}; | 68 | constexpr PAddr application_start_address{Core::DramMemoryMap::End - application_size}; |
| @@ -76,15 +76,15 @@ public: | |||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | private: | 78 | private: |
| 79 | constexpr MemoryLayout(PAddr application_start_address, std::size_t application_size, | 79 | constexpr KMemoryLayout(PAddr application_start_address, std::size_t application_size, |
| 80 | PAddr applet_start_address, std::size_t applet_size, | 80 | PAddr applet_start_address, std::size_t applet_size, |
| 81 | PAddr system_start_address, std::size_t system_size) | 81 | PAddr system_start_address, std::size_t system_size) |
| 82 | : application{application_start_address, application_size}, | 82 | : application{application_start_address, application_size}, |
| 83 | applet{applet_start_address, applet_size}, system{system_start_address, system_size} {} | 83 | applet{applet_start_address, applet_size}, system{system_start_address, system_size} {} |
| 84 | 84 | ||
| 85 | const MemoryRegion application; | 85 | const KMemoryRegion application; |
| 86 | const MemoryRegion applet; | 86 | const KMemoryRegion applet; |
| 87 | const MemoryRegion system; | 87 | const KMemoryRegion system; |
| 88 | }; | 88 | }; |
| 89 | 89 | ||
| 90 | } // namespace Kernel::Memory | 90 | } // namespace Kernel |
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp index e5620da5a..1661afbd9 100644 --- a/src/core/hle/kernel/k_thread.cpp +++ b/src/core/hle/kernel/k_thread.cpp | |||
| @@ -20,13 +20,13 @@ | |||
| 20 | #include "core/hardware_properties.h" | 20 | #include "core/hardware_properties.h" |
| 21 | #include "core/hle/kernel/handle_table.h" | 21 | #include "core/hle/kernel/handle_table.h" |
| 22 | #include "core/hle/kernel/k_condition_variable.h" | 22 | #include "core/hle/kernel/k_condition_variable.h" |
| 23 | #include "core/hle/kernel/k_memory_layout.h" | ||
| 23 | #include "core/hle/kernel/k_resource_limit.h" | 24 | #include "core/hle/kernel/k_resource_limit.h" |
| 24 | #include "core/hle/kernel/k_scheduler.h" | 25 | #include "core/hle/kernel/k_scheduler.h" |
| 25 | #include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h" | 26 | #include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h" |
| 26 | #include "core/hle/kernel/k_thread.h" | 27 | #include "core/hle/kernel/k_thread.h" |
| 27 | #include "core/hle/kernel/k_thread_queue.h" | 28 | #include "core/hle/kernel/k_thread_queue.h" |
| 28 | #include "core/hle/kernel/kernel.h" | 29 | #include "core/hle/kernel/kernel.h" |
| 29 | #include "core/hle/kernel/memory/memory_layout.h" | ||
| 30 | #include "core/hle/kernel/object.h" | 30 | #include "core/hle/kernel/object.h" |
| 31 | #include "core/hle/kernel/process.h" | 31 | #include "core/hle/kernel/process.h" |
| 32 | #include "core/hle/kernel/svc_results.h" | 32 | #include "core/hle/kernel/svc_results.h" |
| @@ -782,7 +782,7 @@ void KThread::AddWaiterImpl(KThread* thread) { | |||
| 782 | } | 782 | } |
| 783 | 783 | ||
| 784 | // Keep track of how many kernel waiters we have. | 784 | // Keep track of how many kernel waiters we have. |
| 785 | if (Memory::IsKernelAddressKey(thread->GetAddressKey())) { | 785 | if (IsKernelAddressKey(thread->GetAddressKey())) { |
| 786 | ASSERT((num_kernel_waiters++) >= 0); | 786 | ASSERT((num_kernel_waiters++) >= 0); |
| 787 | } | 787 | } |
| 788 | 788 | ||
| @@ -795,7 +795,7 @@ void KThread::RemoveWaiterImpl(KThread* thread) { | |||
| 795 | ASSERT(kernel.GlobalSchedulerContext().IsLocked()); | 795 | ASSERT(kernel.GlobalSchedulerContext().IsLocked()); |
| 796 | 796 | ||
| 797 | // Keep track of how many kernel waiters we have. | 797 | // Keep track of how many kernel waiters we have. |
| 798 | if (Memory::IsKernelAddressKey(thread->GetAddressKey())) { | 798 | if (IsKernelAddressKey(thread->GetAddressKey())) { |
| 799 | ASSERT((num_kernel_waiters--) > 0); | 799 | ASSERT((num_kernel_waiters--) > 0); |
| 800 | } | 800 | } |
| 801 | 801 | ||
| @@ -870,7 +870,7 @@ KThread* KThread::RemoveWaiterByKey(s32* out_num_waiters, VAddr key) { | |||
| 870 | KThread* thread = std::addressof(*it); | 870 | KThread* thread = std::addressof(*it); |
| 871 | 871 | ||
| 872 | // Keep track of how many kernel waiters we have. | 872 | // Keep track of how many kernel waiters we have. |
| 873 | if (Memory::IsKernelAddressKey(thread->GetAddressKey())) { | 873 | if (IsKernelAddressKey(thread->GetAddressKey())) { |
| 874 | ASSERT((num_kernel_waiters--) > 0); | 874 | ASSERT((num_kernel_waiters--) > 0); |
| 875 | } | 875 | } |
| 876 | it = waiter_list.erase(it); | 876 | it = waiter_list.erase(it); |
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 5eb602843..98b3ec712 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -27,12 +27,12 @@ | |||
| 27 | #include "core/hardware_properties.h" | 27 | #include "core/hardware_properties.h" |
| 28 | #include "core/hle/kernel/client_port.h" | 28 | #include "core/hle/kernel/client_port.h" |
| 29 | #include "core/hle/kernel/handle_table.h" | 29 | #include "core/hle/kernel/handle_table.h" |
| 30 | #include "core/hle/kernel/k_memory_layout.h" | ||
| 30 | #include "core/hle/kernel/k_resource_limit.h" | 31 | #include "core/hle/kernel/k_resource_limit.h" |
| 31 | #include "core/hle/kernel/k_scheduler.h" | 32 | #include "core/hle/kernel/k_scheduler.h" |
| 32 | #include "core/hle/kernel/k_shared_memory.h" | 33 | #include "core/hle/kernel/k_shared_memory.h" |
| 33 | #include "core/hle/kernel/k_thread.h" | 34 | #include "core/hle/kernel/k_thread.h" |
| 34 | #include "core/hle/kernel/kernel.h" | 35 | #include "core/hle/kernel/kernel.h" |
| 35 | #include "core/hle/kernel/memory/memory_layout.h" | ||
| 36 | #include "core/hle/kernel/memory/memory_manager.h" | 36 | #include "core/hle/kernel/memory/memory_manager.h" |
| 37 | #include "core/hle/kernel/memory/slab_heap.h" | 37 | #include "core/hle/kernel/memory/slab_heap.h" |
| 38 | #include "core/hle/kernel/physical_core.h" | 38 | #include "core/hle/kernel/physical_core.h" |
| @@ -266,7 +266,7 @@ struct KernelCore::Impl { | |||
| 266 | 266 | ||
| 267 | void InitializeMemoryLayout() { | 267 | void InitializeMemoryLayout() { |
| 268 | // Initialize memory layout | 268 | // Initialize memory layout |
| 269 | constexpr Memory::MemoryLayout layout{Memory::MemoryLayout::GetDefaultLayout()}; | 269 | constexpr KMemoryLayout layout{KMemoryLayout::GetDefaultLayout()}; |
| 270 | constexpr std::size_t hid_size{0x40000}; | 270 | constexpr std::size_t hid_size{0x40000}; |
| 271 | constexpr std::size_t font_size{0x1100000}; | 271 | constexpr std::size_t font_size{0x1100000}; |
| 272 | constexpr std::size_t irs_size{0x8000}; | 272 | constexpr std::size_t irs_size{0x8000}; |
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 85899f83c..12cfdcf2c 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include "core/hle/kernel/k_address_arbiter.h" | 27 | #include "core/hle/kernel/k_address_arbiter.h" |
| 28 | #include "core/hle/kernel/k_condition_variable.h" | 28 | #include "core/hle/kernel/k_condition_variable.h" |
| 29 | #include "core/hle/kernel/k_event.h" | 29 | #include "core/hle/kernel/k_event.h" |
| 30 | #include "core/hle/kernel/k_memory_layout.h" | ||
| 30 | #include "core/hle/kernel/k_readable_event.h" | 31 | #include "core/hle/kernel/k_readable_event.h" |
| 31 | #include "core/hle/kernel/k_resource_limit.h" | 32 | #include "core/hle/kernel/k_resource_limit.h" |
| 32 | #include "core/hle/kernel/k_scheduler.h" | 33 | #include "core/hle/kernel/k_scheduler.h" |
| @@ -38,7 +39,6 @@ | |||
| 38 | #include "core/hle/kernel/k_writable_event.h" | 39 | #include "core/hle/kernel/k_writable_event.h" |
| 39 | #include "core/hle/kernel/kernel.h" | 40 | #include "core/hle/kernel/kernel.h" |
| 40 | #include "core/hle/kernel/memory/memory_block.h" | 41 | #include "core/hle/kernel/memory/memory_block.h" |
| 41 | #include "core/hle/kernel/memory/memory_layout.h" | ||
| 42 | #include "core/hle/kernel/memory/page_table.h" | 42 | #include "core/hle/kernel/memory/page_table.h" |
| 43 | #include "core/hle/kernel/physical_core.h" | 43 | #include "core/hle/kernel/physical_core.h" |
| 44 | #include "core/hle/kernel/process.h" | 44 | #include "core/hle/kernel/process.h" |
| @@ -508,7 +508,7 @@ static ResultCode ArbitrateLock(Core::System& system, Handle thread_handle, VAdd | |||
| 508 | thread_handle, address, tag); | 508 | thread_handle, address, tag); |
| 509 | 509 | ||
| 510 | // Validate the input address. | 510 | // Validate the input address. |
| 511 | if (Memory::IsKernelAddress(address)) { | 511 | if (IsKernelAddress(address)) { |
| 512 | LOG_ERROR(Kernel_SVC, "Attempting to arbitrate a lock on a kernel address (address={:08X})", | 512 | LOG_ERROR(Kernel_SVC, "Attempting to arbitrate a lock on a kernel address (address={:08X})", |
| 513 | address); | 513 | address); |
| 514 | return ResultInvalidCurrentMemory; | 514 | return ResultInvalidCurrentMemory; |
| @@ -531,8 +531,7 @@ static ResultCode ArbitrateUnlock(Core::System& system, VAddr address) { | |||
| 531 | LOG_TRACE(Kernel_SVC, "called address=0x{:X}", address); | 531 | LOG_TRACE(Kernel_SVC, "called address=0x{:X}", address); |
| 532 | 532 | ||
| 533 | // Validate the input address. | 533 | // Validate the input address. |
| 534 | 534 | if (IsKernelAddress(address)) { | |
| 535 | if (Memory::IsKernelAddress(address)) { | ||
| 536 | LOG_ERROR(Kernel_SVC, | 535 | LOG_ERROR(Kernel_SVC, |
| 537 | "Attempting to arbitrate an unlock on a kernel address (address={:08X})", | 536 | "Attempting to arbitrate an unlock on a kernel address (address={:08X})", |
| 538 | address); | 537 | address); |
| @@ -1638,7 +1637,7 @@ static ResultCode WaitProcessWideKeyAtomic(Core::System& system, VAddr address, | |||
| 1638 | cv_key, tag, timeout_ns); | 1637 | cv_key, tag, timeout_ns); |
| 1639 | 1638 | ||
| 1640 | // Validate input. | 1639 | // Validate input. |
| 1641 | if (Memory::IsKernelAddress(address)) { | 1640 | if (IsKernelAddress(address)) { |
| 1642 | LOG_ERROR(Kernel_SVC, "Attempted to wait on kernel address (address={:08X})", address); | 1641 | LOG_ERROR(Kernel_SVC, "Attempted to wait on kernel address (address={:08X})", address); |
| 1643 | return ResultInvalidCurrentMemory; | 1642 | return ResultInvalidCurrentMemory; |
| 1644 | } | 1643 | } |
| @@ -1720,7 +1719,7 @@ static ResultCode WaitForAddress(Core::System& system, VAddr address, Svc::Arbit | |||
| 1720 | address, arb_type, value, timeout_ns); | 1719 | address, arb_type, value, timeout_ns); |
| 1721 | 1720 | ||
| 1722 | // Validate input. | 1721 | // Validate input. |
| 1723 | if (Memory::IsKernelAddress(address)) { | 1722 | if (IsKernelAddress(address)) { |
| 1724 | LOG_ERROR(Kernel_SVC, "Attempting to wait on kernel address (address={:08X})", address); | 1723 | LOG_ERROR(Kernel_SVC, "Attempting to wait on kernel address (address={:08X})", address); |
| 1725 | return ResultInvalidCurrentMemory; | 1724 | return ResultInvalidCurrentMemory; |
| 1726 | } | 1725 | } |
| @@ -1765,7 +1764,7 @@ static ResultCode SignalToAddress(Core::System& system, VAddr address, Svc::Sign | |||
| 1765 | address, signal_type, value, count); | 1764 | address, signal_type, value, count); |
| 1766 | 1765 | ||
| 1767 | // Validate input. | 1766 | // Validate input. |
| 1768 | if (Memory::IsKernelAddress(address)) { | 1767 | if (IsKernelAddress(address)) { |
| 1769 | LOG_ERROR(Kernel_SVC, "Attempting to signal to a kernel address (address={:08X})", address); | 1768 | LOG_ERROR(Kernel_SVC, "Attempting to signal to a kernel address (address={:08X})", address); |
| 1770 | return ResultInvalidCurrentMemory; | 1769 | return ResultInvalidCurrentMemory; |
| 1771 | } | 1770 | } |