Skip to content

Commit

Permalink
[x86 setup] Make sure AH=00h when setting a video mode
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
H. Peter Anvin committed Aug 23, 2007
1 parent b015124 commit 71351b9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/i386/boot/video-vga.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 71351b9

Please sign in to comment.