From 41324d59a830abbac7f94b3f4b8be0943565cef8 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Tue, 2 May 2023 15:51:38 -0700 Subject: [PATCH 1/8] trying to use inline reloc for win-arm64 tls --- src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h b/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h index de4aef3d267773..70fc95388fd957 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h +++ b/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h @@ -206,9 +206,7 @@ CodeLbl SETS "$Name":CC:"Lbl" __tls_array equ 0x58 ;; offsetof(TEB, ThreadLocalStoragePointer) EXTERN _tls_index - - GBLS __SECTIONREL_tls_CurrentThread -__SECTIONREL_tls_CurrentThread SETS "SECTIONREL_tls_CurrentThread" + EXTERN tls_CurrentThread MACRO INLINE_GETTHREAD $destReg, $trashReg @@ -223,7 +221,8 @@ TrashRegister32Bit SETS "w":CC:("$TrashRegister32Bit":RIGHT:((:LEN:TrashRegister ldr $TrashRegister32Bit, [$trashReg] ldr $destReg, [xpr, #__tls_array] ldr $destReg, [$destReg, $trashReg lsl #3] - ldr $trashReg, =$__SECTIONREL_tls_CurrentThread + ldr $trashReg, =tls_CurrentThread + RELOC 8, tls_CurrentThread ;; IMAGE_REL_ARM64_SECREL ldr $trashReg, [$trashReg] add $destReg, $destReg, $trashReg MEND @@ -233,15 +232,6 @@ TrashRegister32Bit SETS "w":CC:("$TrashRegister32Bit":RIGHT:((:LEN:TrashRegister ;; to improve density, or to reduce distance between the constant pool and its use. MACRO INLINE_GETTHREAD_CONSTANT_POOL - EXTERN tls_CurrentThread - - ;; Section relocs are 32 bits. Using an extra DCD initialized to zero for 8-byte alignment. -$__SECTIONREL_tls_CurrentThread - DCD tls_CurrentThread - RELOC 8, tls_CurrentThread ;; SECREL - DCD 0 - -__SECTIONREL_tls_CurrentThread SETS "$__SECTIONREL_tls_CurrentThread":CC:"_" MEND From 1ab6de0e9c24f5caed5861343c42036fbfbe3be0 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Tue, 2 May 2023 16:58:37 -0700 Subject: [PATCH 2/8] no indirection --- src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h b/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h index 70fc95388fd957..25815639cdb671 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h +++ b/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h @@ -223,7 +223,6 @@ TrashRegister32Bit SETS "w":CC:("$TrashRegister32Bit":RIGHT:((:LEN:TrashRegister ldr $destReg, [$destReg, $trashReg lsl #3] ldr $trashReg, =tls_CurrentThread RELOC 8, tls_CurrentThread ;; IMAGE_REL_ARM64_SECREL - ldr $trashReg, [$trashReg] add $destReg, $destReg, $trashReg MEND From ef1f4f5445e6d5db42991a20a9807cefde5422b9 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Tue, 2 May 2023 19:41:25 -0700 Subject: [PATCH 3/8] try another thing --- src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h b/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h index 25815639cdb671..9e43107c889041 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h +++ b/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h @@ -217,13 +217,14 @@ __tls_array equ 0x58 ;; offsetof(TEB, ThreadLocalStoragePointer) TrashRegister32Bit SETS "$trashReg" TrashRegister32Bit SETS "w":CC:("$TrashRegister32Bit":RIGHT:((:LEN:TrashRegister32Bit) - 1)) - ldr $trashReg, =_tls_index - ldr $TrashRegister32Bit, [$trashReg] + adrp $trashReg, _tls_index + ldr $TrashRegister32Bit, [$trashReg, _tls_index] ldr $destReg, [xpr, #__tls_array] - ldr $destReg, [$destReg, $trashReg lsl #3] - ldr $trashReg, =tls_CurrentThread - RELOC 8, tls_CurrentThread ;; IMAGE_REL_ARM64_SECREL - add $destReg, $destReg, $trashReg + ldr $destReg, [$destReg, $trashReg uxtw #3] + add $destReg, $destReg, tls_CurrentThread + RELOC 9, tls_CurrentThread ;; IMAGE_REL_ARM64_SECREL_LOW12A + add $destReg, $destReg, tls_CurrentThread + RELOC 0xA, tls_CurrentThread ;; IMAGE_REL_ARM64_SECREL_HIGH12A MEND ;; INLINE_GETTHREAD_CONSTANT_POOL macro has to be used after the last function in the .asm file that used From b3d0cfe61fdecdecc2a640df68d0b44fcf524321 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Tue, 2 May 2023 21:49:38 -0700 Subject: [PATCH 4/8] is this what msvc does? --- src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h b/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h index 9e43107c889041..045701485757b8 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h +++ b/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h @@ -217,14 +217,14 @@ __tls_array equ 0x58 ;; offsetof(TEB, ThreadLocalStoragePointer) TrashRegister32Bit SETS "$trashReg" TrashRegister32Bit SETS "w":CC:("$TrashRegister32Bit":RIGHT:((:LEN:TrashRegister32Bit) - 1)) - adrp $trashReg, _tls_index - ldr $TrashRegister32Bit, [$trashReg, _tls_index] + adrp $destReg, _tls_index + ldr $TrashRegister32Bit, [$destReg, _tls_index] ldr $destReg, [xpr, #__tls_array] - ldr $destReg, [$destReg, $trashReg uxtw #3] - add $destReg, $destReg, tls_CurrentThread - RELOC 9, tls_CurrentThread ;; IMAGE_REL_ARM64_SECREL_LOW12A + ldr $destReg, [$destReg, $TrashRegister32Bit uxtw #3] add $destReg, $destReg, tls_CurrentThread RELOC 0xA, tls_CurrentThread ;; IMAGE_REL_ARM64_SECREL_HIGH12A + add $destReg, $destReg, tls_CurrentThread + RELOC 0x9, tls_CurrentThread ;; IMAGE_REL_ARM64_SECREL_LOW12A MEND ;; INLINE_GETTHREAD_CONSTANT_POOL macro has to be used after the last function in the .asm file that used From adddb20d484931de100ae6eddb7c5aa5683e4269 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Wed, 3 May 2023 10:58:16 -0700 Subject: [PATCH 5/8] slightly tweak the format --- src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h b/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h index 045701485757b8..1020b6849c54e5 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h +++ b/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h @@ -221,9 +221,9 @@ TrashRegister32Bit SETS "w":CC:("$TrashRegister32Bit":RIGHT:((:LEN:TrashRegister ldr $TrashRegister32Bit, [$destReg, _tls_index] ldr $destReg, [xpr, #__tls_array] ldr $destReg, [$destReg, $TrashRegister32Bit uxtw #3] - add $destReg, $destReg, tls_CurrentThread + add $destReg, $destReg, #0, lsl #0xC RELOC 0xA, tls_CurrentThread ;; IMAGE_REL_ARM64_SECREL_HIGH12A - add $destReg, $destReg, tls_CurrentThread + add $destReg, $destReg, #0, lsl #0 RELOC 0x9, tls_CurrentThread ;; IMAGE_REL_ARM64_SECREL_LOW12A MEND From 38cec42dd8e65678f2a1847c05939e6cd063e6ef Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Wed, 3 May 2023 12:05:44 -0700 Subject: [PATCH 6/8] remove arm64 INLINE_GETTHREAD_CONSTANT_POOL --- src/coreclr/nativeaot/Runtime/arm64/AllocFast.asm | 7 ------- src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h | 8 -------- src/coreclr/nativeaot/Runtime/arm64/ExceptionHandling.asm | 2 -- src/coreclr/nativeaot/Runtime/arm64/GcProbe.asm | 2 -- src/coreclr/nativeaot/Runtime/arm64/GetThread.asm | 2 -- src/coreclr/nativeaot/Runtime/arm64/PInvoke.asm | 2 -- 6 files changed, 23 deletions(-) diff --git a/src/coreclr/nativeaot/Runtime/arm64/AllocFast.asm b/src/coreclr/nativeaot/Runtime/arm64/AllocFast.asm index 560c6dcbad52d8..e6849b87312669 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/AllocFast.asm +++ b/src/coreclr/nativeaot/Runtime/arm64/AllocFast.asm @@ -48,8 +48,6 @@ RhpNewFast_RarePath b RhpNewObject LEAF_END RhpNewFast - INLINE_GETTHREAD_CONSTANT_POOL - ;; Allocate non-array object with finalizer. ;; x0 == MethodTable LEAF_ENTRY RhpNewFinalizable @@ -149,9 +147,6 @@ StringSizeOverflow b RhExceptionHandling_FailedAllocation LEAF_END RhNewString - INLINE_GETTHREAD_CONSTANT_POOL - - ;; Allocate one dimensional, zero based array (SZARRAY). ;; x0 == MethodTable ;; x1 == element count @@ -213,8 +208,6 @@ ArraySizeOverflow b RhExceptionHandling_FailedAllocation LEAF_END RhpNewArray - INLINE_GETTHREAD_CONSTANT_POOL - ;; Allocate one dimensional, zero based array (SZARRAY) using the slow path that calls a runtime helper. ;; x0 == MethodTable ;; x1 == element count diff --git a/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h b/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h index 1020b6849c54e5..9f7b1dafaced68 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h +++ b/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h @@ -227,14 +227,6 @@ TrashRegister32Bit SETS "w":CC:("$TrashRegister32Bit":RIGHT:((:LEN:TrashRegister RELOC 0x9, tls_CurrentThread ;; IMAGE_REL_ARM64_SECREL_LOW12A MEND - ;; INLINE_GETTHREAD_CONSTANT_POOL macro has to be used after the last function in the .asm file that used - ;; INLINE_GETTHREAD. Optionally, it can be also used after any function that used INLINE_GETTHREAD - ;; to improve density, or to reduce distance between the constant pool and its use. - MACRO - INLINE_GETTHREAD_CONSTANT_POOL - - MEND - MACRO INLINE_THREAD_UNHIJACK $threadReg, $trashReg1, $trashReg2 ;; diff --git a/src/coreclr/nativeaot/Runtime/arm64/ExceptionHandling.asm b/src/coreclr/nativeaot/Runtime/arm64/ExceptionHandling.asm index 3db1d648c4deec..1af4fd19f0c664 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/ExceptionHandling.asm +++ b/src/coreclr/nativeaot/Runtime/arm64/ExceptionHandling.asm @@ -624,6 +624,4 @@ SetSuccess NESTED_END RhpCallFilterFunclet - INLINE_GETTHREAD_CONSTANT_POOL - end diff --git a/src/coreclr/nativeaot/Runtime/arm64/GcProbe.asm b/src/coreclr/nativeaot/Runtime/arm64/GcProbe.asm index ef01e43b5e1ff4..d95ab7a0320708 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/GcProbe.asm +++ b/src/coreclr/nativeaot/Runtime/arm64/GcProbe.asm @@ -366,7 +366,5 @@ Success LEAF_END RhpSuppressGcStress #endif ;; FEATURE_GC_STRESS - INLINE_GETTHREAD_CONSTANT_POOL - end diff --git a/src/coreclr/nativeaot/Runtime/arm64/GetThread.asm b/src/coreclr/nativeaot/Runtime/arm64/GetThread.asm index 7c01e66453385c..46c6ab98916c55 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/GetThread.asm +++ b/src/coreclr/nativeaot/Runtime/arm64/GetThread.asm @@ -24,6 +24,4 @@ LEAF_END FASTCALL_ENDFUNC - INLINE_GETTHREAD_CONSTANT_POOL - end diff --git a/src/coreclr/nativeaot/Runtime/arm64/PInvoke.asm b/src/coreclr/nativeaot/Runtime/arm64/PInvoke.asm index 475737fea71a0e..52d55ad2846c77 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/PInvoke.asm +++ b/src/coreclr/nativeaot/Runtime/arm64/PInvoke.asm @@ -34,8 +34,6 @@ ret NESTED_END RhpPInvoke - INLINE_GETTHREAD_CONSTANT_POOL - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; From bd9c04e534cd503cbea20295252a13f6f277fa61 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Wed, 3 May 2023 12:27:14 -0700 Subject: [PATCH 7/8] introduce INLINE_GET_TLS_VAR for win-arm64 --- .../nativeaot/Runtime/arm64/AsmMacros.h | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h b/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h index 9f7b1dafaced68..589f0a24528245 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h +++ b/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h @@ -200,16 +200,16 @@ CodeLbl SETS "$Name":CC:"Lbl" ;; ----------------------------------------------------------------------------- ;; -;; Macro to get a pointer to the Thread* object for the currently executing thread +;; Macro to get a pointer to a threadlocal symbol for the currently executing thread ;; __tls_array equ 0x58 ;; offsetof(TEB, ThreadLocalStoragePointer) - EXTERN _tls_index - EXTERN tls_CurrentThread - MACRO - INLINE_GETTHREAD $destReg, $trashReg + INLINE_GET_TLS_VAR $destReg, $trashReg, $variable + + EXTERN _tls_index + EXTERN $variable ;; The following macro variables are just some assembler magic to get the name of the 32-bit version ;; of $trashReg. It does it by string manipulation. Replaces something like x3 with w3. @@ -222,11 +222,22 @@ TrashRegister32Bit SETS "w":CC:("$TrashRegister32Bit":RIGHT:((:LEN:TrashRegister ldr $destReg, [xpr, #__tls_array] ldr $destReg, [$destReg, $TrashRegister32Bit uxtw #3] add $destReg, $destReg, #0, lsl #0xC - RELOC 0xA, tls_CurrentThread ;; IMAGE_REL_ARM64_SECREL_HIGH12A + RELOC 0xA, $variable ;; IMAGE_REL_ARM64_SECREL_HIGH12A add $destReg, $destReg, #0, lsl #0 - RELOC 0x9, tls_CurrentThread ;; IMAGE_REL_ARM64_SECREL_LOW12A + RELOC 0x9, $variable ;; IMAGE_REL_ARM64_SECREL_LOW12A + MEND + +;; ----------------------------------------------------------------------------- +;; +;; Macro to get a pointer to the Thread* object for the currently executing thread +;; + MACRO + INLINE_GETTHREAD $destReg, $trashReg + + INLINE_GET_TLS_VAR $destReg, $trashReg, tls_CurrentThread MEND + MACRO INLINE_THREAD_UNHIJACK $threadReg, $trashReg1, $trashReg2 ;; From 7300f77a0e9f6755241b4ba98731fe6e52a74978 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Wed, 3 May 2023 12:40:25 -0700 Subject: [PATCH 8/8] delete unused GetThread.asm files --- .../nativeaot/Runtime/amd64/GetThread.asm | 27 ---------------- .../nativeaot/Runtime/arm/GetThread.asm | 32 ------------------- .../nativeaot/Runtime/arm64/GetThread.asm | 27 ---------------- .../nativeaot/Runtime/i386/GetThread.asm | 31 ------------------ 4 files changed, 117 deletions(-) delete mode 100644 src/coreclr/nativeaot/Runtime/amd64/GetThread.asm delete mode 100644 src/coreclr/nativeaot/Runtime/arm/GetThread.asm delete mode 100644 src/coreclr/nativeaot/Runtime/arm64/GetThread.asm delete mode 100644 src/coreclr/nativeaot/Runtime/i386/GetThread.asm diff --git a/src/coreclr/nativeaot/Runtime/amd64/GetThread.asm b/src/coreclr/nativeaot/Runtime/amd64/GetThread.asm deleted file mode 100644 index 806f8db2c72298..00000000000000 --- a/src/coreclr/nativeaot/Runtime/amd64/GetThread.asm +++ /dev/null @@ -1,27 +0,0 @@ -;; Licensed to the .NET Foundation under one or more agreements. -;; The .NET Foundation licenses this file to you under the MIT license. - -include asmmacros.inc - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; RhpGetThread -;; -;; -;; INPUT: -;; -;; OUTPUT: RAX: Thread pointer -;; -;; TRASHES: R10 -;; -;; MUST PRESERVE ARGUMENT REGISTERS -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -LEAF_ENTRY RhpGetThread, _TEXT - ;; rax = GetThread(), TRASHES r10 - INLINE_GETTHREAD rax, r10 - ret -LEAF_END RhpGetThread, _TEXT - - - end diff --git a/src/coreclr/nativeaot/Runtime/arm/GetThread.asm b/src/coreclr/nativeaot/Runtime/arm/GetThread.asm deleted file mode 100644 index b78319f8f15c24..00000000000000 --- a/src/coreclr/nativeaot/Runtime/arm/GetThread.asm +++ /dev/null @@ -1,32 +0,0 @@ -;; Licensed to the .NET Foundation under one or more agreements. -;; The .NET Foundation licenses this file to you under the MIT license. - -#include "AsmMacros.h" - - TEXTAREA - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; RhpGetThread -;; -;; -;; INPUT: none -;; -;; OUTPUT: r0: Thread pointer -;; -;; MUST PRESERVE ARGUMENT REGISTERS -;; @todo check the actual requirements here, r0 is both return and argument register -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - LEAF_ENTRY RhpGetThread - - ;; r0 = GetThread(), TRASHES r12 - INLINE_GETTHREAD r0, r12 - bx lr - - LEAF_END -FASTCALL_ENDFUNC - - INLINE_GETTHREAD_CONSTANT_POOL - - end diff --git a/src/coreclr/nativeaot/Runtime/arm64/GetThread.asm b/src/coreclr/nativeaot/Runtime/arm64/GetThread.asm deleted file mode 100644 index 46c6ab98916c55..00000000000000 --- a/src/coreclr/nativeaot/Runtime/arm64/GetThread.asm +++ /dev/null @@ -1,27 +0,0 @@ -;; Licensed to the .NET Foundation under one or more agreements. -;; The .NET Foundation licenses this file to you under the MIT license. - -#include "AsmMacros.h" - - TEXTAREA - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; RhpGetThread -;; -;; -;; INPUT: none -;; -;; OUTPUT: x9: Thread pointer -;; -;; MUST PRESERVE ARGUMENT REGISTERS -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - LEAF_ENTRY RhpGetThread - ;; x9 = GetThread(), TRASHES xip0 (which can be used as an intra-procedure-call scratch register) - INLINE_GETTHREAD x9, xip0 - ret - LEAF_END -FASTCALL_ENDFUNC - - end diff --git a/src/coreclr/nativeaot/Runtime/i386/GetThread.asm b/src/coreclr/nativeaot/Runtime/i386/GetThread.asm deleted file mode 100644 index b330406b9a098a..00000000000000 --- a/src/coreclr/nativeaot/Runtime/i386/GetThread.asm +++ /dev/null @@ -1,31 +0,0 @@ -;; Licensed to the .NET Foundation under one or more agreements. -;; The .NET Foundation licenses this file to you under the MIT license. - - .586 - .model flat - option casemap:none - .code - - -include AsmMacros.inc - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; RhpGetThread -;; -;; -;; INPUT: none -;; -;; OUTPUT: EAX: Thread pointer -;; -;; MUST PRESERVE ARGUMENT REGISTERS -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -FASTCALL_FUNC RhpGetThread, 0 - push ecx - INLINE_GETTHREAD eax, ecx ; eax dest, ecx trash - pop ecx - ret -FASTCALL_ENDFUNC - - end