summaryrefslogtreecommitdiff
path: root/src/vm/amd64
diff options
context:
space:
mode:
authorSteve MacLean <sdmaclea.qdt@qualcommdatacenter.com>2018-04-23 21:39:24 -0400
committerJan Kotas <jkotas@microsoft.com>2018-04-23 18:39:24 -0700
commit5ebaadf50f99050591a6a987888ef9077cf2050b (patch)
tree56b041ce3ebb132089b47cfda93b8013b19021f6 /src/vm/amd64
parent8c4a47196b18531ae387c289888f64f405bf2b29 (diff)
downloadcoreclr-5ebaadf50f99050591a6a987888ef9077cf2050b.tar.gz
coreclr-5ebaadf50f99050591a6a987888ef9077cf2050b.tar.bz2
coreclr-5ebaadf50f99050591a6a987888ef9077cf2050b.zip
GenericPInvokeCalli shift left then or 1 (#17734)
When _WIN64 is defined vm relies on the secret arg being shifted left and orred with #1. Revert part of changes from #17659 to fix dotnet/corefx#29266 Fix arm64 to match amd64 Simplify dllimport.cpp
Diffstat (limited to 'src/vm/amd64')
-rw-r--r--src/vm/amd64/PInvokeStubs.asm8
-rw-r--r--src/vm/amd64/pinvokestubs.S8
2 files changed, 16 insertions, 0 deletions
diff --git a/src/vm/amd64/PInvokeStubs.asm b/src/vm/amd64/PInvokeStubs.asm
index 7255fa2ebf..82e33ac03d 100644
--- a/src/vm/amd64/PInvokeStubs.asm
+++ b/src/vm/amd64/PInvokeStubs.asm
@@ -32,6 +32,14 @@ LEAF_ENTRY GenericPInvokeCalliHelper, _TEXT
jz GenericPInvokeCalliGenILStub
;
+ ; We need to distinguish between a MethodDesc* and an unmanaged target.
+ ; The way we do this is to shift the managed target to the left by one bit and then set the
+ ; least significant bit to 1. This works because MethodDesc* are always 8-byte aligned.
+ ;
+ shl PINVOKE_CALLI_TARGET_REGISTER, 1
+ or PINVOKE_CALLI_TARGET_REGISTER, 1
+
+ ;
; jump to existing IL stub
;
jmp rax
diff --git a/src/vm/amd64/pinvokestubs.S b/src/vm/amd64/pinvokestubs.S
index dad668af23..19521642ae 100644
--- a/src/vm/amd64/pinvokestubs.S
+++ b/src/vm/amd64/pinvokestubs.S
@@ -25,6 +25,14 @@ LEAF_ENTRY GenericPInvokeCalliHelper, _TEXT
jz C_FUNC(GenericPInvokeCalliGenILStub)
//
+ // We need to distinguish between a MethodDesc* and an unmanaged target.
+ // The way we do this is to shift the managed target to the left by one bit and then set the
+ // least significant bit to 1. This works because MethodDesc* are always 8-byte aligned.
+ //
+ shl PINVOKE_CALLI_TARGET_REGISTER, 1
+ or PINVOKE_CALLI_TARGET_REGISTER, 1
+
+ //
// jump to existing IL stub
//
jmp rax