Przeglądaj źródła

KernelSVC: Assert that condition variable address is aligned to 4 bytes.

Fernando Sahmkow 6 lat temu
rodzic
commit
0b72b34d89
1 zmienionych plików z 4 dodań i 0 usunięć
  1. 4 0
      src/core/hle/kernel/svc.cpp

+ 4 - 0
src/core/hle/kernel/svc.cpp

@@ -1608,6 +1608,8 @@ static ResultCode WaitProcessWideKeyAtomic(Core::System& system, VAddr mutex_add
         return ERR_INVALID_ADDRESS;
         return ERR_INVALID_ADDRESS;
     }
     }
 
 
+    ASSERT(condition_variable_addr == Common::AlignDown(condition_variable_addr, 4));
+
     auto* const current_process = system.Kernel().CurrentProcess();
     auto* const current_process = system.Kernel().CurrentProcess();
     const auto& handle_table = current_process->GetHandleTable();
     const auto& handle_table = current_process->GetHandleTable();
     SharedPtr<Thread> thread = handle_table.Get<Thread>(thread_handle);
     SharedPtr<Thread> thread = handle_table.Get<Thread>(thread_handle);
@@ -1639,6 +1641,8 @@ static ResultCode SignalProcessWideKey(Core::System& system, VAddr condition_var
     LOG_TRACE(Kernel_SVC, "called, condition_variable_addr=0x{:X}, target=0x{:08X}",
     LOG_TRACE(Kernel_SVC, "called, condition_variable_addr=0x{:X}, target=0x{:08X}",
               condition_variable_addr, target);
               condition_variable_addr, target);
 
 
+    ASSERT(condition_variable_addr == Common::AlignDown(condition_variable_addr, 4));
+
     // Retrieve a list of all threads that are waiting for this condition variable.
     // Retrieve a list of all threads that are waiting for this condition variable.
     std::vector<SharedPtr<Thread>> waiting_threads;
     std::vector<SharedPtr<Thread>> waiting_threads;
     const auto& scheduler = system.GlobalScheduler();
     const auto& scheduler = system.GlobalScheduler();