Module: wine Branch: master Commit: b02457a108ce1365ec48dce13088c5747fea99c0 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b02457a108ce1365ec48dce130...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Jun 15 12:49:24 2011 +0200
rpcrt4: Implement stubless proxy entry thunks for x86_64.
---
dlls/rpcrt4/cproxy.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/dlls/rpcrt4/cproxy.c b/dlls/rpcrt4/cproxy.c index ed7faf7..b5be7ae 100644 --- a/dlls/rpcrt4/cproxy.c +++ b/dlls/rpcrt4/cproxy.c @@ -116,6 +116,53 @@ static inline void init_thunk( struct thunk *thunk, unsigned int index ) thunk->handler = (char *)call_stubless_func - (char *)(&thunk->handler + 1); }
+#elif defined(__x86_64__) + +extern void call_stubless_func(void); +__ASM_GLOBAL_FUNC(call_stubless_func, + "movq %rcx,0x8(%rsp)\n\t" + "movq %rdx,0x10(%rsp)\n\t" + "movq %r8,0x18(%rsp)\n\t" + "movq %r9,0x20(%rsp)\n\t" + "leaq 0x8(%rsp),%r8\n\t" /* &This */ + "movq (%rcx),%rcx\n\t" /* This->lpVtbl */ + "movq -0x10(%rcx),%rcx\n\t" /* MIDL_STUBLESS_PROXY_INFO */ + "movq 0x10(%rcx),%rdx\n\t" /* info->FormatStringOffset */ + "movzwq (%rdx,%r10,2),%rdx\n\t" /* FormatStringOffset[index] */ + "addq 8(%rcx),%rdx\n\t" /* info->ProcFormatString + offset */ + "movq (%rcx),%rcx\n\t" /* info->pStubDesc */ + "subq $0x28,%rsp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset 0x28\n\t") + "call " __ASM_NAME("ndr_client_call") "\n\t" + "addq $0x28,%rsp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset -0x28\n\t") + "ret" ); + +#include "pshpack1.h" +struct thunk +{ + BYTE mov_r10[3]; + DWORD index; + BYTE mov_rax[2]; + void *call_stubless; + BYTE jmp_rax[2]; +}; +#include "poppack.h" + +static const struct thunk thunk_template = +{ + { 0x49, 0xc7, 0xc2 }, 0, /* movq $index,%r10 */ + { 0x48, 0xb8 }, 0, /* movq $call_stubless_func,%rax */ + { 0xff, 0xe0 } /* jmp *%rax */ +}; + +static inline void init_thunk( struct thunk *thunk, unsigned int index ) +{ + *thunk = thunk_template; + thunk->index = index; + thunk->call_stubless = call_stubless_func; +} + #else /* __i386__ */
#warning You must implement stubless proxies for your CPU