Alexandre Julliard : winebuild: Add a -syscall entry point flag

Alexandre Julliard julliard at winehq.org
Tue Jul 7 15:47:06 CDT 2020


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jul  7 10:36:19 2020 +0200

winebuild: Add a -syscall entry point flag

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 tools/winebuild/build.h          | 7 ++++---
 tools/winebuild/import.c         | 2 ++
 tools/winebuild/parser.c         | 9 +++++++++
 tools/winebuild/winebuild.man.in | 6 ++++++
 4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index d0fc3dca1b..6632f9ccbb 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -175,9 +175,10 @@ struct strarray
 #define FLAG_REGISTER  0x0010  /* use register calling convention */
 #define FLAG_PRIVATE   0x0020  /* function is private (cannot be imported) */
 #define FLAG_ORDINAL   0x0040  /* function should be imported by ordinal */
-#define FLAG_THISCALL  0x0080  /* use thiscall calling convention */
-#define FLAG_FASTCALL  0x0100  /* use fastcall calling convention */
-#define FLAG_IMPORT    0x0200  /* export is imported from another module */
+#define FLAG_THISCALL  0x0080  /* function uses thiscall calling convention */
+#define FLAG_FASTCALL  0x0100  /* function uses fastcall calling convention */
+#define FLAG_SYSCALL   0x0200  /* function is a system call */
+#define FLAG_IMPORT    0x0400  /* export is imported from another module */
 
 #define FLAG_FORWARD   0x1000  /* function is a forwarded name */
 #define FLAG_EXT_LINK  0x2000  /* function links to an external symbol */
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index 125b6132b6..938d632be8 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -545,6 +545,7 @@ static void check_undefined_exports( DLLSPEC *spec )
         ORDDEF *odp = &spec->entry_points[i];
         if (odp->type == TYPE_STUB || odp->type == TYPE_ABS || odp->type == TYPE_VARIABLE) continue;
         if (odp->flags & FLAG_FORWARD) continue;
+        if (odp->flags & FLAG_SYSCALL) continue;
         if (find_name( odp->link_name, &undef_symbols ))
         {
             switch(odp->type)
@@ -587,6 +588,7 @@ static char *create_undef_symbols_file( DLLSPEC *spec )
         ORDDEF *odp = &spec->entry_points[i];
         if (odp->type == TYPE_STUB || odp->type == TYPE_ABS || odp->type == TYPE_VARIABLE) continue;
         if (odp->flags & FLAG_FORWARD) continue;
+        if (odp->flags & FLAG_SYSCALL) continue;
         output( "\t%s %s\n", get_asm_ptr_keyword(), asm_name( get_link_name( odp )));
     }
     for (j = 0; j < extra_ld_symbols.count; j++)
diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c
index 0207b8ac3c..66454bad3c 100644
--- a/tools/winebuild/parser.c
+++ b/tools/winebuild/parser.c
@@ -70,6 +70,7 @@ static const char * const FlagNames[] =
     "ordinal",     /* FLAG_ORDINAL */
     "thiscall",    /* FLAG_THISCALL */
     "fastcall",    /* FLAG_FASTCALL */
+    "syscall",     /* FLAG_SYCALL */
     "import",      /* FLAG_IMPORT */
     NULL
 };
@@ -320,6 +321,14 @@ static int parse_spec_arguments( ORDDEF *odp, DLLSPEC *spec, int optional )
             return 0;
         }
     }
+    if (odp->flags & FLAG_SYSCALL)
+    {
+        if (odp->type != TYPE_STDCALL)
+        {
+            error( "A syscall function must use the stdcall convention\n" );
+            return 0;
+        }
+    }
     return 1;
 }
 
diff --git a/tools/winebuild/winebuild.man.in b/tools/winebuild/winebuild.man.in
index 109f3824f1..c1de885dac 100644
--- a/tools/winebuild/winebuild.man.in
+++ b/tools/winebuild/winebuild.man.in
@@ -338,6 +338,12 @@ The function uses the
 calling convention (first two parameters in %ecx/%edx registers on
 i386).
 .TP
+.B -syscall
+The function is an NT system call. A system call thunk will be
+generated, and the actual function will be called by the
+\fI__wine_syscall_dispatcher\fR function that will be generated on the
+Unix library side.
+.TP
 .B -import
 The function is imported from another module. This can be used instead
 of a




More information about the wine-cvs mailing list