diff options
| author | 2017-12-29 13:27:58 -0500 | |
|---|---|---|
| committer | 2017-12-29 13:27:58 -0500 | |
| commit | ebd4b1422d55c9affc38e8133e897e39684e9ccb (patch) | |
| tree | 53513cb3d4e28493173a3f708764a4924654ba91 /src | |
| parent | applet_oe: Stub out a bunch of interfaces necessary for boot. (diff) | |
| download | yuzu-ebd4b1422d55c9affc38e8133e897e39684e9ccb.tar.gz yuzu-ebd4b1422d55c9affc38e8133e897e39684e9ccb.tar.xz yuzu-ebd4b1422d55c9affc38e8133e897e39684e9ccb.zip | |
kernel: Various 64-bit fixes in memory/process/thread
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/kernel/memory.h | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/process.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/process.h | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.h | 4 |
5 files changed, 14 insertions, 14 deletions
diff --git a/src/core/hle/kernel/memory.h b/src/core/hle/kernel/memory.h index da6bb3563..61e30c679 100644 --- a/src/core/hle/kernel/memory.h +++ b/src/core/hle/kernel/memory.h | |||
| @@ -13,9 +13,9 @@ namespace Kernel { | |||
| 13 | class VMManager; | 13 | class VMManager; |
| 14 | 14 | ||
| 15 | struct MemoryRegionInfo { | 15 | struct MemoryRegionInfo { |
| 16 | u32 base; // Not an address, but offset from start of FCRAM | 16 | u64 base; // Not an address, but offset from start of FCRAM |
| 17 | u32 size; | 17 | u64 size; |
| 18 | u32 used; | 18 | u64 used; |
| 19 | 19 | ||
| 20 | std::shared_ptr<std::vector<u8>> linear_heap_memory; | 20 | std::shared_ptr<std::vector<u8>> linear_heap_memory; |
| 21 | }; | 21 | }; |
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index 9bcb08fc9..80b1be1fd 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp | |||
| @@ -167,7 +167,7 @@ VAddr Process::GetLinearHeapLimit() const { | |||
| 167 | return GetLinearHeapBase() + memory_region->size; | 167 | return GetLinearHeapBase() + memory_region->size; |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | ResultVal<VAddr> Process::HeapAllocate(VAddr target, u32 size, VMAPermission perms) { | 170 | ResultVal<VAddr> Process::HeapAllocate(VAddr target, u64 size, VMAPermission perms) { |
| 171 | if (target < Memory::HEAP_VADDR || target + size > Memory::HEAP_VADDR_END || | 171 | if (target < Memory::HEAP_VADDR || target + size > Memory::HEAP_VADDR_END || |
| 172 | target + size < target) { | 172 | target + size < target) { |
| 173 | return ERR_INVALID_ADDRESS; | 173 | return ERR_INVALID_ADDRESS; |
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h index 3b646c076..6774168e5 100644 --- a/src/core/hle/kernel/process.h +++ b/src/core/hle/kernel/process.h | |||
| @@ -19,7 +19,7 @@ namespace Kernel { | |||
| 19 | struct AddressMapping { | 19 | struct AddressMapping { |
| 20 | // Address and size must be page-aligned | 20 | // Address and size must be page-aligned |
| 21 | VAddr address; | 21 | VAddr address; |
| 22 | u32 size; | 22 | u64 size; |
| 23 | bool read_only; | 23 | bool read_only; |
| 24 | bool unk_flag; | 24 | bool unk_flag; |
| 25 | }; | 25 | }; |
| @@ -154,7 +154,7 @@ public: | |||
| 154 | // The left/right bounds of the address space covered by heap_memory. | 154 | // The left/right bounds of the address space covered by heap_memory. |
| 155 | VAddr heap_start = 0, heap_end = 0; | 155 | VAddr heap_start = 0, heap_end = 0; |
| 156 | 156 | ||
| 157 | u32 heap_used = 0, linear_heap_used = 0, misc_memory_used = 0; | 157 | u64 heap_used = 0, linear_heap_used = 0, misc_memory_used = 0; |
| 158 | 158 | ||
| 159 | MemoryRegionInfo* memory_region = nullptr; | 159 | MemoryRegionInfo* memory_region = nullptr; |
| 160 | 160 | ||
| @@ -171,7 +171,7 @@ public: | |||
| 171 | VAddr GetLinearHeapBase() const; | 171 | VAddr GetLinearHeapBase() const; |
| 172 | VAddr GetLinearHeapLimit() const; | 172 | VAddr GetLinearHeapLimit() const; |
| 173 | 173 | ||
| 174 | ResultVal<VAddr> HeapAllocate(VAddr target, u32 size, VMAPermission perms); | 174 | ResultVal<VAddr> HeapAllocate(VAddr target, u64 size, VMAPermission perms); |
| 175 | ResultCode HeapFree(VAddr target, u32 size); | 175 | ResultCode HeapFree(VAddr target, u32 size); |
| 176 | 176 | ||
| 177 | ResultVal<VAddr> LinearAllocate(VAddr target, u32 size, VMAPermission perms); | 177 | ResultVal<VAddr> LinearAllocate(VAddr target, u32 size, VMAPermission perms); |
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 372cafdd9..1645437b6 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -103,8 +103,8 @@ void Thread::Stop() { | |||
| 103 | ReleaseThreadMutexes(this); | 103 | ReleaseThreadMutexes(this); |
| 104 | 104 | ||
| 105 | // Mark the TLS slot in the thread's page as free. | 105 | // Mark the TLS slot in the thread's page as free. |
| 106 | u32 tls_page = (tls_address - Memory::TLS_AREA_VADDR) / Memory::PAGE_SIZE; | 106 | u64 tls_page = (tls_address - Memory::TLS_AREA_VADDR) / Memory::PAGE_SIZE; |
| 107 | u32 tls_slot = | 107 | u64 tls_slot = |
| 108 | ((tls_address - Memory::TLS_AREA_VADDR) % Memory::PAGE_SIZE) / Memory::TLS_ENTRY_SIZE; | 108 | ((tls_address - Memory::TLS_AREA_VADDR) % Memory::PAGE_SIZE) / Memory::TLS_ENTRY_SIZE; |
| 109 | Kernel::g_current_process->tls_slots[tls_page].reset(tls_slot); | 109 | Kernel::g_current_process->tls_slots[tls_page].reset(tls_slot); |
| 110 | } | 110 | } |
| @@ -184,7 +184,7 @@ static void SwitchContext(Thread* new_thread) { | |||
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | Core::CPU().LoadContext(new_thread->context); | 186 | Core::CPU().LoadContext(new_thread->context); |
| 187 | Core::CPU().SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress()); | 187 | Core::CPU().SetTlsAddress(new_thread->GetTLSAddress()); |
| 188 | } else { | 188 | } else { |
| 189 | current_thread = nullptr; | 189 | current_thread = nullptr; |
| 190 | // Note: We do not reset the current process and current page table when idling because | 190 | // Note: We do not reset the current process and current page table when idling because |
| @@ -369,7 +369,7 @@ static void ResetThreadContext(ARM_Interface::ThreadContext& context, VAddr stac | |||
| 369 | } | 369 | } |
| 370 | 370 | ||
| 371 | ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point, u32 priority, | 371 | ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point, u32 priority, |
| 372 | u32 arg, s32 processor_id, VAddr stack_top, | 372 | u64 arg, s32 processor_id, VAddr stack_top, |
| 373 | SharedPtr<Process> owner_process) { | 373 | SharedPtr<Process> owner_process) { |
| 374 | // Check if priority is in ranged. Lowest priority -> highest priority id. | 374 | // Check if priority is in ranged. Lowest priority -> highest priority id. |
| 375 | if (priority > THREADPRIO_LOWEST) { | 375 | if (priority > THREADPRIO_LOWEST) { |
| @@ -493,7 +493,7 @@ void Thread::BoostPriority(u32 priority) { | |||
| 493 | current_priority = priority; | 493 | current_priority = priority; |
| 494 | } | 494 | } |
| 495 | 495 | ||
| 496 | SharedPtr<Thread> SetupMainThread(u32 entry_point, u32 priority, SharedPtr<Process> owner_process) { | 496 | SharedPtr<Thread> SetupMainThread(VAddr entry_point, u32 priority, SharedPtr<Process> owner_process) { |
| 497 | // Setup page table so we can write to memory | 497 | // Setup page table so we can write to memory |
| 498 | SetCurrentPageTable(&Kernel::g_current_process->vm_manager.page_table); | 498 | SetCurrentPageTable(&Kernel::g_current_process->vm_manager.page_table); |
| 499 | 499 | ||
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index fafcab156..25d678ba3 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -65,7 +65,7 @@ public: | |||
| 65 | * @return A shared pointer to the newly created thread | 65 | * @return A shared pointer to the newly created thread |
| 66 | */ | 66 | */ |
| 67 | static ResultVal<SharedPtr<Thread>> Create(std::string name, VAddr entry_point, u32 priority, | 67 | static ResultVal<SharedPtr<Thread>> Create(std::string name, VAddr entry_point, u32 priority, |
| 68 | u32 arg, s32 processor_id, VAddr stack_top, | 68 | u64 arg, s32 processor_id, VAddr stack_top, |
| 69 | SharedPtr<Process> owner_process); | 69 | SharedPtr<Process> owner_process); |
| 70 | 70 | ||
| 71 | std::string GetName() const override { | 71 | std::string GetName() const override { |
| @@ -234,7 +234,7 @@ private: | |||
| 234 | * @param owner_process The parent process for the main thread | 234 | * @param owner_process The parent process for the main thread |
| 235 | * @return A shared pointer to the main thread | 235 | * @return A shared pointer to the main thread |
| 236 | */ | 236 | */ |
| 237 | SharedPtr<Thread> SetupMainThread(u32 entry_point, u32 priority, SharedPtr<Process> owner_process); | 237 | SharedPtr<Thread> SetupMainThread(VAddr entry_point, u32 priority, SharedPtr<Process> owner_process); |
| 238 | 238 | ||
| 239 | /** | 239 | /** |
| 240 | * Returns whether there are any threads that are ready to run. | 240 | * Returns whether there are any threads that are ready to run. |