From 2421ba6c968d5f0ab6269630e8ab1b10e55db51d Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Thu, 16 Apr 2020 10:09:53 -0700 Subject: [PATCH] pgl: fix minor bugs in impl --- .../source/diag/diag_assertion_impl.cpp | 2 +- .../source/fssystem/fssystem_pooled_buffer.cpp | 2 +- .../libstratosphere/source/pgl/srv/pgl_srv_shell.cpp | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libraries/libstratosphere/source/diag/diag_assertion_impl.cpp b/libraries/libstratosphere/source/diag/diag_assertion_impl.cpp index ca66e9a1a..905d479a3 100644 --- a/libraries/libstratosphere/source/diag/diag_assertion_impl.cpp +++ b/libraries/libstratosphere/source/diag/diag_assertion_impl.cpp @@ -44,7 +44,7 @@ namespace ams::diag { inline void DebugLog(const char *format, ...) __attribute__((format(printf, 1, 2))); #ifdef AMS_ENABLE_DEBUG_PRINT - os::Mutex g_debug_log_lock; + os::Mutex g_debug_log_lock(true); char g_debug_buffer[0x400]; void DebugLogImpl(const char *format, ::std::va_list vl) { diff --git a/libraries/libstratosphere/source/fssystem/fssystem_pooled_buffer.cpp b/libraries/libstratosphere/source/fssystem/fssystem_pooled_buffer.cpp index 315d24e56..df32ec50a 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_pooled_buffer.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_pooled_buffer.cpp @@ -169,7 +169,7 @@ namespace ams::fssystem { if (this->size > ideal_size) { /* If we do, we need to have a buffer allocated from the heap. */ AMS_ASSERT(this->buffer != nullptr); - AMS_ASSERT(g_heap.GetBlockSize(), HeapBlockSize); + AMS_ASSERT(g_heap.GetBlockSize() == HeapBlockSize); const size_t new_size = util::AlignUp(ideal_size, HeapBlockSize); diff --git a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell.cpp b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell.cpp index 37537bd4b..9529f26e0 100644 --- a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell.cpp +++ b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell.cpp @@ -42,7 +42,7 @@ namespace ams::pgl::srv { bool g_enable_crash_report_screenshot = true; bool g_enable_jit_debug = false; - constexpr inline size_t ProcessControlTaskStackSize = 4_KB; + constexpr inline size_t ProcessControlTaskStackSize = 8_KB; constexpr inline s32 ProcessControlTaskPriority = 21; os::ThreadType g_process_control_task_thread; alignas(os::ThreadStackAlignment) u8 g_process_control_task_stack[ProcessControlTaskStackSize]; @@ -290,7 +290,7 @@ namespace ams::pgl::srv { while (true) { /* Wait for an event to come in, and clear our signal. */ process_event.Wait(); - process_event.Signal(); + process_event.Clear(); bool continue_getting_event = true; while (continue_getting_event) { @@ -329,6 +329,13 @@ namespace ams::pgl::srv { settings::fwdbg::GetSettingsItemValue(std::addressof(g_enable_crash_report_screenshot), sizeof(g_enable_crash_report_screenshot), "creport", "crash_screen_shot"); g_is_production = !settings::fwdbg::IsDebugModeEnabled(); + /* Clear all process data. */ + { + for (size_t i = 0; i < util::size(g_process_data); i++) { + g_process_data[i].process_id = os::InvalidProcessId; + } + } + /* Start the thread. */ os::StartThread(std::addressof(g_process_control_task_thread)); }