1 --- configure.ac
2 +++ configure.ac
3 @@ -197,7 +197,7 @@
4
5 AC_CACHE_CHECK(whether gcc supports x86 inline asm,
6 ac_cv_c_inline_asm,
7 - [AC_TRY_LINK(,[{int x; asm volatile("movl %%eax, %%ebx\n"::
8 + [AC_TRY_LINK(,[{int x; asm volatile("movl %%eax, %%ebx\n\t pushal\n\t popal"::
9 "m" (x),"m" (x),"m" (x),"m" (x),"m" (x),"m" (x),
10 "m" (x),"m" (x),"m" (x),"m" (x),"m" (x),"m" (x));}],
11 ac_cv_c_inline_asm=yes,
12 --- wrlib/x86_specific.c
13 +++ wrlib/x86_specific.c
14 @@ -98,15 +98,23 @@
15 int height,
16 int line_offset)
17 {
18 - long long rrggbbaa;
19 - long long pixel;
20 + union {
21 + long long rrggbbaa;
22 + struct {short int rr, gg, bb, aa;} words;
23 + } rrggbbaa;
24 +
25 + union {
26 + long long pixel;
27 + struct {short int rr, gg, bb, aa;} words;
28 + } pixel;
29 +
30 short *tmp_err;
31 short *tmp_nerr;
32 int x;
33
34 asm volatile
35 (
36 - "pushal \n\t"
37 + "pushl %%ebx \n\t"
38
39 // pack dr, dg and db into mm6
40 "movl %7, %%eax \n\t"
41 @@ -290,7 +298,7 @@
42
43 ".Enda: \n\t" // THE END
44 "emms \n\t"
45 - "popal \n\t"
46 + "popl %%ebx \n\t"
47 :
48 :
49 "m" (image), // %0
50 @@ -309,17 +317,18 @@
51 "m" (width), // %13
52 "m" (height), // %14
53 "m" (line_offset), // %15
54 - "m" (rrggbbaa), // %16 (access to rr)
55 - "m" ((*((short*)(&rrggbbaa)+1))), // %17 (access to gg)
56 - "m" ((*((short*)(&rrggbbaa)+2))), // %18 (access to bb)
57 - "m" ((*((short*)(&rrggbbaa)+3))), // %19 (access to aa)
58 - "m" (pixel), // %20 (access to pixel.r)
59 - "m" ((*((short*)(&pixel)+1))), // %21 (access to pixel.g)
60 - "m" ((*((short*)(&pixel)+2))), // %22 (access to pixel.b)
61 - "m" ((*((short*)(&pixel)+3))), // %23 (access to pixel.a)
62 + "m" (rrggbbaa.rrggbbaa), // %16 (access to rr)
63 + "m" (rrggbbaa.words.gg), // %17 (access to gg)
64 + "m" (rrggbbaa.words.bb), // %18 (access to bb)
65 + "m" (rrggbbaa.words.aa), // %19 (access to aa)
66 + "m" (pixel.pixel), // %20 (access to pixel.r)
67 + "m" (pixel.words.gg), // %21 (access to pixel.g)
68 + "m" (pixel.words.bb), // %22 (access to pixel.b)
69 + "m" (pixel.words.aa), // %23 (access to pixel.a)
70 "m" (tmp_err), // %24
71 "m" (tmp_nerr), // %25
72 "m" (x) // %26
73 + : "eax", "ecx", "edx", "esi", "edi"
74 );
75 }
76
77 @@ -342,8 +351,15 @@
78 int height,
79 int line_offset)
80 {
81 - long long rrggbbaa;
82 - long long pixel;
83 + union {
84 + long long rrggbbaa;
85 + struct {short int rr, gg, bb, aa;} words;
86 + } rrggbbaa;
87 +
88 + union {
89 + long long pixel;
90 + struct {short int rr, gg, bb, aa;} words;
91 + } pixel;
92
93 short *tmp_err;
94 short *tmp_nerr;
95 @@ -354,7 +370,7 @@
96
97 asm volatile
98 (
99 - "pushal \n\t"
100 + "pushl %%ebx \n\t"
101
102 "movl %13, %%eax \n\t" // eax = width
103 "movl %%eax, %%ebx \n\t"
104 @@ -424,7 +440,7 @@
105
106 ".Endc: \n\t" // THE END
107 "emms \n\t"
108 - "popal \n\t"
109 + "popl %%ebx \n\t"
110 :
111 :
112 "m" (image), // %0
113 @@ -443,19 +459,20 @@
114 "m" (width), // %13
115 "m" (height), // %14
116 "m" (line_offset), // %15
117 - "m" (rrggbbaa), // %16 (access to rr)
118 - "m" ((*((short*)(&rrggbbaa)+1))), // %17 (access to gg)
119 - "m" ((*((short*)(&rrggbbaa)+2))), // %18 (access to bb)
120 - "m" ((*((short*)(&rrggbbaa)+3))), // %19 (access to aa)
121 - "m" (pixel), // %20 (access to pixel.r)
122 - "m" ((*((short*)(&pixel)+1))), // %21 (access to pixel.g)
123 - "m" ((*((short*)(&pixel)+2))), // %22 (access to pixel.b)
124 - "m" ((*((short*)(&pixel)+3))), // %23 (access to pixel.a)
125 + "m" (rrggbbaa.rrggbbaa), // %16 (access to rr)
126 + "m" (rrggbbaa.words.gg), // %17 (access to gg)
127 + "m" (rrggbbaa.words.bb), // %18 (access to bb)
128 + "m" (rrggbbaa.words.aa), // %19 (access to aa)
129 + "m" (pixel.pixel), // %20 (access to pixel.r)
130 + "m" (pixel.words.gg), // %21 (access to pixel.g)
131 + "m" (pixel.words.bb), // %22 (access to pixel.b)
132 + "m" (pixel.words.aa), // %23 (access to pixel.a)
133 "m" (tmp_err), // %24
134 "m" (tmp_nerr), // %25
135 "m" (x), // %26
136 "m" (w1), // %27
137 "m" (w2) // %28
138 + : "eax", "ecx", "edx", "esi", "edi"
139 );
140 }
141
|