[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 07 of 22] - fixed gcc-4 compilation issues (Vladimir Nadvornik <nadvornik (at) suse (dot) cz>)



# HG changeset patch
# User Dan Pascu <dan@ag-projects.com>
# Date 1124737677 25200
# Branch wm_0_92
# Node ID 6f8b21fc008fe3618a793761b2a9191bb433140f
# Parent  ef121bc27253a6b4804d567aa38b63faf9c53c6a
- fixed gcc-4 compilation issues (Vladimir Nadvornik <nadvornik@suse.cz>)
- fixed amd64 compilation issues (Vladimir Nadvornik <nadvornik@suse.cz>)
(transplanted from 4dd6af350c2e94e359874161a0330076891477dc)

diff -r ef121bc27253 -r 6f8b21fc008f ChangeLog
--- a/ChangeLog	Sun Jul 17 12:16:46 2005 -0700
+++ b/ChangeLog	Mon Aug 22 12:07:57 2005 -0700
@@ -5,6 +5,8 @@
   argument is an absolute path
 - updated german translations (Torsten Marek <shlomme@gmx.net>)
 - fixed WPrefs.app to find its icons when not installed under GNUstep paths
+- fixed gcc-4 compilation issues (Vladimir Nadvornik <nadvornik@suse.cz>)
+- fixed amd64 compilation issues (Vladimir Nadvornik <nadvornik@suse.cz>)
 
 
 Changes since version 0.91.0:
