diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-07-14 19:47:13 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-07-18 14:36:17 -0400 |
commit | 5593eaa854d0b23c3b270933a93b9b82946df729 (patch) | |
tree | f1efc4a66fcc25749db43eaa77e3075c65b2a1ab /arch/i386 | |
parent | 9aa3909c0ea33da41755e15182fa4f88ae036d83 (diff) |
[x86 setup] Fix assembly constraints
Fix incorrect assembly constraints. In particular, fix memory
constraints used inside push..pop, which can cause invalid operation
since gcc may generate %esp-relative references.
Additionally:
outl() should have "dN" not "dn".
query_mca() shouldn't listen 16/32-bit registers in an 8-bit only
context.
has_eflag(): the "mask" is only used well after both the stack pointer
and the output registers have been touched; this requires the output
registers to be earlyclobbers (=&) and the input to exclude memory (so
"ri", not "g").
Thanks to Etienne Lorrain and Chuck Ebbert for prompting this review.
Cc: Etienne Lorrain <etienne_lorrain@yahoo.fr>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/boot/boot.h | 2 | ||||
-rw-r--r-- | arch/i386/boot/cpucheck.c | 4 | ||||
-rw-r--r-- | arch/i386/boot/mca.c | 2 | ||||
-rw-r--r-- | arch/i386/boot/pm.c | 2 | ||||
-rw-r--r-- | arch/i386/boot/video.c | 2 | ||||
-rw-r--r-- | arch/i386/boot/voyager.c | 2 |
6 files changed, 7 insertions, 7 deletions
diff --git a/arch/i386/boot/boot.h b/arch/i386/boot/boot.h index 0329c4fe4f88..dec70c9b6050 100644 --- a/arch/i386/boot/boot.h +++ b/arch/i386/boot/boot.h | |||
@@ -56,7 +56,7 @@ static inline u16 inw(u16 port) | |||
56 | 56 | ||
57 | static inline void outl(u32 v, u16 port) | 57 | static inline void outl(u32 v, u16 port) |
58 | { | 58 | { |
59 | asm volatile("outl %0,%1" : : "a" (v), "dn" (port)); | 59 | asm volatile("outl %0,%1" : : "a" (v), "dN" (port)); |
60 | } | 60 | } |
61 | static inline u32 inl(u32 port) | 61 | static inline u32 inl(u32 port) |
62 | { | 62 | { |
diff --git a/arch/i386/boot/cpucheck.c b/arch/i386/boot/cpucheck.c index 8b0f4473b083..991e8ceae1de 100644 --- a/arch/i386/boot/cpucheck.c +++ b/arch/i386/boot/cpucheck.c | |||
@@ -115,8 +115,8 @@ static int has_eflag(u32 mask) | |||
115 | "pushfl ; " | 115 | "pushfl ; " |
116 | "popl %1 ; " | 116 | "popl %1 ; " |
117 | "popfl" | 117 | "popfl" |
118 | : "=r" (f0), "=r" (f1) | 118 | : "=&r" (f0), "=&r" (f1) |
119 | : "g" (mask)); | 119 | : "ri" (mask)); |
120 | 120 | ||
121 | return !!((f0^f1) & mask); | 121 | return !!((f0^f1) & mask); |
122 | } | 122 | } |
diff --git a/arch/i386/boot/mca.c b/arch/i386/boot/mca.c index 9b68bd1aef19..68222f2d4b67 100644 --- a/arch/i386/boot/mca.c +++ b/arch/i386/boot/mca.c | |||
@@ -26,7 +26,7 @@ int query_mca(void) | |||
26 | "setc %0 ; " | 26 | "setc %0 ; " |
27 | "movw %%es, %1 ; " | 27 | "movw %%es, %1 ; " |
28 | "popw %%es" | 28 | "popw %%es" |
29 | : "=acdSDm" (err), "=acdSDm" (es), "=b" (bx) | 29 | : "=acd" (err), "=acdSD" (es), "=b" (bx) |
30 | : "a" (0xc000)); | 30 | : "a" (0xc000)); |
31 | 31 | ||
32 | if (err) | 32 | if (err) |
diff --git a/arch/i386/boot/pm.c b/arch/i386/boot/pm.c index 3fa53e15ed77..1df025c73261 100644 --- a/arch/i386/boot/pm.c +++ b/arch/i386/boot/pm.c | |||
@@ -65,7 +65,7 @@ static void move_kernel_around(void) | |||
65 | "popw %%ds ; " | 65 | "popw %%ds ; " |
66 | "popw %%es" | 66 | "popw %%es" |
67 | : "+c" (dwords) | 67 | : "+c" (dwords) |
68 | : "rm" (dst_seg), "rm" (src_seg) | 68 | : "r" (dst_seg), "r" (src_seg) |
69 | : "esi", "edi"); | 69 | : "esi", "edi"); |
70 | 70 | ||
71 | syssize -= paras; | 71 | syssize -= paras; |
diff --git a/arch/i386/boot/video.c b/arch/i386/boot/video.c index 3bb3573cd6a1..027a2c90300b 100644 --- a/arch/i386/boot/video.c +++ b/arch/i386/boot/video.c | |||
@@ -411,7 +411,7 @@ static void restore_screen(void) | |||
411 | "1: rep;stosl ; " | 411 | "1: rep;stosl ; " |
412 | "popw %%es" | 412 | "popw %%es" |
413 | : "+D" (dst), "+c" (npad) | 413 | : "+D" (dst), "+c" (npad) |
414 | : "bdSm" (video_segment), | 414 | : "bdS" (video_segment), |
415 | "a" (0x07200720)); | 415 | "a" (0x07200720)); |
416 | } | 416 | } |
417 | 417 | ||
diff --git a/arch/i386/boot/voyager.c b/arch/i386/boot/voyager.c index 9221614d0db8..61c8fe0453be 100644 --- a/arch/i386/boot/voyager.c +++ b/arch/i386/boot/voyager.c | |||
@@ -32,7 +32,7 @@ int query_voyager(void) | |||
32 | "setc %0 ; " | 32 | "setc %0 ; " |
33 | "movw %%es, %1 ; " | 33 | "movw %%es, %1 ; " |
34 | "popw %%es" | 34 | "popw %%es" |
35 | : "=qm" (err), "=rm" (es), "=D" (di) | 35 | : "=q" (err), "=r" (es), "=D" (di) |
36 | : "a" (0xffc0)); | 36 | : "a" (0xffc0)); |
37 | 37 | ||
38 | if (err) | 38 | if (err) |