]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[x86 setup] Save/restore DS around invocations of INT 10h
authorH. Peter Anvin <hpa@zytor.com>
Mon, 16 Jul 2007 18:58:24 +0000 (11:58 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Wed, 18 Jul 2007 18:36:17 +0000 (11:36 -0700)
There exists at least one card, Trident TVGA8900CL (BIOS dated 1992/9/8)
which clobbers DS when "scrolling in an SVGA text mode of more than
800x600 pixels."  Although we are extremely unlikely to run into that
situation, it is cheap insurance to save and restore DS, and it only adds
a grand total of 50 bytes to the total output.

Pointed out by Etienne Lorrain.

Cc: Etienne Lorrain <etienne_lorrain@yahoo.fr>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
arch/i386/boot/tty.c
arch/i386/boot/video.h

index a8db78736b02252d7dfca4f52a8550bbd73d94a7..9c668aad351501499610e14ee0c113f9f59a4e74 100644 (file)
@@ -31,7 +31,7 @@ void __attribute__((section(".inittext"))) putchar(int ch)
 
        /* int $0x10 is known to have bugs involving touching registers
           it shouldn't.  Be extra conservative... */
-       asm volatile("pushal; int $0x10; popal"
+       asm volatile("pushal; pushw %%ds; int $0x10; popw %%ds; popal"
                     : : "b" (0x0007), "c" (0x0001), "a" (0x0e00|ch));
 }
 
index 29eca1710b2cdb06812defdd40d1961d5d43ec2e..b92447d51213be34075c0397fb62787d348d85e6 100644 (file)
@@ -117,8 +117,15 @@ extern int graphic_mode;   /* Graphics mode with linear frame buffer */
  * int $0x10 is notorious for touching registers it shouldn't.
  * gcc doesn't like %ebp being clobbered, so define it as a push/pop
  * sequence here.
+ *
+ * A number of systems, including the original PC can clobber %bp in
+ * certain circumstances, like when scrolling.  There exists at least
+ * one Trident video card which could clobber DS under a set of
+ * circumstances that we are unlikely to encounter (scrolling when
+ * using an extended graphics mode of more than 800x600 pixels), but
+ * it's cheap insurance to deal with that here.
  */
-#define INT10 "pushl %%ebp; int $0x10; popl %%ebp"
+#define INT10 "pushl %%ebp; pushw %%ds; int $0x10; popw %%ds; popl %%ebp"
 
 /* Accessing VGA indexed registers */
 static inline u8 in_idx(u16 port, u8 index)