diff -r ef121bc27253 -r 6f8b21fc008f configure.ac
--- a/configure.ac	Sun Jul 17 12:16:46 2005 -0700
+++ b/configure.ac	Mon Aug 22 12:07:57 2005 -0700
@@ -197,7 +197,7 @@
 
     AC_CACHE_CHECK(whether gcc supports x86 inline asm,
                    ac_cv_c_inline_asm,
-                   [AC_TRY_LINK(,[{int x; asm volatile("movl %%eax, %%ebx\n"::
+                   [AC_TRY_LINK(,[{int x; asm volatile("movl %%eax, %%ebx\n\t pushal\n\t popal"::
                           "m" (x),"m" (x),"m" (x),"m" (x),"m" (x),"m" (x),
                           "m" (x),"m" (x),"m" (x),"m" (x),"m" (x),"m" (x));}],
                    ac_cv_c_inline_asm=yes,
diff -r ef121bc27253 -r 6f8b21fc008f wrlib/x86_specific.c
--- a/wrlib/x86_specific.c	Sun Jul 17 12:16:46 2005 -0700
+++ b/wrlib/x86_specific.c	Mon Aug 22 12:07:57 2005 -0700
@@ -98,15 +98,23 @@
                            int height,
                            int line_offset)
 {
-    long long rrggbbaa;
-    long long pixel;
+    union {
+	long long rrggbbaa;
+	struct {short int rr, gg, bb, aa;} words;
+    } rrggbbaa;
+    
+    union {
+	long long pixel;
+	struct {short int rr, gg, bb, aa;} words;
+    } pixel;
+
     short *tmp_err;
     short *tmp_nerr;
     int x;
 
     asm volatile
         (
-         "pushal                        \n\t"
+         "pushl %%ebx                        \n\t"
 
          // pack dr, dg and db into mm6
          "movl  %7, %%eax               \n\t"
@@ -290,7 +298,7 @@
 
 ".Enda:                                 \n\t" // THE END
          "emms                          \n\t"
-         "popal                         \n\t"
+         "popl %%ebx                         \n\t"
          :
          :
          "m" (image),                      // %0
@@ -309,17 +317,18 @@
          "m" (width),                      // %13
          "m" (height),                     // %14
          "m" (line_offset),                // %15
-         "m" (rrggbbaa),                   // %16 (access to rr)
-         "m" ((*((short*)(&rrggbbaa)+1))), // %17 (access to gg)
-         "m" ((*((short*)(&rrggbbaa)+2))), // %18 (access to bb)
-         "m" ((*((short*)(&rrggbbaa)+3))), // %19 (access to aa)
-         "m" (pixel),                      // %20 (access to pixel.r)
-         "m" ((*((short*)(&pixel)+1))),    // %21 (access to pixel.g)
-         "m" ((*((short*)(&pixel)+2))),    // %22 (access to pixel.b)
-         "m" ((*((short*)(&pixel)+3))),    // %23 (access to pixel.a)
+         "m" (rrggbbaa.rrggbbaa),          // %16 (access to rr)
+         "m" (rrggbbaa.words.gg),          // %17 (access to gg)
+         "m" (rrggbbaa.words.bb),          // %18 (access to bb)
+         "m" (rrggbbaa.words.aa),          // %19 (access to aa)
+         "m" (pixel.pixel),                // %20 (access to pixel.r)
+         "m" (pixel.words.gg),             // %21 (access to pixel.g)
+         "m" (pixel.words.bb),             // %22 (access to pixel.b)
+         "m" (pixel.words.aa),             // %23 (access to pixel.a)
          "m" (tmp_err),                    // %24
          "m" (tmp_nerr),                   // %25
          "m" (x)                           // %26
+	 : "eax", "ecx", "edx", "esi", "edi"
         );
 }
 
@@ -342,8 +351,15 @@
                            int height,
                            int line_offset)
 {
-    long long rrggbbaa;
-    long long pixel;
+    union {
+	long long rrggbbaa;
+	struct {short int rr, gg, bb, aa;} words;
+    } rrggbbaa;
+    
+    union {
+	long long pixel;
+	struct {short int rr, gg, bb, aa;} words;
+    } pixel;
 
     short *tmp_err;
     short *tmp_nerr;
@@ -354,7 +370,7 @@
 
     asm volatile
         (
-         "pushal                        \n\t"
+         "pushl %%ebx                        \n\t"
 
          "movl %13, %%eax               \n\t" // eax = width
          "movl %%eax, %%ebx             \n\t"
@@ -424,7 +440,7 @@
 
 ".Endc:                                 \n\t" // THE END
          "emms                          \n\t"
-         "popal                         \n\t"
+         "popl %%ebx                         \n\t"
          :
          :
          "m" (image),                      // %0
@@ -443,19 +459,20 @@
          "m" (width),                      // %13
          "m" (height),                     // %14
          "m" (line_offset),                // %15
-         "m" (rrggbbaa),                   // %16 (access to rr)
-         "m" ((*((short*)(&rrggbbaa)+1))), // %17 (access to gg)
-         "m" ((*((short*)(&rrggbbaa)+2))), // %18 (access to bb)
-         "m" ((*((short*)(&rrggbbaa)+3))), // %19 (access to aa)
-         "m" (pixel),                      // %20 (access to pixel.r)
-         "m" ((*((short*)(&pixel)+1))),    // %21 (access to pixel.g)
-         "m" ((*((short*)(&pixel)+2))),    // %22 (access to pixel.b)
-         "m" ((*((short*)(&pixel)+3))),    // %23 (access to pixel.a)
+         "m" (rrggbbaa.rrggbbaa),          // %16 (access to rr)
+         "m" (rrggbbaa.words.gg),          // %17 (access to gg)
+         "m" (rrggbbaa.words.bb),          // %18 (access to bb)
+         "m" (rrggbbaa.words.aa),          // %19 (access to aa)
+         "m" (pixel.pixel),                // %20 (access to pixel.r)
+         "m" (pixel.words.gg),             // %21 (access to pixel.g)
+         "m" (pixel.words.bb),             // %22 (access to pixel.b)
+         "m" (pixel.words.aa),             // %23 (access to pixel.a)
          "m" (tmp_err),                    // %24
          "m" (tmp_nerr),                   // %25
          "m" (x),                          // %26
          "m" (w1),                         // %27
          "m" (w2)                          // %28
+	  : "eax", "ecx", "edx", "esi", "edi"
         );
 }
 


-- 
To unsubscribe, send mail to wmaker-dev-unsubscribe@lists.windowmaker.info.