Alexandre Julliard : winebuild: Add int64, int128 and float argument types.

Alexandre Julliard julliard at winehq.org
Mon Aug 30 13:00:42 CDT 2010


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Aug 30 12:40:53 2010 +0200

winebuild: Add int64, int128 and float argument types.

---

 tools/winebuild/build.h          |    5 ++++-
 tools/winebuild/parser.c         |    3 +++
 tools/winebuild/spec16.c         |   18 +++++++++++++++---
 tools/winebuild/spec32.c         |    2 ++
 tools/winebuild/utils.c          |    9 +++++++++
 tools/winebuild/winebuild.man.in |   17 +++++++++++++----
 6 files changed, 46 insertions(+), 8 deletions(-)

diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 7ec9997..eec682f 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -68,7 +68,10 @@ enum arg_type
     ARG_PTR,      /* pointer */
     ARG_STR,      /* pointer to Ansi string */
     ARG_WSTR,     /* pointer to Unicode string */
-    ARG_DOUBLE,   /* floating point double */
+    ARG_INT64,    /* 64-bit integer */
+    ARG_INT128,   /* 128-bit integer */
+    ARG_FLOAT,    /* 32-bit float */
+    ARG_DOUBLE,   /* 64-bit float */
     ARG_MAXARG = ARG_DOUBLE
 };
 
diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c
index 8ace705..bc483c9 100644
--- a/tools/winebuild/parser.c
+++ b/tools/winebuild/parser.c
@@ -82,6 +82,9 @@ static const char * const ArgNames[ARG_MAXARG + 1] =
     "ptr",     /* ARG_PTR */
     "str",     /* ARG_STR */
     "wstr",    /* ARG_WSTR */
+    "int64",   /* ARG_INT64 */
+    "int128",  /* ARG_INT128 */
+    "float",   /* ARG_FLOAT */
     "double"   /* ARG_DOUBLE */
 };
 
diff --git a/tools/winebuild/spec16.c b/tools/winebuild/spec16.c
index 82ff9f1..c5ca051 100644
--- a/tools/winebuild/spec16.c
+++ b/tools/winebuild/spec16.c
@@ -78,11 +78,14 @@ static const char *get_args_str( const ORDDEF *odp )
         case ARG_SWORD:  strcat( buffer, "s" ); break;
         case ARG_SEGSTR: strcat( buffer, "T" ); break;
         case ARG_STR:    strcat( buffer, "t" ); break;
-        case ARG_DOUBLE: strcat( buffer, "ll" ); break;
         case ARG_LONG:
+        case ARG_FLOAT:
         case ARG_SEGPTR: strcat( buffer, "l" ); break;
         case ARG_PTR:
-        case ARG_WSTR:   strcat( buffer, "p" ); break;
+        case ARG_WSTR:
+        case ARG_INT128: strcat( buffer, "p" ); break;
+        case ARG_INT64:
+        case ARG_DOUBLE: strcat( buffer, "ll" ); break;
         }
     }
     return buffer;
@@ -288,8 +291,11 @@ static int get_function_argsize( const ORDDEF *odp )
         case ARG_PTR:
         case ARG_STR:
         case ARG_WSTR:
+        case ARG_FLOAT:
+        case ARG_INT128:
             argsize += 4;
             break;
+        case ARG_INT64:
         case ARG_DOUBLE:
             argsize += 8;
             break;
@@ -362,7 +368,7 @@ static void output_call16_function( ORDDEF *odp )
     /* preserve 16-byte stack alignment */
     stack_words += odp->u.func.nb_args;
     for (i = 0; i < odp->u.func.nb_args; i++)
-        if (odp->u.func.args[i] == ARG_DOUBLE) stack_words++;
+        if (odp->u.func.args[i] == ARG_DOUBLE || odp->u.func.args[i] == ARG_INT64) stack_words++;
     if ((odp->flags & FLAG_REGISTER) || (odp->type == TYPE_VARARGS)) stack_words++;
     if (stack_words % 4) output( "\tsubl $%d,%%esp\n", 16 - 4 * (stack_words % 4) );
 
