Browse Source

[x86 setup] Make sure AH=00h when setting a video mode

Passing a u8 into a register doesn't mean gcc will zero-extend it.
Also, don't depend on thhe register not to change.

Per bug report from Saul Tamari.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
H. Peter Anvin 18 years ago
parent
commit
71351b98b9
1 changed files with 3 additions and 2 deletions
  1. 3 2
      arch/i386/boot/video-vga.c

+ 3 - 2
arch/i386/boot/video-vga.c

@@ -73,9 +73,10 @@ static u8 vga_set_basic_mode(void)
 		mode = 3;
 
 	/* Set the mode */
+	ax = mode;
 	asm volatile(INT10
-		     : : "a" (mode)
-		     : "ebx", "ecx", "edx", "esi", "edi");
+		     : "+a" (ax)
+		     : : "ebx", "ecx", "edx", "esi", "edi");
 	do_restore = 1;
 	return mode;
 }