Dan Kegel : vcomp: Implement stub for _vcomp_fork.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jul 17 08:03:40 CDT 2015


Module: wine
Branch: master
Commit: ad1077f94bfe5b8b762f30b1d2174cce61dfbb22
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ad1077f94bfe5b8b762f30b1d2174cce61dfbb22

Author: Dan Kegel <dank at kegel.com>
Date:   Thu Jul 16 15:00:07 2015 +0200

vcomp: Implement stub for _vcomp_fork.

---

 dlls/vcomp/main.c           | 95 +++++++++++++++++++++++++++++++++++++++++++++
 dlls/vcomp/vcomp.spec       |  2 +-
 dlls/vcomp100/vcomp100.spec |  2 +-
 dlls/vcomp90/vcomp90.spec   |  2 +-
 4 files changed, 98 insertions(+), 3 deletions(-)

diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c
index 8ec3616..93d418e 100644
--- a/dlls/vcomp/main.c
+++ b/dlls/vcomp/main.c
@@ -3,6 +3,7 @@
  * vcomp implementation
  *
  * Copyright 2011 Austin English
+ * Copyright 2012 Dan Kegel
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -40,6 +41,89 @@ struct vcomp_thread_data
     int                     fork_threads;
 };
 
+#if defined(__i386__)
+
+extern void CDECL _vcomp_fork_call_wrapper(void *wrapper, int nargs, __ms_va_list args);
+__ASM_GLOBAL_FUNC( _vcomp_fork_call_wrapper,
+                   "pushl %ebp\n\t"
+                   __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
+                   __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
+                   "movl %esp,%ebp\n\t"
+                   __ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
+                   "pushl %esi\n\t"
+                   __ASM_CFI(".cfi_rel_offset %esi,-4\n\t")
+                   "pushl %edi\n\t"
+                   __ASM_CFI(".cfi_rel_offset %edi,-8\n\t")
+                   "movl 12(%ebp),%edx\n\t"
+                   "movl %esp,%edi\n\t"
+                   "shll $2,%edx\n\t"
+                   "jz 1f\n\t"
+                   "subl %edx,%edi\n\t"
+                   "andl $~15,%edi\n\t"
+                   "movl %edi,%esp\n\t"
+                   "movl 12(%ebp),%ecx\n\t"
+                   "movl 16(%ebp),%esi\n\t"
+                   "cld\n\t"
+                   "rep; movsl\n"
+                   "1:\tcall *8(%ebp)\n\t"
+                   "leal -8(%ebp),%esp\n\t"
+                   "popl %edi\n\t"
+                   __ASM_CFI(".cfi_same_value %edi\n\t")
+                   "popl %esi\n\t"
+                   __ASM_CFI(".cfi_same_value %esi\n\t")
+                   "popl %ebp\n\t"
+                   __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
+                   __ASM_CFI(".cfi_same_value %ebp\n\t")
+                   "ret" )
+
+#elif defined(__x86_64__)
+
+extern void CDECL _vcomp_fork_call_wrapper(void *wrapper, int nargs, __ms_va_list args);
+__ASM_GLOBAL_FUNC( _vcomp_fork_call_wrapper,
+                   "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"
+                   "movq $4,%rcx\n\t"
+                   "cmp %rcx,%rdx\n\t"
+                   "cmovgq %rdx,%rcx\n\t"
+                   "leaq 0(,%rcx,8),%rdx\n\t"
+                   "subq %rdx,%rsp\n\t"
+                   "andq $~15,%rsp\n\t"
+                   "movq %rsp,%rdi\n\t"
+                   "movq %r8,%rsi\n\t"
+                   "rep; movsq\n\t"
+                   "movq 0(%rsp),%rcx\n\t"
+                   "movq 8(%rsp),%rdx\n\t"
+                   "movq 16(%rsp),%r8\n\t"
+                   "movq 24(%rsp),%r9\n\t"
+                   "callq *%rax\n\t"
+                   "leaq -16(%rbp),%rsp\n\t"
+                   "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
+
+static void CDECL _vcomp_fork_call_wrapper(void *wrapper, int nargs, __ms_va_list args)
+{
+    ERR("Not implemented for this architecture\n");
+}
+
+#endif
+
 static inline struct vcomp_thread_data *vcomp_get_thread_data(void)
 {
     return (struct vcomp_thread_data *)TlsGetValue(vcomp_context_tls);
@@ -160,6 +244,17 @@ void CDECL _vcomp_single_end(void)
     TRACE("stub\n");
 }
 
+void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...)
+{
+    __ms_va_list valist;
+
+    TRACE("(%d, %d, %p, ...)\n", ifval, nargs, wrapper);
+
+    __ms_va_start(valist, wrapper);
+    _vcomp_fork_call_wrapper(wrapper, nargs, valist);
+    __ms_va_end(valist);
+}
+
 BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
 {
     TRACE("(%p, %d, %p)\n", instance, reason, reserved);
diff --git a/dlls/vcomp/vcomp.spec b/dlls/vcomp/vcomp.spec
index 306dd15..d446574 100644
--- a/dlls/vcomp/vcomp.spec
+++ b/dlls/vcomp/vcomp.spec
@@ -64,7 +64,7 @@
 @ stub _vcomp_for_static_init_i8
 @ stub _vcomp_for_static_simple_init
 @ stub _vcomp_for_static_simple_init_i8
-@ stub _vcomp_fork
+@ varargs _vcomp_fork(long long ptr)
 @ stub _vcomp_get_thread_num
 @ stub _vcomp_leave_critsect
 @ stub _vcomp_master_barrier
diff --git a/dlls/vcomp100/vcomp100.spec b/dlls/vcomp100/vcomp100.spec
index 39cf91c..2c04e91 100644
--- a/dlls/vcomp100/vcomp100.spec
+++ b/dlls/vcomp100/vcomp100.spec
@@ -64,7 +64,7 @@
 @ stub _vcomp_for_static_init_i8
 @ stub _vcomp_for_static_simple_init
 @ stub _vcomp_for_static_simple_init_i8
-@ stub _vcomp_fork
+@ varargs _vcomp_fork(long long ptr) vcomp._vcomp_fork
 @ stub _vcomp_get_thread_num
 @ stub _vcomp_leave_critsect
 @ stub _vcomp_master_barrier
diff --git a/dlls/vcomp90/vcomp90.spec b/dlls/vcomp90/vcomp90.spec
index 39cf91c..2c04e91 100644
--- a/dlls/vcomp90/vcomp90.spec
+++ b/dlls/vcomp90/vcomp90.spec
@@ -64,7 +64,7 @@
 @ stub _vcomp_for_static_init_i8
 @ stub _vcomp_for_static_simple_init
 @ stub _vcomp_for_static_simple_init_i8
-@ stub _vcomp_fork
+@ varargs _vcomp_fork(long long ptr) vcomp._vcomp_fork
 @ stub _vcomp_get_thread_num
 @ stub _vcomp_leave_critsect
 @ stub _vcomp_master_barrier




More information about the wine-cvs mailing list