Created
January 6, 2015 15:24
-
-
Save Subv/3bf5329a97a370ec93ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/externals/boost b/externals/boost | |
--- a/externals/boost | |
+++ b/externals/boost | |
@@ -1 +1 @@ | |
-Subproject commit 97052c28acb141dbf3c5e14114af99045344b695 | |
+Subproject commit 97052c28acb141dbf3c5e14114af99045344b695-dirty | |
diff --git a/externals/nihstro b/externals/nihstro | |
index fc71f86..0a8b4d2 160000 | |
--- a/externals/nihstro | |
+++ b/externals/nihstro | |
@@ -1 +1 @@ | |
-Subproject commit fc71f8684d26ccf277ad68809c8bd7273141fe89 | |
+Subproject commit 0a8b4d221425f13e24a3cef9b02edc3221bab211 | |
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp | |
index 084fd03..27cd10a 100644 | |
--- a/src/core/hle/kernel/kernel.cpp | |
+++ b/src/core/hle/kernel/kernel.cpp | |
@@ -14,6 +14,7 @@ | |
namespace Kernel { | |
Handle g_main_thread = 0; | |
+Handle g_idle_thread = 0; | |
HandleTable g_handle_table; | |
u64 g_program_id = 0; | |
@@ -127,6 +128,8 @@ bool LoadExec(u32 entry_point) { | |
// 0x30 is the typical main thread priority I've seen used so far | |
g_main_thread = Kernel::SetupMainThread(0x30); | |
+ g_idle_thread = Kernel::SetupIdleThread(); | |
+ | |
return true; | |
} | |
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h | |
index 3e381d7..72cdfa1 100644 | |
--- a/src/core/hle/kernel/kernel.h | |
+++ b/src/core/hle/kernel/kernel.h | |
@@ -191,6 +191,7 @@ private: | |
extern HandleTable g_handle_table; | |
extern Handle g_main_thread; | |
+extern Handle g_idle_thread; | |
/// The ID code of the currently running game | |
/// TODO(Subv): This variable should not be here, | |
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp | |
index 872df2d..953c903 100644 | |
--- a/src/core/hle/kernel/thread.cpp | |
+++ b/src/core/hle/kernel/thread.cpp | |
@@ -468,13 +468,32 @@ Handle SetupMainThread(s32 priority, int stack_size) { | |
return handle; | |
} | |
+static u32 IDLE_THREAD_CODE_ADDR = 0; | |
+Handle SetupIdleThread() { | |
+ | |
+ // Write some dummy code to the addr | |
+ Memory::Write32(IDLE_THREAD_CODE_ADDR, 0xEF00007E); | |
+ Memory::Write32(IDLE_THREAD_CODE_ADDR + 4, 0xEAFFFFFD); | |
+ | |
+ Handle handle; | |
+ | |
+ // Initialize new "idle" thread | |
+ Thread* thread = CreateThread(handle, "idle", IDLE_THREAD_CODE_ADDR, THREADPRIO_LOWEST, | |
+ THREADPROCESSORID_0, Memory::SCRATCHPAD_VADDR_END, 0x40); | |
+ | |
+ ResetThread(thread, 0, 0); | |
+ CallThread(thread); | |
+ | |
+ return handle; | |
+} | |
/// Reschedules to the next available thread (call after current thread is suspended) | |
void Reschedule() { | |
Thread* prev = GetCurrentThread(); | |
Thread* next = NextThread(); | |
HLE::g_reschedule = false; | |
- | |
+ //if (!next || next->GetHandle() == Kernel::g_idle_thread) | |
+ //__debugbreak(); | |
if (next != nullptr) { | |
LOG_TRACE(Kernel, "context switch 0x%08X -> 0x%08X", prev->GetHandle(), next->GetHandle()); | |
SwitchContext(next); | |
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h | |
index 81736a8..e6e676e 100644 | |
--- a/src/core/hle/kernel/thread.h | |
+++ b/src/core/hle/kernel/thread.h | |
@@ -55,6 +55,8 @@ Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s3 | |
/// Sets up the primary application thread | |
Handle SetupMainThread(s32 priority, int stack_size=Kernel::DEFAULT_STACK_SIZE); | |
+Handle SetupIdleThread(); | |
+ | |
/// Reschedules to the next available thread (call after current thread is suspended) | |
void Reschedule(); | |
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp | |
index 0127d4e..91d9203 100644 | |
--- a/src/core/hle/service/gsp_gpu.cpp | |
+++ b/src/core/hle/service/gsp_gpu.cpp | |
@@ -201,11 +201,11 @@ static void RegisterInterruptRelayQueue(Service::Interface* self) { | |
*/ | |
void SignalInterrupt(InterruptId interrupt_id) { | |
if (0 == g_interrupt_event) { | |
- LOG_WARNING(Service_GSP, "cannot synchronize until GSP event has been created!"); | |
+ //LOG_WARNING(Service_GSP, "cannot synchronize until GSP event has been created!"); | |
return; | |
} | |
if (0 == g_shared_memory) { | |
- LOG_WARNING(Service_GSP, "cannot synchronize until GSP shared memory has been created!"); | |
+ //LOG_WARNING(Service_GSP, "cannot synchronize until GSP shared memory has been created!"); | |
return; | |
} | |
for (int thread_id = 0; thread_id < 0x4; ++thread_id) { | |
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp | |
index cf57a78..5e8655c 100644 | |
--- a/src/core/hle/svc.cpp | |
+++ b/src/core/hle/svc.cpp | |
@@ -425,6 +425,12 @@ static Result CreateMemoryBlock(Handle* memblock, u32 addr, u32 size, u32 my_per | |
return 0; | |
} | |
+static void Test() { | |
+ //LOG_CRITICAL(Kernel_SVC, "TEST CALLED"); | |
+ Core::g_app_core->AddTicks(4000); | |
+ HLE::Reschedule(__func__); | |
+} | |
+ | |
const HLE::FunctionDef SVC_Table[] = { | |
{0x00, nullptr, "Unknown"}, | |
{0x01, HLE::Wrap<ControlMemory>, "ControlMemory"}, | |
@@ -552,6 +558,7 @@ const HLE::FunctionDef SVC_Table[] = { | |
{0x7B, nullptr, "Unknown"}, | |
{0x7C, nullptr, "KernelSetState"}, | |
{0x7D, nullptr, "QueryProcessMemory"}, | |
+ { 0x7E, Test, "Test" }, | |
}; | |
void Register() { | |
diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp | |
index f55f7e7..3d60872 100644 | |
--- a/src/core/mem_map_funcs.cpp | |
+++ b/src/core/mem_map_funcs.cpp | |
@@ -16,6 +16,8 @@ static std::map<u32, MemoryBlock> heap_map; | |
static std::map<u32, MemoryBlock> heap_linear_map; | |
static std::map<u32, MemoryBlock> shared_map; | |
+u8* other_mem = new u8[1000]; | |
+ | |
/// Convert a physical address to virtual address | |
VAddr PhysicalToVirtualAddress(const PAddr addr) { | |
// Our memory interface read/write functions assume virtual addresses. Put any physical address | |
@@ -91,7 +93,11 @@ inline void Read(T &var, const VAddr vaddr) { | |
var = *((const T*)&g_vram[vaddr - VRAM_VADDR]); | |
} else { | |
- LOG_ERROR(HW_Memory, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, vaddr); | |
+ if (vaddr == 0) | |
+ var = *((const T*)&other_mem[vaddr]); | |
+ else if (vaddr == 4) | |
+ var = *((const T*)&other_mem[vaddr]); | |
+ //LOG_ERROR(HW_Memory, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, vaddr); | |
} | |
} | |
@@ -137,7 +143,11 @@ inline void Write(const VAddr vaddr, const T data) { | |
// Error out... | |
} else { | |
- LOG_ERROR(HW_Memory, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, vaddr); | |
+ if (vaddr == 0) | |
+ *(T*)&other_mem[vaddr] = data; | |
+ else if (vaddr == 4) | |
+ *(T*)&other_mem[vaddr] = data; | |
+ //LOG_ERROR(HW_Memory, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, vaddr); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment