Răsfoiți Sursa

Kernel/Thread: Added a helper function to get a thread's command buffer VAddr.

Subv 8 ani în urmă
părinte
comite
8217ed7acb
2 a modificat fișierele cu 12 adăugiri și 0 ștergeri
  1. 6 0
      src/core/hle/kernel/thread.cpp
  2. 6 0
      src/core/hle/kernel/thread.h

+ 6 - 0
src/core/hle/kernel/thread.cpp

@@ -534,6 +534,12 @@ s32 Thread::GetWaitObjectIndex(WaitObject* object) const {
     return static_cast<s32>(std::distance(match, wait_objects.rend()) - 1);
     return static_cast<s32>(std::distance(match, wait_objects.rend()) - 1);
 }
 }
 
 
+VAddr Thread::GetCommandBufferAddress() const {
+    // Offset from the start of TLS at which the IPC command buffer begins.
+    static constexpr int CommandHeaderOffset = 0x80;
+    return GetTLSAddress() + CommandHeaderOffset;
+}
+
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
 
 void ThreadingInit() {
 void ThreadingInit() {

+ 6 - 0
src/core/hle/kernel/thread.h

@@ -159,6 +159,12 @@ public:
         return tls_address;
         return tls_address;
     }
     }
 
 
+    /*
+     * Returns the address of the current thread's command buffer, located in the TLS.
+     * @returns VAddr of the thread's command buffer.
+     */
+    VAddr GetCommandBufferAddress() const;
+
     /**
     /**
      * Returns whether this thread is waiting for all the objects in
      * Returns whether this thread is waiting for all the objects in
      * its wait list to become ready, as a result of a WaitSynchronizationN call
      * its wait list to become ready, as a result of a WaitSynchronizationN call