Alexandre Julliard : rpcrt4: Implement calling server functions on x86_64.
Alexandre Julliard
julliard at winehq.org
Tue Jun 14 11:57:50 CDT 2011
Module: wine
Branch: master
Commit: 0ce27385fd7c322dba74a3cb609f059865c5becd
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0ce27385fd7c322dba74a3cb609f059865c5becd
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Jun 13 12:43:12 2011 +0200
rpcrt4: Implement calling server functions on x86_64.
---
dlls/rpcrt4/ndr_stubless.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/dlls/rpcrt4/ndr_stubless.c b/dlls/rpcrt4/ndr_stubless.c
index da895e1..7fd7e6a 100644
--- a/dlls/rpcrt4/ndr_stubless.c
+++ b/dlls/rpcrt4/ndr_stubless.c
@@ -1003,6 +1003,48 @@ __ASM_GLOBAL_FUNC(call_server_func,
__ASM_CFI(".cfi_def_cfa %esp,4\n\t")
__ASM_CFI(".cfi_same_value %ebp\n\t")
"ret" )
+#elif defined __x86_64__
+LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigned char * args, unsigned int stack_size);
+__ASM_GLOBAL_FUNC( call_server_func,
+ "pushq %rbp\n\t"
+ __ASM_CFI(".cfi_adjust_cfa_offset 8\n\t")
+ __ASM_CFI(".cfi_rel_offset %rbp,0\n\t")
+ "movq %rsp,%rbp\n\t"
+ __ASM_CFI(".cfi_def_cfa_register %rbp\n\t")
+ "pushq %rsi\n\t"
+ __ASM_CFI(".cfi_rel_offset %rsi,-8\n\t")
+ "pushq %rdi\n\t"
+ __ASM_CFI(".cfi_rel_offset %rdi,-16\n\t")
+ "movq %rcx,%rax\n\t" /* function to call */
+ "movq $32,%rcx\n\t" /* allocate max(32,stack_size) bytes of stack space */
+ "cmpq %rcx,%r8\n\t"
+ "cmovgq %r8,%rcx\n\t"
+ "subq %rcx,%rsp\n\t"
+ "andq $~15,%rsp\n\t"
+ "movq %r8,%rcx\n\t"
+ "shrq $3,%rcx\n\t"
+ "movq %rsp,%rdi\n\t"
+ "movq %rdx,%rsi\n\t"
+ "rep; movsq\n\t" /* copy arguments */
+ "movq 0(%rsp),%rcx\n\t"
+ "movq 8(%rsp),%rdx\n\t"
+ "movq 16(%rsp),%r8\n\t"
+ "movq 24(%rsp),%r9\n\t"
+ "movq %rcx,%xmm0\n\t"
+ "movq %rdx,%xmm1\n\t"
+ "movq %r8,%xmm2\n\t"
+ "movq %r9,%xmm3\n\t"
+ "callq *%rax\n\t"
+ "leaq -16(%rbp),%rsp\n\t" /* restore stack */
+ "popq %rdi\n\t"
+ __ASM_CFI(".cfi_same_value %rdi\n\t")
+ "popq %rsi\n\t"
+ __ASM_CFI(".cfi_same_value %rsi\n\t")
+ __ASM_CFI(".cfi_def_cfa_register %rsp\n\t")
+ "popq %rbp\n\t"
+ __ASM_CFI(".cfi_adjust_cfa_offset -8\n\t")
+ __ASM_CFI(".cfi_same_value %rbp\n\t")
+ "ret")
#else
#warning call_server_func not implemented for your architecture
LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigned char * args, unsigned short stack_size)
More information about the wine-cvs
mailing list