Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFadi Hanna <fadim@microsoft.com>2016-11-15 22:27:43 +0300
committerFadi Hanna <fadim@microsoft.com>2016-11-15 22:27:43 +0300
commit4e29f019e860dfcf8ddfee9b47376f76e51af2ae (patch)
tree72df3fbd434fe317f65f4f33c23b6c048a226d65 /src/Native/Runtime/amd64
parent691756f86e4def5c8ca13acd3e0c17011d436857 (diff)
Thunk pool implementation for CoreRT. In CoreRT, the thunk mappings are allocated dynamically in memory using VirtualAlloc. The thunk stubs pages are marked with RX permissions and the thunks data pages are marked with RW permissions.
Refactored some code in ThunkPool.cs to remove from it any knowledge about the thunk sections layout. Thunks layout and allocation become a black box to ThunkPool.cs. All the section layout information is moved to the native component, and section navigation is done by calls to some APIs. The dynamically allocated thunks pages are enabled by a FEATURE_RX_THUNKS, and only in CoreRT's Full build for now. The portable build doesn't yet support thunks. [tfs-changeset: 1638131]
Diffstat (limited to 'src/Native/Runtime/amd64')
-rw-r--r--src/Native/Runtime/amd64/ThunkPoolThunks.asm33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Native/Runtime/amd64/ThunkPoolThunks.asm b/src/Native/Runtime/amd64/ThunkPoolThunks.asm
index 65527e2f8..2ed0d8cd1 100644
--- a/src/Native/Runtime/amd64/ThunkPoolThunks.asm
+++ b/src/Native/Runtime/amd64/ThunkPoolThunks.asm
@@ -258,5 +258,38 @@ LEAF_ENTRY RhpGetNumThunkBlocksPerMapping, _TEXT
ret
LEAF_END RhpGetNumThunkBlocksPerMapping, _TEXT
+;;
+;; IntPtr RhpGetNextThunkStubsBlockAddress(IntPtr currentThunkStubsBlockAddress)
+;;
+LEAF_ENTRY RhpGetNextThunkStubsBlockAddress, _TEXT
+ mov rax, PAGE_SIZE * 2
+ add rax, rcx
+ ret
+LEAF_END RhpGetNextThunkStubsBlockAddress, _TEXT
+
+;;
+;; IntPtr RhpGetThunkDataBlockAddress(IntPtr thunkStubAddress)
+;;
+LEAF_ENTRY RhpGetThunkDataBlockAddress, _TEXT
+ mov rax, rcx
+ mov rcx, PAGE_SIZE - 1
+ not rcx
+ and rax, rcx
+ add rax, PAGE_SIZE
+ ret
+LEAF_END RhpGetThunkDataBlockAddress, _TEXT
+
+;;
+;; IntPtr RhpGetThunkStubsBlockAddress(IntPtr thunkDataAddress)
+;;
+LEAF_ENTRY RhpGetThunkStubsBlockAddress, _TEXT
+ mov rax, rcx
+ mov rcx, PAGE_SIZE - 1
+ not rcx
+ and rax, rcx
+ sub rax, PAGE_SIZE
+ ret
+LEAF_END RhpGetThunkStubsBlockAddress, _TEXT
+
end