From ebd4b1422d55c9affc38e8133e897e39684e9ccb Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 29 Dec 2017 13:27:58 -0500 Subject: kernel: Various 64-bit fixes in memory/process/thread --- src/core/hle/kernel/memory.h | 6 +++--- src/core/hle/kernel/process.cpp | 2 +- src/core/hle/kernel/process.h | 6 +++--- src/core/hle/kernel/thread.cpp | 10 +++++----- src/core/hle/kernel/thread.h | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/core') 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 { class VMManager; struct MemoryRegionInfo { - u32 base; // Not an address, but offset from start of FCRAM - u32 size; - u32 used; + u64 base; // Not an address, but offset from start of FCRAM + u64 size; + u64 used; std::shared_ptr> linear_heap_memory; }; 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 { return GetLinearHeapBase() + memory_region->size; } -ResultVal Process::HeapAllocate(VAddr target, u32 size, VMAPermission perms) { +ResultVal Process::HeapAllocate(VAddr target, u64 size, VMAPermission perms) { if (target < Memory::HEAP_VADDR || target + size > Memory::HEAP_VADDR_END || target + size < target) { 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 { struct AddressMapping { // Address and size must be page-aligned VAddr address; - u32 size; + u64 size; bool read_only; bool unk_flag; }; @@ -154,7 +154,7 @@ public: // The left/right bounds of the address space covered by heap_memory. VAddr heap_start = 0, heap_end = 0; - u32 heap_used = 0, linear_heap_used = 0, misc_memory_used = 0; + u64 heap_used = 0, linear_heap_used = 0, misc_memory_used = 0; MemoryRegionInfo* memory_region = nullptr; @@ -171,7 +171,7 @@ public: VAddr GetLinearHeapBase() const; VAddr GetLinearHeapLimit() const; - ResultVal HeapAllocate(VAddr target, u32 size, VMAPermission perms); + ResultVal HeapAllocate(VAddr target, u64 size, VMAPermission perms); ResultCode HeapFree(VAddr target, u32 size); ResultVal 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() { ReleaseThreadMutexes(this); // Mark the TLS slot in the thread's page as free. - u32 tls_page = (tls_address - Memory::TLS_AREA_VADDR) / Memory::PAGE_SIZE; - u32 tls_slot = + u64 tls_page = (tls_address - Memory::TLS_AREA_VADDR) / Memory::PAGE_SIZE; + u64 tls_slot = ((tls_address - Memory::TLS_AREA_VADDR) % Memory::PAGE_SIZE) / Memory::TLS_ENTRY_SIZE; Kernel::g_current_process->tls_slots[tls_page].reset(tls_slot); } @@ -184,7 +184,7 @@ static void SwitchContext(Thread* new_thread) { } Core::CPU().LoadContext(new_thread->context); - Core::CPU().SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress()); + Core::CPU().SetTlsAddress(new_thread->GetTLSAddress()); } else { current_thread = nullptr; // 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 } ResultVal> Thread::Create(std::string name, VAddr entry_point, u32 priority, - u32 arg, s32 processor_id, VAddr stack_top, + u64 arg, s32 processor_id, VAddr stack_top, SharedPtr owner_process) { // Check if priority is in ranged. Lowest priority -> highest priority id. if (priority > THREADPRIO_LOWEST) { @@ -493,7 +493,7 @@ void Thread::BoostPriority(u32 priority) { current_priority = priority; } -SharedPtr SetupMainThread(u32 entry_point, u32 priority, SharedPtr owner_process) { +SharedPtr SetupMainThread(VAddr entry_point, u32 priority, SharedPtr owner_process) { // Setup page table so we can write to memory SetCurrentPageTable(&Kernel::g_current_process->vm_manager.page_table); 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: * @return A shared pointer to the newly created thread */ static ResultVal> Create(std::string name, VAddr entry_point, u32 priority, - u32 arg, s32 processor_id, VAddr stack_top, + u64 arg, s32 processor_id, VAddr stack_top, SharedPtr owner_process); std::string GetName() const override { @@ -234,7 +234,7 @@ private: * @param owner_process The parent process for the main thread * @return A shared pointer to the main thread */ -SharedPtr SetupMainThread(u32 entry_point, u32 priority, SharedPtr owner_process); +SharedPtr SetupMainThread(VAddr entry_point, u32 priority, SharedPtr owner_process); /** * Returns whether there are any threads that are ready to run. -- cgit v1.2.3