@@ -398,12 +404,14 @@ static void output_call16_function( ORDDEF *odp )
             if (odp->type == TYPE_PASCAL) pos += 2;
             break;
 
+        case ARG_INT64:
         case ARG_DOUBLE:
             if (odp->type != TYPE_PASCAL) pos -= 4;
             output( "\tpushl %d(%%ecx)\n", pos );
             if (odp->type == TYPE_PASCAL) pos += 4;
             /* fall through */
         case ARG_LONG:
+        case ARG_FLOAT:
         case ARG_SEGPTR:
         case ARG_SEGSTR:
             if (odp->type != TYPE_PASCAL) pos -= 4;
@@ -414,6 +422,7 @@ static void output_call16_function( ORDDEF *odp )
         case ARG_PTR:
         case ARG_STR:
         case ARG_WSTR:
+        case ARG_INT128:
             if (odp->type != TYPE_PASCAL) pos -= 4;
             output( "\tmovzwl %d(%%ecx),%%edx\n", pos + 2 ); /* sel */
             output( "\tshr $3,%%edx\n" );
@@ -707,6 +716,9 @@ static void output_module16( DLLSPEC *spec )
             case ARG_PTR:    type = ARG16_PTR; break;
             case ARG_STR:    type = ARG16_STR; break;
             case ARG_WSTR:   type = ARG16_PTR; break;
+            case ARG_FLOAT:  type = ARG16_LONG; break;
+            case ARG_INT128: type = ARG16_PTR; break;
+            case ARG_INT64:
             case ARG_DOUBLE:
                 type = ARG16_LONG;
                 arg_types[pos / 10] |= type << (3 * (pos % 10));
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index 20a1ed8..81f139c 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -117,7 +117,9 @@ static void output_relay_debug( DLLSPEC *spec )
                 {
                 case ARG_STR:    mask |= 1 << (2 * pos++); break;
                 case ARG_WSTR:   mask |= 2 << (2 * pos++); break;
+                case ARG_INT64:
                 case ARG_DOUBLE: pos += 8 / get_ptr_size(); break;
+                case ARG_INT128: pos += (target_cpu == CPU_x86) ? 4 : 1; break;
                 default:         pos++; break;
                 }
             }
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index a856831..d5902c6 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -899,9 +899,18 @@ unsigned int get_args_size( const ORDDEF *odp )
     {
         switch (odp->u.func.args[i])
         {
+        case ARG_INT64:
         case ARG_DOUBLE:
             size += 8;
             break;
+        case ARG_INT128:
+            /* int128 is passed as pointer on x86_64 */
+            if (target_cpu != CPU_x86_64)
+            {
+                size += 16;
+                break;
+            }
+            /* fall through */
         default:
             size += get_ptr_size();
             break;
diff --git a/tools/winebuild/winebuild.man.in b/tools/winebuild/winebuild.man.in
index fb554f7..2dcd3c0 100644
--- a/tools/winebuild/winebuild.man.in
+++ b/tools/winebuild/winebuild.man.in
@@ -343,10 +343,19 @@ should be one or several of:
 (16-bit signed word)
 .TP
 .B long
-(32-bit value)
+(pointer-sized integer value)
+.TP
+.B int64
+(64-bit integer value)
+.TP
+.B int128
+(128-bit integer value)
+.TP
+.B float
+(32-bit floating point value)
 .TP
 .B double
-(64-bit value)
+(64-bit floating point value)
 .TP
 .B ptr
 (linear pointer)
@@ -363,8 +372,8 @@ should be one or several of:
 .B segstr
 (segmented pointer to a null-terminated ASCII string).
 .HP
-.RB Only\  ptr ,\  str ,\  wstr ,\  long\  and\  double
-are valid for Win32 functions.
+Note: The 16-bit and segmented pointer types are only valid for Win16
+functions.
 .RE
 .PP
 .I handler




More information about the wine-cvs mailing list