Просмотр исходного кода

hle: added a hokey way to force a thread reschedule during CPU single step mode (as used by the debugger)

bunnei 12 лет назад
Родитель
Сommit
174cc9a0ed
3 измененных файлов с 7 добавлено и 1 удалено
  1. 2 1
      src/core/core.cpp
  2. 3 0
      src/core/hle/hle.cpp
  3. 2 0
      src/core/hle/hle.h

+ 2 - 1
src/core/core.cpp

@@ -13,6 +13,7 @@
 #include "core/arm/disassembler/arm_disasm.h"
 #include "core/arm/disassembler/arm_disasm.h"
 #include "core/arm/interpreter/arm_interpreter.h"
 #include "core/arm/interpreter/arm_interpreter.h"
 
 
+#include "core/hle/hle.h"
 #include "core/hle/kernel/thread.h"
 #include "core/hle/kernel/thread.h"
 
 
 namespace Core {
 namespace Core {
@@ -36,7 +37,7 @@ void SingleStep() {
 
 
     g_app_core->Step();
     g_app_core->Step();
     
     
-    if (ticks >= LCD::kFrameTicks / 2) {
+    if ((ticks >= LCD::kFrameTicks / 2) || HLE::g_reschedule) {
         HW::Update();
         HW::Update();
         Kernel::Reschedule();
         Kernel::Reschedule();
         ticks = 0;
         ticks = 0;

+ 3 - 0
src/core/hle/hle.cpp

@@ -16,6 +16,8 @@ namespace HLE {
 
 
 static std::vector<ModuleDef> g_module_db;
 static std::vector<ModuleDef> g_module_db;
 
 
+bool g_reschedule = false;  ///< If true, immediately reschedules the CPU to a new thread
+
 const FunctionDef* GetSVCInfo(u32 opcode) {
 const FunctionDef* GetSVCInfo(u32 opcode) {
     u32 func_num = opcode & 0xFFFFFF; // 8 bits
     u32 func_num = opcode & 0xFFFFFF; // 8 bits
     if (func_num > 0xFF) {
     if (func_num > 0xFF) {
@@ -47,6 +49,7 @@ void Reschedule(const char *reason) {
     _dbg_assert_msg_(HLE, reason != 0 && strlen(reason) < 256, "Reschedule: Invalid or too long reason.");
     _dbg_assert_msg_(HLE, reason != 0 && strlen(reason) < 256, "Reschedule: Invalid or too long reason.");
 #endif
 #endif
     Core::g_app_core->PrepareReschedule();
     Core::g_app_core->PrepareReschedule();
+    g_reschedule = true;
 }
 }
 
 
 void RegisterModule(std::string name, int num_functions, const FunctionDef* func_table) {
 void RegisterModule(std::string name, int num_functions, const FunctionDef* func_table) {

+ 2 - 0
src/core/hle/hle.h

@@ -16,6 +16,8 @@
 
 
 namespace HLE {
 namespace HLE {
 
 
+extern bool g_reschedule;   ///< If true, immediately reschedules the CPU to a new thread
+
 typedef u32 Addr;
 typedef u32 Addr;
 typedef void (*Func)();
 typedef void (*Func)();