diff options
| author | 2015-05-01 19:05:18 -0400 | |
|---|---|---|
| committer | 2015-05-01 19:05:18 -0400 | |
| commit | 6a2d8c46f21e8813e0472dba28932ed461ce1a66 (patch) | |
| tree | d7057cf9926c822c12cc7d82814a252db79ca600 /src/core | |
| parent | Merge pull request #717 from linkmauve/useless-auto (diff) | |
| parent | Qt: Shutdown game on emulator close event. (diff) | |
| download | yuzu-6a2d8c46f21e8813e0472dba28932ed461ce1a66.tar.gz yuzu-6a2d8c46f21e8813e0472dba28932ed461ce1a66.tar.xz yuzu-6a2d8c46f21e8813e0472dba28932ed461ce1a66.zip | |
Merge pull request #713 from bunnei/qt-emuthread-fixes
Fix emulation state resetting to support multiple emulation sessions
Diffstat (limited to '')
28 files changed, 174 insertions, 100 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom.cpp b/src/core/arm/dyncom/arm_dyncom.cpp index bc1e969e4..128413262 100644 --- a/src/core/arm/dyncom/arm_dyncom.cpp +++ b/src/core/arm/dyncom/arm_dyncom.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/make_unique.h" | ||
| 6 | |||
| 5 | #include "core/arm/skyeye_common/armemu.h" | 7 | #include "core/arm/skyeye_common/armemu.h" |
| 6 | #include "core/arm/skyeye_common/vfp/vfp.h" | 8 | #include "core/arm/skyeye_common/vfp/vfp.h" |
| 7 | 9 | ||
| @@ -17,7 +19,7 @@ const static cpu_config_t s_arm11_cpu_info = { | |||
| 17 | }; | 19 | }; |
| 18 | 20 | ||
| 19 | ARM_DynCom::ARM_DynCom(PrivilegeMode initial_mode) { | 21 | ARM_DynCom::ARM_DynCom(PrivilegeMode initial_mode) { |
| 20 | state = std::unique_ptr<ARMul_State>(new ARMul_State); | 22 | state = Common::make_unique<ARMul_State>(); |
| 21 | 23 | ||
| 22 | ARMul_NewState(state.get()); | 24 | ARMul_NewState(state.get()); |
| 23 | ARMul_SelectProcessor(state.get(), ARM_v6_Prop | ARM_v5_Prop | ARM_v5e_Prop); | 25 | ARMul_SelectProcessor(state.get(), ARM_v6_Prop | ARM_v5_Prop | ARM_v5e_Prop); |
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index fde11e4ff..991da740b 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | #include <algorithm> | 7 | #include <algorithm> |
| 8 | #include <cstdio> | 8 | #include <cstdio> |
| 9 | #include <unordered_map> | ||
| 10 | 9 | ||
| 11 | #include "common/logging/log.h" | 10 | #include "common/logging/log.h" |
| 12 | #include "common/profiler.h" | 11 | #include "common/profiler.h" |
| @@ -3533,25 +3532,6 @@ const transop_fp_t arm_instruction_trans[] = { | |||
| 3533 | INTERPRETER_TRANSLATE(blx_1_thumb) | 3532 | INTERPRETER_TRANSLATE(blx_1_thumb) |
| 3534 | }; | 3533 | }; |
| 3535 | 3534 | ||
| 3536 | typedef std::unordered_map<u32, int> bb_map; | ||
| 3537 | static bb_map CreamCache; | ||
| 3538 | |||
| 3539 | static void insert_bb(unsigned int addr, int start) { | ||
| 3540 | CreamCache[addr] = start; | ||
| 3541 | } | ||
| 3542 | |||
| 3543 | static int find_bb(unsigned int addr, int& start) { | ||
| 3544 | int ret = -1; | ||
| 3545 | bb_map::const_iterator it = CreamCache.find(addr); | ||
| 3546 | if (it != CreamCache.end()) { | ||
| 3547 | start = static_cast<int>(it->second); | ||
| 3548 | ret = 0; | ||
| 3549 | } else { | ||
| 3550 | ret = -1; | ||
| 3551 | } | ||
| 3552 | return ret; | ||
| 3553 | } | ||
| 3554 | |||
| 3555 | enum { | 3535 | enum { |
| 3556 | FETCH_SUCCESS, | 3536 | FETCH_SUCCESS, |
| 3557 | FETCH_FAILURE | 3537 | FETCH_FAILURE |
| @@ -3674,7 +3654,9 @@ translated: | |||
| 3674 | } | 3654 | } |
| 3675 | ret = inst_base->br; | 3655 | ret = inst_base->br; |
| 3676 | }; | 3656 | }; |
| 3677 | insert_bb(pc_start, bb_start); | 3657 | |
| 3658 | cpu->instruction_cache[pc_start] = bb_start; | ||
| 3659 | |||
| 3678 | return KEEP_GOING; | 3660 | return KEEP_GOING; |
| 3679 | } | 3661 | } |
| 3680 | 3662 | ||
| @@ -4001,9 +3983,14 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4001 | 3983 | ||
| 4002 | phys_addr = cpu->Reg[15]; | 3984 | phys_addr = cpu->Reg[15]; |
| 4003 | 3985 | ||
| 4004 | if (find_bb(cpu->Reg[15], ptr) == -1) | 3986 | // Find the cached instruction cream, otherwise translate it... |
| 3987 | auto itr = cpu->instruction_cache.find(cpu->Reg[15]); | ||
| 3988 | if (itr != cpu->instruction_cache.end()) { | ||
| 3989 | ptr = itr->second; | ||
| 3990 | } else { | ||
| 4005 | if (InterpreterTranslate(cpu, ptr, cpu->Reg[15]) == FETCH_EXCEPTION) | 3991 | if (InterpreterTranslate(cpu, ptr, cpu->Reg[15]) == FETCH_EXCEPTION) |
| 4006 | goto END; | 3992 | goto END; |
| 3993 | } | ||
| 4007 | 3994 | ||
| 4008 | inst_base = (arm_inst *)&inst_buf[ptr]; | 3995 | inst_base = (arm_inst *)&inst_buf[ptr]; |
| 4009 | GOTO_NEXT_INST; | 3996 | GOTO_NEXT_INST; |
diff --git a/src/core/arm/interpreter/arminit.cpp b/src/core/arm/interpreter/arminit.cpp index 6ac45c396..31b2bab06 100644 --- a/src/core/arm/interpreter/arminit.cpp +++ b/src/core/arm/interpreter/arminit.cpp | |||
| @@ -26,8 +26,6 @@ | |||
| 26 | \***************************************************************************/ | 26 | \***************************************************************************/ |
| 27 | ARMul_State* ARMul_NewState(ARMul_State* state) | 27 | ARMul_State* ARMul_NewState(ARMul_State* state) |
| 28 | { | 28 | { |
| 29 | memset(state, 0, sizeof(ARMul_State)); | ||
| 30 | |||
| 31 | state->Emulate = RUN; | 29 | state->Emulate = RUN; |
| 32 | state->Mode = USER32MODE; | 30 | state->Mode = USER32MODE; |
| 33 | 31 | ||
diff --git a/src/core/arm/skyeye_common/armdefs.h b/src/core/arm/skyeye_common/armdefs.h index 08da6d9eb..85d523bc2 100644 --- a/src/core/arm/skyeye_common/armdefs.h +++ b/src/core/arm/skyeye_common/armdefs.h | |||
| @@ -17,6 +17,8 @@ | |||
| 17 | 17 | ||
| 18 | #pragma once | 18 | #pragma once |
| 19 | 19 | ||
| 20 | #include <unordered_map> | ||
| 21 | |||
| 20 | #include "common/common_types.h" | 22 | #include "common/common_types.h" |
| 21 | #include "core/arm/skyeye_common/arm_regformat.h" | 23 | #include "core/arm/skyeye_common/arm_regformat.h" |
| 22 | #include "core/arm/skyeye_common/skyeye_defs.h" | 24 | #include "core/arm/skyeye_common/skyeye_defs.h" |
| @@ -152,6 +154,10 @@ So, if lateabtSig=1, then it means Late Abort Model(Base Updated Abort Model) | |||
| 152 | 154 | ||
| 153 | // Added by ksh in 2005-10-1 | 155 | // Added by ksh in 2005-10-1 |
| 154 | cpu_config_t* cpu; | 156 | cpu_config_t* cpu; |
| 157 | |||
| 158 | // TODO(bunnei): Move this cache to a better place - it should be per codeset (likely per | ||
| 159 | // process for our purposes), not per ARMul_State (which tracks CPU core state). | ||
| 160 | std::unordered_map<u32, int> instruction_cache; | ||
| 155 | }; | 161 | }; |
| 156 | 162 | ||
| 157 | /***************************************************************************\ | 163 | /***************************************************************************\ |
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 6f716b1ca..f70c84c3d 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp | |||
| @@ -160,6 +160,16 @@ void Init() { | |||
| 160 | last_global_time_us = 0; | 160 | last_global_time_us = 0; |
| 161 | has_ts_events = 0; | 161 | has_ts_events = 0; |
| 162 | mhz_change_callbacks.clear(); | 162 | mhz_change_callbacks.clear(); |
| 163 | |||
| 164 | first = nullptr; | ||
| 165 | ts_first = nullptr; | ||
| 166 | ts_last = nullptr; | ||
| 167 | |||
| 168 | event_pool = nullptr; | ||
| 169 | event_ts_pool = nullptr; | ||
| 170 | allocated_ts_events = 0; | ||
| 171 | |||
| 172 | advance_callback = nullptr; | ||
| 163 | } | 173 | } |
| 164 | 174 | ||
| 165 | void Shutdown() { | 175 | void Shutdown() { |
diff --git a/src/core/hle/config_mem.cpp b/src/core/hle/config_mem.cpp index 30d73adac..9fcfcc285 100644 --- a/src/core/hle/config_mem.cpp +++ b/src/core/hle/config_mem.cpp | |||
| @@ -61,6 +61,8 @@ template void Read<u16>(u16 &var, const u32 addr); | |||
| 61 | template void Read<u8>(u8 &var, const u32 addr); | 61 | template void Read<u8>(u8 &var, const u32 addr); |
| 62 | 62 | ||
| 63 | void Init() { | 63 | void Init() { |
| 64 | memset(&config_mem, 0, sizeof(config_mem)); | ||
| 65 | |||
| 64 | config_mem.update_flag = 0; // No update | 66 | config_mem.update_flag = 0; // No update |
| 65 | config_mem.sys_core_ver = 0x2; | 67 | config_mem.sys_core_ver = 0x2; |
| 66 | config_mem.unit_info = 0x1; // Bit 0 set for Retail | 68 | config_mem.unit_info = 0x1; // Bit 0 set for Retail |
| @@ -76,4 +78,7 @@ void Init() { | |||
| 76 | config_mem.firm_sys_core_ver = 0x2; | 78 | config_mem.firm_sys_core_ver = 0x2; |
| 77 | } | 79 | } |
| 78 | 80 | ||
| 81 | void Shutdown() { | ||
| 82 | } | ||
| 83 | |||
| 79 | } // namespace | 84 | } // namespace |
diff --git a/src/core/hle/config_mem.h b/src/core/hle/config_mem.h index 94853901a..cbb478fb3 100644 --- a/src/core/hle/config_mem.h +++ b/src/core/hle/config_mem.h | |||
| @@ -20,4 +20,6 @@ void Read(T &var, const u32 addr); | |||
| 20 | 20 | ||
| 21 | void Init(); | 21 | void Init(); |
| 22 | 22 | ||
| 23 | void Shutdown(); | ||
| 24 | |||
| 23 | } // namespace | 25 | } // namespace |
diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp index c645d6563..191d0411e 100644 --- a/src/core/hle/hle.cpp +++ b/src/core/hle/hle.cpp | |||
| @@ -23,7 +23,7 @@ Common::Profiling::TimingCategory profiler_svc("SVC Calls"); | |||
| 23 | 23 | ||
| 24 | static std::vector<ModuleDef> g_module_db; | 24 | static std::vector<ModuleDef> g_module_db; |
| 25 | 25 | ||
| 26 | bool g_reschedule = false; ///< If true, immediately reschedules the CPU to a new thread | 26 | bool g_reschedule; ///< If true, immediately reschedules the CPU to a new thread |
| 27 | 27 | ||
| 28 | static const FunctionDef* GetSVCInfo(u32 opcode) { | 28 | static const FunctionDef* GetSVCInfo(u32 opcode) { |
| 29 | u32 func_num = opcode & 0xFFFFFF; // 8 bits | 29 | u32 func_num = opcode & 0xFFFFFF; // 8 bits |
| @@ -73,17 +73,20 @@ static void RegisterAllModules() { | |||
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | void Init() { | 75 | void Init() { |
| 76 | Service::Init(); | ||
| 77 | |||
| 78 | RegisterAllModules(); | 76 | RegisterAllModules(); |
| 79 | 77 | ||
| 78 | Service::Init(); | ||
| 80 | ConfigMem::Init(); | 79 | ConfigMem::Init(); |
| 81 | SharedPage::Init(); | 80 | SharedPage::Init(); |
| 82 | 81 | ||
| 82 | g_reschedule = false; | ||
| 83 | |||
| 83 | LOG_DEBUG(Kernel, "initialized OK"); | 84 | LOG_DEBUG(Kernel, "initialized OK"); |
| 84 | } | 85 | } |
| 85 | 86 | ||
| 86 | void Shutdown() { | 87 | void Shutdown() { |
| 88 | ConfigMem::Shutdown(); | ||
| 89 | SharedPage::Shutdown(); | ||
| 87 | Service::Shutdown(); | 90 | Service::Shutdown(); |
| 88 | 91 | ||
| 89 | g_module_db.clear(); | 92 | g_module_db.clear(); |
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 6261b82b6..fca582bbe 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -14,11 +14,10 @@ | |||
| 14 | 14 | ||
| 15 | namespace Kernel { | 15 | namespace Kernel { |
| 16 | 16 | ||
| 17 | unsigned int Object::next_object_id = 0; | 17 | unsigned int Object::next_object_id; |
| 18 | 18 | SharedPtr<Thread> g_main_thread; | |
| 19 | SharedPtr<Thread> g_main_thread = nullptr; | ||
| 20 | HandleTable g_handle_table; | 19 | HandleTable g_handle_table; |
| 21 | u64 g_program_id = 0; | 20 | u64 g_program_id; |
| 22 | 21 | ||
| 23 | void WaitObject::AddWaitingThread(SharedPtr<Thread> thread) { | 22 | void WaitObject::AddWaitingThread(SharedPtr<Thread> thread) { |
| 24 | auto itr = std::find(waiting_threads.begin(), waiting_threads.end(), thread); | 23 | auto itr = std::find(waiting_threads.begin(), waiting_threads.end(), thread); |
| @@ -138,6 +137,10 @@ void HandleTable::Clear() { | |||
| 138 | void Init() { | 137 | void Init() { |
| 139 | Kernel::ThreadingInit(); | 138 | Kernel::ThreadingInit(); |
| 140 | Kernel::TimersInit(); | 139 | Kernel::TimersInit(); |
| 140 | |||
| 141 | Object::next_object_id = 0; | ||
| 142 | g_program_id = 0; | ||
| 143 | g_main_thread = nullptr; | ||
| 141 | } | 144 | } |
| 142 | 145 | ||
| 143 | /// Shutdown the kernel | 146 | /// Shutdown the kernel |
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 2d295ea00..ab06fa025 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h | |||
| @@ -95,12 +95,13 @@ public: | |||
| 95 | return false; | 95 | return false; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | public: | ||
| 99 | static unsigned int next_object_id; | ||
| 100 | |||
| 98 | private: | 101 | private: |
| 99 | friend void intrusive_ptr_add_ref(Object*); | 102 | friend void intrusive_ptr_add_ref(Object*); |
| 100 | friend void intrusive_ptr_release(Object*); | 103 | friend void intrusive_ptr_release(Object*); |
| 101 | 104 | ||
| 102 | static unsigned int next_object_id; | ||
| 103 | |||
| 104 | unsigned int ref_count = 0; | 105 | unsigned int ref_count = 0; |
| 105 | unsigned int object_id = next_object_id++; | 106 | unsigned int object_id = next_object_id++; |
| 106 | }; | 107 | }; |
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 33d66b986..d678f5f6f 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | namespace Kernel { | 23 | namespace Kernel { |
| 24 | 24 | ||
| 25 | /// Event type for the thread wake up event | 25 | /// Event type for the thread wake up event |
| 26 | static int ThreadWakeupEventType = -1; | 26 | static int ThreadWakeupEventType; |
| 27 | 27 | ||
| 28 | bool Thread::ShouldWait() { | 28 | bool Thread::ShouldWait() { |
| 29 | return status != THREADSTATUS_DEAD; | 29 | return status != THREADSTATUS_DEAD; |
| @@ -42,7 +42,7 @@ static Common::ThreadQueueList<Thread*, THREADPRIO_LOWEST+1> ready_queue; | |||
| 42 | static Thread* current_thread; | 42 | static Thread* current_thread; |
| 43 | 43 | ||
| 44 | // The first available thread id at startup | 44 | // The first available thread id at startup |
| 45 | static u32 next_thread_id = 1; | 45 | static u32 next_thread_id; |
| 46 | 46 | ||
| 47 | /** | 47 | /** |
| 48 | * Creates a new thread ID | 48 | * Creates a new thread ID |
| @@ -497,6 +497,12 @@ void Thread::SetWaitSynchronizationOutput(s32 output) { | |||
| 497 | void ThreadingInit() { | 497 | void ThreadingInit() { |
| 498 | ThreadWakeupEventType = CoreTiming::RegisterEvent("ThreadWakeupCallback", ThreadWakeupCallback); | 498 | ThreadWakeupEventType = CoreTiming::RegisterEvent("ThreadWakeupCallback", ThreadWakeupCallback); |
| 499 | 499 | ||
| 500 | current_thread = nullptr; | ||
| 501 | next_thread_id = 1; | ||
| 502 | |||
| 503 | thread_list.clear(); | ||
| 504 | ready_queue.clear(); | ||
| 505 | |||
| 500 | // Setup the idle thread | 506 | // Setup the idle thread |
| 501 | SetupIdleThread(); | 507 | SetupIdleThread(); |
| 502 | } | 508 | } |
diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp index 1ec2a4b10..36979248d 100644 --- a/src/core/hle/kernel/timer.cpp +++ b/src/core/hle/kernel/timer.cpp | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | namespace Kernel { | 12 | namespace Kernel { |
| 13 | 13 | ||
| 14 | /// The event type of the generic timer callback event | 14 | /// The event type of the generic timer callback event |
| 15 | static int timer_callback_event_type = -1; | 15 | static int timer_callback_event_type; |
| 16 | // TODO(yuriks): This can be removed if Timer objects are explicitly pooled in the future, allowing | 16 | // TODO(yuriks): This can be removed if Timer objects are explicitly pooled in the future, allowing |
| 17 | // us to simply use a pool index or similar. | 17 | // us to simply use a pool index or similar. |
| 18 | static Kernel::HandleTable timer_callback_handle_table; | 18 | static Kernel::HandleTable timer_callback_handle_table; |
| @@ -89,6 +89,7 @@ static void TimerCallback(u64 timer_handle, int cycles_late) { | |||
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | void TimersInit() { | 91 | void TimersInit() { |
| 92 | timer_callback_handle_table.Clear(); | ||
| 92 | timer_callback_event_type = CoreTiming::RegisterEvent("TimerCallback", TimerCallback); | 93 | timer_callback_event_type = CoreTiming::RegisterEvent("TimerCallback", TimerCallback); |
| 93 | } | 94 | } |
| 94 | 95 | ||
diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 190c5df7a..98ae80b3a 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp | |||
| @@ -28,15 +28,15 @@ namespace APT { | |||
| 28 | static const VAddr SHARED_FONT_VADDR = 0x18000000; | 28 | static const VAddr SHARED_FONT_VADDR = 0x18000000; |
| 29 | 29 | ||
| 30 | /// Handle to shared memory region designated to for shared system font | 30 | /// Handle to shared memory region designated to for shared system font |
| 31 | static Kernel::SharedPtr<Kernel::SharedMemory> shared_font_mem = nullptr; | 31 | static Kernel::SharedPtr<Kernel::SharedMemory> shared_font_mem; |
| 32 | 32 | ||
| 33 | static Kernel::SharedPtr<Kernel::Mutex> lock = nullptr; | 33 | static Kernel::SharedPtr<Kernel::Mutex> lock; |
| 34 | static Kernel::SharedPtr<Kernel::Event> notification_event = nullptr; ///< APT notification event | 34 | static Kernel::SharedPtr<Kernel::Event> notification_event; ///< APT notification event |
| 35 | static Kernel::SharedPtr<Kernel::Event> start_event = nullptr; ///< APT start event | 35 | static Kernel::SharedPtr<Kernel::Event> start_event; ///< APT start event |
| 36 | 36 | ||
| 37 | static std::vector<u8> shared_font; | 37 | static std::vector<u8> shared_font; |
| 38 | 38 | ||
| 39 | static u32 cpu_percent = 0; ///< CPU time available to the running application | 39 | static u32 cpu_percent; ///< CPU time available to the running application |
| 40 | 40 | ||
| 41 | void Initialize(Service::Interface* self) { | 41 | void Initialize(Service::Interface* self) { |
| 42 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 42 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| @@ -309,6 +309,7 @@ void Init() { | |||
| 309 | } | 309 | } |
| 310 | 310 | ||
| 311 | lock = Kernel::Mutex::Create(false, "APT_U:Lock"); | 311 | lock = Kernel::Mutex::Create(false, "APT_U:Lock"); |
| 312 | |||
| 312 | cpu_percent = 0; | 313 | cpu_percent = 0; |
| 313 | 314 | ||
| 314 | // TODO(bunnei): Check if these are created in Initialize or on APT process startup. | 315 | // TODO(bunnei): Check if these are created in Initialize or on APT process startup. |
| @@ -317,7 +318,11 @@ void Init() { | |||
| 317 | } | 318 | } |
| 318 | 319 | ||
| 319 | void Shutdown() { | 320 | void Shutdown() { |
| 320 | 321 | shared_font.clear(); | |
| 322 | shared_font_mem = nullptr; | ||
| 323 | lock = nullptr; | ||
| 324 | notification_event = nullptr; | ||
| 325 | start_event = nullptr; | ||
| 321 | } | 326 | } |
| 322 | 327 | ||
| 323 | } // namespace APT | 328 | } // namespace APT |
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index 6af0352ac..5eccdecf7 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp | |||
| @@ -207,6 +207,7 @@ void Init() { | |||
| 207 | 207 | ||
| 208 | // Initialize the Username block | 208 | // Initialize the Username block |
| 209 | // TODO(Subv): Initialize this directly in the variable when MSVC supports char16_t string literals | 209 | // TODO(Subv): Initialize this directly in the variable when MSVC supports char16_t string literals |
| 210 | memset(&CONSOLE_USERNAME_BLOCK, 0, sizeof(CONSOLE_USERNAME_BLOCK)); | ||
| 210 | CONSOLE_USERNAME_BLOCK.ng_word = 0; | 211 | CONSOLE_USERNAME_BLOCK.ng_word = 0; |
| 211 | CONSOLE_USERNAME_BLOCK.zero = 0; | 212 | CONSOLE_USERNAME_BLOCK.zero = 0; |
| 212 | 213 | ||
| @@ -219,7 +220,6 @@ void Init() { | |||
| 219 | } | 220 | } |
| 220 | 221 | ||
| 221 | void Shutdown() { | 222 | void Shutdown() { |
| 222 | |||
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | } // namespace CFG | 225 | } // namespace CFG |
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp index 4d6c70f4d..2e759a3e3 100644 --- a/src/core/hle/service/dsp_dsp.cpp +++ b/src/core/hle/service/dsp_dsp.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | namespace DSP_DSP { | 12 | namespace DSP_DSP { |
| 13 | 13 | ||
| 14 | static u32 read_pipe_count = 0; | 14 | static u32 read_pipe_count; |
| 15 | static Kernel::SharedPtr<Kernel::Event> semaphore_event; | 15 | static Kernel::SharedPtr<Kernel::Event> semaphore_event; |
| 16 | static Kernel::SharedPtr<Kernel::Event> interrupt_event; | 16 | static Kernel::SharedPtr<Kernel::Event> interrupt_event; |
| 17 | 17 | ||
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 9ca5d13d4..0f30f743a 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -20,17 +20,17 @@ namespace HID { | |||
| 20 | static const int MAX_CIRCLEPAD_POS = 0x9C; ///< Max value for a circle pad position | 20 | static const int MAX_CIRCLEPAD_POS = 0x9C; ///< Max value for a circle pad position |
| 21 | 21 | ||
| 22 | // Handle to shared memory region designated to HID_User service | 22 | // Handle to shared memory region designated to HID_User service |
| 23 | static Kernel::SharedPtr<Kernel::SharedMemory> shared_mem = nullptr; | 23 | static Kernel::SharedPtr<Kernel::SharedMemory> shared_mem; |
| 24 | 24 | ||
| 25 | // Event handles | 25 | // Event handles |
| 26 | static Kernel::SharedPtr<Kernel::Event> event_pad_or_touch_1 = nullptr; | 26 | static Kernel::SharedPtr<Kernel::Event> event_pad_or_touch_1; |
| 27 | static Kernel::SharedPtr<Kernel::Event> event_pad_or_touch_2 = nullptr; | 27 | static Kernel::SharedPtr<Kernel::Event> event_pad_or_touch_2; |
| 28 | static Kernel::SharedPtr<Kernel::Event> event_accelerometer = nullptr; | 28 | static Kernel::SharedPtr<Kernel::Event> event_accelerometer; |
| 29 | static Kernel::SharedPtr<Kernel::Event> event_gyroscope = nullptr; | 29 | static Kernel::SharedPtr<Kernel::Event> event_gyroscope; |
| 30 | static Kernel::SharedPtr<Kernel::Event> event_debug_pad = nullptr; | 30 | static Kernel::SharedPtr<Kernel::Event> event_debug_pad; |
| 31 | 31 | ||
| 32 | static u32 next_pad_index = 0; | 32 | static u32 next_pad_index; |
| 33 | static u32 next_touch_index = 0; | 33 | static u32 next_touch_index; |
| 34 | 34 | ||
| 35 | // TODO(peachum): | 35 | // TODO(peachum): |
| 36 | // Add a method for setting analog input from joystick device for the circle Pad. | 36 | // Add a method for setting analog input from joystick device for the circle Pad. |
| @@ -175,6 +175,12 @@ void Init() { | |||
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | void Shutdown() { | 177 | void Shutdown() { |
| 178 | shared_mem = nullptr; | ||
| 179 | event_pad_or_touch_1 = nullptr; | ||
| 180 | event_pad_or_touch_2 = nullptr; | ||
| 181 | event_accelerometer = nullptr; | ||
| 182 | event_gyroscope = nullptr; | ||
| 183 | event_debug_pad = nullptr; | ||
| 178 | } | 184 | } |
| 179 | 185 | ||
| 180 | } // namespace HID | 186 | } // namespace HID |
diff --git a/src/core/hle/service/ir/ir.cpp b/src/core/hle/service/ir/ir.cpp index 58dfd8e1a..15ac477ef 100644 --- a/src/core/hle/service/ir/ir.cpp +++ b/src/core/hle/service/ir/ir.cpp | |||
| @@ -15,8 +15,8 @@ | |||
| 15 | namespace Service { | 15 | namespace Service { |
| 16 | namespace IR { | 16 | namespace IR { |
| 17 | 17 | ||
| 18 | static Kernel::SharedPtr<Kernel::Event> handle_event = nullptr; | 18 | static Kernel::SharedPtr<Kernel::Event> handle_event; |
| 19 | static Kernel::SharedPtr<Kernel::SharedMemory> shared_memory = nullptr; | 19 | static Kernel::SharedPtr<Kernel::SharedMemory> shared_memory; |
| 20 | 20 | ||
| 21 | void GetHandles(Service::Interface* self) { | 21 | void GetHandles(Service::Interface* self) { |
| 22 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 22 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| @@ -41,6 +41,8 @@ void Init() { | |||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | void Shutdown() { | 43 | void Shutdown() { |
| 44 | shared_memory = nullptr; | ||
| 45 | handle_event = nullptr; | ||
| 44 | } | 46 | } |
| 45 | 47 | ||
| 46 | } // namespace IR | 48 | } // namespace IR |
diff --git a/src/core/hle/service/nwm_uds.cpp b/src/core/hle/service/nwm_uds.cpp index 1cee81ab2..4b06efc3a 100644 --- a/src/core/hle/service/nwm_uds.cpp +++ b/src/core/hle/service/nwm_uds.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | namespace NWM_UDS { | 12 | namespace NWM_UDS { |
| 13 | 13 | ||
| 14 | static Kernel::SharedPtr<Kernel::Event> handle_event = nullptr; | 14 | static Kernel::SharedPtr<Kernel::Event> handle_event; |
| 15 | 15 | ||
| 16 | /** | 16 | /** |
| 17 | * NWM_UDS::Shutdown service function | 17 | * NWM_UDS::Shutdown service function |
diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp index 57a301bec..d44510c1b 100644 --- a/src/core/hle/service/ptm/ptm.cpp +++ b/src/core/hle/service/ptm/ptm.cpp | |||
| @@ -18,9 +18,9 @@ static const GameCoin default_game_coin = { 0x4F00, 42, 0, 0, 0, 2014, 12, 29 }; | |||
| 18 | /// Id of the SharedExtData archive used by the PTM process | 18 | /// Id of the SharedExtData archive used by the PTM process |
| 19 | static const std::vector<u8> ptm_shared_extdata_id = {0, 0, 0, 0, 0x0B, 0, 0, 0xF0, 0, 0, 0, 0}; | 19 | static const std::vector<u8> ptm_shared_extdata_id = {0, 0, 0, 0, 0x0B, 0, 0, 0xF0, 0, 0, 0, 0}; |
| 20 | 20 | ||
| 21 | static bool shell_open = true; | 21 | static bool shell_open; |
| 22 | 22 | ||
| 23 | static bool battery_is_charging = true; | 23 | static bool battery_is_charging; |
| 24 | 24 | ||
| 25 | u32 GetAdapterState() { | 25 | u32 GetAdapterState() { |
| 26 | // TODO(purpasmart96): This function is only a stub, | 26 | // TODO(purpasmart96): This function is only a stub, |
| @@ -43,6 +43,9 @@ void Init() { | |||
| 43 | AddService(new PTM_Sysm_Interface); | 43 | AddService(new PTM_Sysm_Interface); |
| 44 | AddService(new PTM_U_Interface); | 44 | AddService(new PTM_U_Interface); |
| 45 | 45 | ||
| 46 | shell_open = true; | ||
| 47 | battery_is_charging = true; | ||
| 48 | |||
| 46 | // Open the SharedExtSaveData archive 0xF000000B and create the gamecoin.dat file if it doesn't exist | 49 | // Open the SharedExtSaveData archive 0xF000000B and create the gamecoin.dat file if it doesn't exist |
| 47 | FileSys::Path archive_path(ptm_shared_extdata_id); | 50 | FileSys::Path archive_path(ptm_shared_extdata_id); |
| 48 | auto archive_result = Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path); | 51 | auto archive_result = Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path); |
diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp index 6607965e1..33ecf64a2 100644 --- a/src/core/hle/service/y2r_u.cpp +++ b/src/core/hle/service/y2r_u.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | namespace Y2R_U { | 12 | namespace Y2R_U { |
| 13 | 13 | ||
| 14 | static Kernel::SharedPtr<Kernel::Event> completion_event = 0; | 14 | static Kernel::SharedPtr<Kernel::Event> completion_event; |
| 15 | 15 | ||
| 16 | /** | 16 | /** |
| 17 | * Y2R_U::IsBusyConversion service function | 17 | * Y2R_U::IsBusyConversion service function |
diff --git a/src/core/hle/shared_page.cpp b/src/core/hle/shared_page.cpp index 568dad684..94fae2551 100644 --- a/src/core/hle/shared_page.cpp +++ b/src/core/hle/shared_page.cpp | |||
| @@ -62,6 +62,8 @@ template void Read<u16>(u16 &var, const u32 addr); | |||
| 62 | template void Read<u8>(u8 &var, const u32 addr); | 62 | template void Read<u8>(u8 &var, const u32 addr); |
| 63 | 63 | ||
| 64 | void Set3DSlider(float amount) { | 64 | void Set3DSlider(float amount) { |
| 65 | memset(&shared_page, 0, sizeof(shared_page)); | ||
| 66 | |||
| 65 | shared_page.sliderstate_3d = amount; | 67 | shared_page.sliderstate_3d = amount; |
| 66 | shared_page.ledstate_3d = (amount == 0.0f); // off when non-zero | 68 | shared_page.ledstate_3d = (amount == 0.0f); // off when non-zero |
| 67 | } | 69 | } |
| @@ -71,4 +73,7 @@ void Init() { | |||
| 71 | Set3DSlider(0.0f); | 73 | Set3DSlider(0.0f); |
| 72 | } | 74 | } |
| 73 | 75 | ||
| 76 | void Shutdown() { | ||
| 77 | } | ||
| 78 | |||
| 74 | } // namespace | 79 | } // namespace |
diff --git a/src/core/hle/shared_page.h b/src/core/hle/shared_page.h index 8f93545ec..1b6e4e581 100644 --- a/src/core/hle/shared_page.h +++ b/src/core/hle/shared_page.h | |||
| @@ -23,4 +23,6 @@ void Set3DSlider(float amount); | |||
| 23 | 23 | ||
| 24 | void Init(); | 24 | void Init(); |
| 25 | 25 | ||
| 26 | void Shutdown(); | ||
| 27 | |||
| 26 | } // namespace | 28 | } // namespace |
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp index 308ea2035..0ad7e2963 100644 --- a/src/core/hw/gpu.cpp +++ b/src/core/hw/gpu.cpp | |||
| @@ -29,8 +29,7 @@ namespace GPU { | |||
| 29 | Regs g_regs; | 29 | Regs g_regs; |
| 30 | 30 | ||
| 31 | /// True if the current frame was skipped | 31 | /// True if the current frame was skipped |
| 32 | bool g_skip_frame = false; | 32 | bool g_skip_frame; |
| 33 | |||
| 34 | /// 268MHz / gpu_refresh_rate frames per second | 33 | /// 268MHz / gpu_refresh_rate frames per second |
| 35 | static u64 frame_ticks; | 34 | static u64 frame_ticks; |
| 36 | /// Event id for CoreTiming | 35 | /// Event id for CoreTiming |
| @@ -38,7 +37,7 @@ static int vblank_event; | |||
| 38 | /// Total number of frames drawn | 37 | /// Total number of frames drawn |
| 39 | static u64 frame_count; | 38 | static u64 frame_count; |
| 40 | /// True if the last frame was skipped | 39 | /// True if the last frame was skipped |
| 41 | static bool last_skip_frame = false; | 40 | static bool last_skip_frame; |
| 42 | 41 | ||
| 43 | template <typename T> | 42 | template <typename T> |
| 44 | inline void Read(T &var, const u32 raw_addr) { | 43 | inline void Read(T &var, const u32 raw_addr) { |
| @@ -320,6 +319,8 @@ static void VBlankCallback(u64 userdata, int cycles_late) { | |||
| 320 | 319 | ||
| 321 | /// Initialize hardware | 320 | /// Initialize hardware |
| 322 | void Init() { | 321 | void Init() { |
| 322 | memset(&g_regs, 0, sizeof(g_regs)); | ||
| 323 | |||
| 323 | auto& framebuffer_top = g_regs.framebuffer_config[0]; | 324 | auto& framebuffer_top = g_regs.framebuffer_config[0]; |
| 324 | auto& framebuffer_sub = g_regs.framebuffer_config[1]; | 325 | auto& framebuffer_sub = g_regs.framebuffer_config[1]; |
| 325 | 326 | ||
| @@ -349,6 +350,7 @@ void Init() { | |||
| 349 | frame_ticks = 268123480 / Settings::values.gpu_refresh_rate; | 350 | frame_ticks = 268123480 / Settings::values.gpu_refresh_rate; |
| 350 | last_skip_frame = false; | 351 | last_skip_frame = false; |
| 351 | g_skip_frame = false; | 352 | g_skip_frame = false; |
| 353 | frame_count = 0; | ||
| 352 | 354 | ||
| 353 | vblank_event = CoreTiming::RegisterEvent("GPU::VBlankCallback", VBlankCallback); | 355 | vblank_event = CoreTiming::RegisterEvent("GPU::VBlankCallback", VBlankCallback); |
| 354 | CoreTiming::ScheduleEvent(frame_ticks, vblank_event); | 356 | CoreTiming::ScheduleEvent(frame_ticks, vblank_event); |
diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp index bed50af50..236958139 100644 --- a/src/core/hw/hw.cpp +++ b/src/core/hw/hw.cpp | |||
| @@ -63,6 +63,8 @@ void Init() { | |||
| 63 | 63 | ||
| 64 | /// Shutdown hardware | 64 | /// Shutdown hardware |
| 65 | void Shutdown() { | 65 | void Shutdown() { |
| 66 | GPU::Shutdown(); | ||
| 67 | LCD::Shutdown(); | ||
| 66 | LOG_DEBUG(HW, "shutdown OK"); | 68 | LOG_DEBUG(HW, "shutdown OK"); |
| 67 | } | 69 | } |
| 68 | 70 | ||
diff --git a/src/core/hw/lcd.cpp b/src/core/hw/lcd.cpp index 7986f3ddb..8a09c3bc0 100644 --- a/src/core/hw/lcd.cpp +++ b/src/core/hw/lcd.cpp | |||
| @@ -55,6 +55,7 @@ template void Write<u8>(u32 addr, const u8 data); | |||
| 55 | 55 | ||
| 56 | /// Initialize hardware | 56 | /// Initialize hardware |
| 57 | void Init() { | 57 | void Init() { |
| 58 | memset(&g_regs, 0, sizeof(g_regs)); | ||
| 58 | LOG_DEBUG(HW_LCD, "initialized OK"); | 59 | LOG_DEBUG(HW_LCD, "initialized OK"); |
| 59 | } | 60 | } |
| 60 | 61 | ||
diff --git a/src/core/mem_map.cpp b/src/core/mem_map.cpp index a14e8303e..22e359b3e 100644 --- a/src/core/mem_map.cpp +++ b/src/core/mem_map.cpp | |||
| @@ -11,30 +11,30 @@ | |||
| 11 | 11 | ||
| 12 | namespace Memory { | 12 | namespace Memory { |
| 13 | 13 | ||
| 14 | u8* g_base = nullptr; ///< The base pointer to the auto-mirrored arena. | 14 | u8* g_base; ///< The base pointer to the auto-mirrored arena. |
| 15 | 15 | ||
| 16 | static MemArena arena; ///< The MemArena class | 16 | static MemArena arena; ///< The MemArena class |
| 17 | 17 | ||
| 18 | u8* g_exefs_code = nullptr; ///< ExeFS:/.code is loaded here | 18 | u8* g_exefs_code; ///< ExeFS:/.code is loaded here |
| 19 | u8* g_system_mem = nullptr; ///< System memory | 19 | u8* g_system_mem; ///< System memory |
| 20 | u8* g_heap = nullptr; ///< Application heap (main memory) | 20 | u8* g_heap; ///< Application heap (main memory) |
| 21 | u8* g_heap_linear = nullptr; ///< Linear heap | 21 | u8* g_heap_linear; ///< Linear heap |
| 22 | u8* g_vram = nullptr; ///< Video memory (VRAM) pointer | 22 | u8* g_vram; ///< Video memory (VRAM) pointer |
| 23 | u8* g_shared_mem = nullptr; ///< Shared memory | 23 | u8* g_shared_mem; ///< Shared memory |
| 24 | u8* g_dsp_mem = nullptr; ///< DSP memory | 24 | u8* g_dsp_mem; ///< DSP memory |
| 25 | u8* g_kernel_mem; ///< Kernel memory | 25 | u8* g_kernel_mem; ///< Kernel memory |
| 26 | 26 | ||
| 27 | static u8* physical_bootrom = nullptr; ///< Bootrom physical memory | 27 | static u8* physical_bootrom; ///< Bootrom physical memory |
| 28 | static u8* uncached_bootrom = nullptr; | 28 | static u8* uncached_bootrom; |
| 29 | 29 | ||
| 30 | static u8* physical_exefs_code = nullptr; ///< Phsical ExeFS:/.code is loaded here | 30 | static u8* physical_exefs_code; ///< Phsical ExeFS:/.code is loaded here |
| 31 | static u8* physical_system_mem = nullptr; ///< System physical memory | 31 | static u8* physical_system_mem; ///< System physical memory |
| 32 | static u8* physical_fcram = nullptr; ///< Main physical memory (FCRAM) | 32 | static u8* physical_fcram; ///< Main physical memory (FCRAM) |
| 33 | static u8* physical_heap_gsp = nullptr; ///< GSP heap physical memory | 33 | static u8* physical_heap_gsp; ///< GSP heap physical memory |
| 34 | static u8* physical_vram = nullptr; ///< Video physical memory (VRAM) | 34 | static u8* physical_vram; ///< Video physical memory (VRAM) |
| 35 | static u8* physical_shared_mem = nullptr; ///< Physical shared memory | 35 | static u8* physical_shared_mem; ///< Physical shared memory |
| 36 | static u8* physical_dsp_mem = nullptr; ///< Physical DSP memory | 36 | static u8* physical_dsp_mem; ///< Physical DSP memory |
| 37 | static u8* physical_kernel_mem; ///< Kernel memory | 37 | static u8* physical_kernel_mem; ///< Kernel memory |
| 38 | 38 | ||
| 39 | // We don't declare the IO region in here since its handled by other means. | 39 | // We don't declare the IO region in here since its handled by other means. |
| 40 | static MemoryView g_views[] = { | 40 | static MemoryView g_views[] = { |
| @@ -73,6 +73,7 @@ void Init() { | |||
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | g_base = MemoryMap_Setup(g_views, kNumMemViews, flags, &arena); | 75 | g_base = MemoryMap_Setup(g_views, kNumMemViews, flags, &arena); |
| 76 | MemBlock_Init(); | ||
| 76 | 77 | ||
| 77 | LOG_DEBUG(HW_Memory, "initialized OK, RAM at %p (mirror at 0 @ %p)", g_heap, | 78 | LOG_DEBUG(HW_Memory, "initialized OK, RAM at %p (mirror at 0 @ %p)", g_heap, |
| 78 | physical_fcram); | 79 | physical_fcram); |
| @@ -81,9 +82,29 @@ void Init() { | |||
| 81 | void Shutdown() { | 82 | void Shutdown() { |
| 82 | u32 flags = 0; | 83 | u32 flags = 0; |
| 83 | MemoryMap_Shutdown(g_views, kNumMemViews, flags, &arena); | 84 | MemoryMap_Shutdown(g_views, kNumMemViews, flags, &arena); |
| 84 | |||
| 85 | arena.ReleaseSpace(); | 85 | arena.ReleaseSpace(); |
| 86 | MemBlock_Shutdown(); | ||
| 87 | |||
| 86 | g_base = nullptr; | 88 | g_base = nullptr; |
| 89 | g_exefs_code = nullptr; | ||
| 90 | g_system_mem = nullptr; | ||
| 91 | g_heap = nullptr; | ||
| 92 | g_heap_linear = nullptr; | ||
| 93 | g_vram = nullptr; | ||
| 94 | g_shared_mem = nullptr; | ||
| 95 | g_dsp_mem = nullptr; | ||
| 96 | g_kernel_mem = nullptr; | ||
| 97 | |||
| 98 | physical_bootrom = nullptr; | ||
| 99 | uncached_bootrom = nullptr; | ||
| 100 | physical_exefs_code = nullptr; | ||
| 101 | physical_system_mem = nullptr; | ||
| 102 | physical_fcram = nullptr; | ||
| 103 | physical_heap_gsp = nullptr; | ||
| 104 | physical_vram = nullptr; | ||
| 105 | physical_shared_mem = nullptr; | ||
| 106 | physical_dsp_mem = nullptr; | ||
| 107 | physical_kernel_mem = nullptr; | ||
| 87 | 108 | ||
| 88 | LOG_DEBUG(HW_Memory, "shutdown OK"); | 109 | LOG_DEBUG(HW_Memory, "shutdown OK"); |
| 89 | } | 110 | } |
diff --git a/src/core/mem_map.h b/src/core/mem_map.h index ff730593e..1af02973b 100644 --- a/src/core/mem_map.h +++ b/src/core/mem_map.h | |||
| @@ -171,6 +171,12 @@ u32 MapBlock_Heap(u32 size, u32 operation, u32 permissions); | |||
| 171 | */ | 171 | */ |
| 172 | u32 MapBlock_HeapLinear(u32 size, u32 operation, u32 permissions); | 172 | u32 MapBlock_HeapLinear(u32 size, u32 operation, u32 permissions); |
| 173 | 173 | ||
| 174 | /// Initialize mapped memory blocks | ||
| 175 | void MemBlock_Init(); | ||
| 176 | |||
| 177 | /// Shutdown mapped memory blocks | ||
| 178 | void MemBlock_Shutdown(); | ||
| 179 | |||
| 174 | inline const char* GetCharPointer(const VAddr address) { | 180 | inline const char* GetCharPointer(const VAddr address) { |
| 175 | return (const char *)GetPointer(address); | 181 | return (const char *)GetPointer(address); |
| 176 | } | 182 | } |
diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp index 5878b99dc..8759ebdfb 100644 --- a/src/core/mem_map_funcs.cpp +++ b/src/core/mem_map_funcs.cpp | |||
| @@ -15,7 +15,6 @@ namespace Memory { | |||
| 15 | 15 | ||
| 16 | static std::map<u32, MemoryBlock> heap_map; | 16 | static std::map<u32, MemoryBlock> heap_map; |
| 17 | static std::map<u32, MemoryBlock> heap_linear_map; | 17 | static std::map<u32, MemoryBlock> heap_linear_map; |
| 18 | static std::map<u32, MemoryBlock> shared_map; | ||
| 19 | 18 | ||
| 20 | /// Convert a physical address to virtual address | 19 | /// Convert a physical address to virtual address |
| 21 | VAddr PhysicalToVirtualAddress(const PAddr addr) { | 20 | VAddr PhysicalToVirtualAddress(const PAddr addr) { |
| @@ -185,12 +184,6 @@ u8 *GetPointer(const VAddr vaddr) { | |||
| 185 | } | 184 | } |
| 186 | } | 185 | } |
| 187 | 186 | ||
| 188 | /** | ||
| 189 | * Maps a block of memory on the heap | ||
| 190 | * @param size Size of block in bytes | ||
| 191 | * @param operation Memory map operation type | ||
| 192 | * @param flags Memory allocation flags | ||
| 193 | */ | ||
| 194 | u32 MapBlock_Heap(u32 size, u32 operation, u32 permissions) { | 187 | u32 MapBlock_Heap(u32 size, u32 operation, u32 permissions) { |
| 195 | MemoryBlock block; | 188 | MemoryBlock block; |
| 196 | 189 | ||
| @@ -208,12 +201,6 @@ u32 MapBlock_Heap(u32 size, u32 operation, u32 permissions) { | |||
| 208 | return block.GetVirtualAddress(); | 201 | return block.GetVirtualAddress(); |
| 209 | } | 202 | } |
| 210 | 203 | ||
| 211 | /** | ||
| 212 | * Maps a block of memory on the linear heap | ||
| 213 | * @param size Size of block in bytes | ||
| 214 | * @param operation Memory map operation type | ||
| 215 | * @param flags Memory allocation flags | ||
| 216 | */ | ||
| 217 | u32 MapBlock_HeapLinear(u32 size, u32 operation, u32 permissions) { | 204 | u32 MapBlock_HeapLinear(u32 size, u32 operation, u32 permissions) { |
| 218 | MemoryBlock block; | 205 | MemoryBlock block; |
| 219 | 206 | ||
| @@ -231,6 +218,14 @@ u32 MapBlock_HeapLinear(u32 size, u32 operation, u32 permissions) { | |||
| 231 | return block.GetVirtualAddress(); | 218 | return block.GetVirtualAddress(); |
| 232 | } | 219 | } |
| 233 | 220 | ||
| 221 | void MemBlock_Init() { | ||
| 222 | } | ||
| 223 | |||
| 224 | void MemBlock_Shutdown() { | ||
| 225 | heap_map.clear(); | ||
| 226 | heap_linear_map.clear(); | ||
| 227 | } | ||
| 228 | |||
| 234 | u8 Read8(const VAddr addr) { | 229 | u8 Read8(const VAddr addr) { |
| 235 | u8 data = 0; | 230 | u8 data = 0; |
| 236 | Read<u8>(data, addr); | 231 | Read<u8>(data, addr); |