Commit 37a3cc99 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-x86setup

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-x86setup:
  [x86 setup] Make sure AH=00h when setting a video mode
  [x86 setup] Volatilize asm() statements
parents 6e106b0d 71351b98
...@@ -87,7 +87,7 @@ static inline void set_fs(u16 seg) ...@@ -87,7 +87,7 @@ static inline void set_fs(u16 seg)
static inline u16 fs(void) static inline u16 fs(void)
{ {
u16 seg; u16 seg;
asm("movw %%fs,%0" : "=rm" (seg)); asm volatile("movw %%fs,%0" : "=rm" (seg));
return seg; return seg;
} }
...@@ -98,7 +98,7 @@ static inline void set_gs(u16 seg) ...@@ -98,7 +98,7 @@ static inline void set_gs(u16 seg)
static inline u16 gs(void) static inline u16 gs(void)
{ {
u16 seg; u16 seg;
asm("movw %%gs,%0" : "=rm" (seg)); asm volatile("movw %%gs,%0" : "=rm" (seg));
return seg; return seg;
} }
...@@ -107,19 +107,19 @@ typedef unsigned int addr_t; ...@@ -107,19 +107,19 @@ typedef unsigned int addr_t;
static inline u8 rdfs8(addr_t addr) static inline u8 rdfs8(addr_t addr)
{ {
u8 v; u8 v;
asm("movb %%fs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr)); asm volatile("movb %%fs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr));
return v; return v;
} }
static inline u16 rdfs16(addr_t addr) static inline u16 rdfs16(addr_t addr)
{ {
u16 v; u16 v;
asm("movw %%fs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr)); asm volatile("movw %%fs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr));
return v; return v;
} }
static inline u32 rdfs32(addr_t addr) static inline u32 rdfs32(addr_t addr)
{ {
u32 v; u32 v;
asm("movl %%fs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr)); asm volatile("movl %%fs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr));
return v; return v;
} }
...@@ -139,19 +139,19 @@ static inline void wrfs32(u32 v, addr_t addr) ...@@ -139,19 +139,19 @@ static inline void wrfs32(u32 v, addr_t addr)
static inline u8 rdgs8(addr_t addr) static inline u8 rdgs8(addr_t addr)
{ {
u8 v; u8 v;
asm("movb %%gs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr)); asm volatile("movb %%gs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr));
return v; return v;
} }
static inline u16 rdgs16(addr_t addr) static inline u16 rdgs16(addr_t addr)
{ {
u16 v; u16 v;
asm("movw %%gs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr)); asm volatile("movw %%gs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr));
return v; return v;
} }
static inline u32 rdgs32(addr_t addr) static inline u32 rdgs32(addr_t addr)
{ {
u32 v; u32 v;
asm("movl %%gs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr)); asm volatile("movl %%gs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr));
return v; return v;
} }
...@@ -180,14 +180,14 @@ static inline int memcmp(const void *s1, const void *s2, size_t len) ...@@ -180,14 +180,14 @@ static inline int memcmp(const void *s1, const void *s2, size_t len)
static inline int memcmp_fs(const void *s1, addr_t s2, size_t len) static inline int memcmp_fs(const void *s1, addr_t s2, size_t len)
{ {
u8 diff; u8 diff;
asm("fs; repe; cmpsb; setnz %0" asm volatile("fs; repe; cmpsb; setnz %0"
: "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len)); : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len));
return diff; return diff;
} }
static inline int memcmp_gs(const void *s1, addr_t s2, size_t len) static inline int memcmp_gs(const void *s1, addr_t s2, size_t len)
{ {
u8 diff; u8 diff;
asm("gs; repe; cmpsb; setnz %0" asm volatile("gs; repe; cmpsb; setnz %0"
: "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len)); : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len));
return diff; return diff;
} }
......
...@@ -96,7 +96,8 @@ static int has_fpu(void) ...@@ -96,7 +96,8 @@ static int has_fpu(void)
asm volatile("movl %0,%%cr0" : : "r" (cr0)); asm volatile("movl %0,%%cr0" : : "r" (cr0));
} }
asm("fninit ; fnstsw %0 ; fnstcw %1" : "+m" (fsw), "+m" (fcw)); asm volatile("fninit ; fnstsw %0 ; fnstcw %1"
: "+m" (fsw), "+m" (fcw));
return fsw == 0 && (fcw & 0x103f) == 0x003f; return fsw == 0 && (fcw & 0x103f) == 0x003f;
} }
......
...@@ -30,7 +30,7 @@ static int read_mbr(u8 devno, void *buf) ...@@ -30,7 +30,7 @@ static int read_mbr(u8 devno, void *buf)
cx = 0x0001; /* Sector 0-0-1 */ cx = 0x0001; /* Sector 0-0-1 */
dx = devno; dx = devno;
bx = (size_t)buf; bx = (size_t)buf;
asm("pushfl; stc; int $0x13; setc %%al; popfl" asm volatile("pushfl; stc; int $0x13; setc %%al; popfl"
: "+a" (ax), "+c" (cx), "+d" (dx), "+b" (bx) : "+a" (ax), "+c" (cx), "+d" (dx), "+b" (bx)
: : "esi", "edi", "memory"); : : "esi", "edi", "memory");
......
...@@ -54,7 +54,7 @@ static u8 gettime(void) ...@@ -54,7 +54,7 @@ static u8 gettime(void)
u16 ax = 0x0200; u16 ax = 0x0200;
u16 cx, dx; u16 cx, dx;
asm("int $0x1a" asm volatile("int $0x1a"
: "+a" (ax), "=c" (cx), "=d" (dx) : "+a" (ax), "=c" (cx), "=d" (dx)
: : "ebx", "esi", "edi"); : : "ebx", "esi", "edi");
...@@ -67,7 +67,7 @@ static u8 gettime(void) ...@@ -67,7 +67,7 @@ static u8 gettime(void)
int getchar(void) int getchar(void)
{ {
u16 ax = 0; u16 ax = 0;
asm("int $0x16" : "+a" (ax)); asm volatile("int $0x16" : "+a" (ax));
return ax & 0xff; return ax & 0xff;
} }
...@@ -75,7 +75,7 @@ int getchar(void) ...@@ -75,7 +75,7 @@ int getchar(void)
static int kbd_pending(void) static int kbd_pending(void)
{ {
u8 pending; u8 pending;
asm("int $0x16; setnz %0" asm volatile("int $0x16; setnz %0"
: "=rm" (pending) : "=rm" (pending)
: "a" (0x0100)); : "a" (0x0100));
return pending; return pending;
......
...@@ -47,14 +47,14 @@ static u8 vga_set_basic_mode(void) ...@@ -47,14 +47,14 @@ static u8 vga_set_basic_mode(void)
#ifdef CONFIG_VIDEO_400_HACK #ifdef CONFIG_VIDEO_400_HACK
if (adapter >= ADAPTER_VGA) { if (adapter >= ADAPTER_VGA) {
asm(INT10 asm volatile(INT10
: : "a" (0x1202), "b" (0x0030) : : "a" (0x1202), "b" (0x0030)
: "ecx", "edx", "esi", "edi"); : "ecx", "edx", "esi", "edi");
} }
#endif #endif
ax = 0x0f00; ax = 0x0f00;
asm(INT10 asm volatile(INT10
: "+a" (ax) : "+a" (ax)
: : "ebx", "ecx", "edx", "esi", "edi"); : : "ebx", "ecx", "edx", "esi", "edi");
...@@ -73,9 +73,10 @@ static u8 vga_set_basic_mode(void) ...@@ -73,9 +73,10 @@ static u8 vga_set_basic_mode(void)
mode = 3; mode = 3;
/* Set the mode */ /* Set the mode */
ax = mode;
asm volatile(INT10 asm volatile(INT10
: : "a" (mode) : "+a" (ax)
: "ebx", "ecx", "edx", "esi", "edi"); : : "ebx", "ecx", "edx", "esi", "edi");
do_restore = 1; do_restore = 1;
return mode; return mode;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment