Skip to contentSkip to conversation

SGABIOS: fix wrong video attrs for int 10h, ah==13h

PATCH In review Herbie Robinson 3 participants 4 messages Mar 10, 2017 – Apr 24, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 SGABIOS: fix wrong video attrs for int 10h, ah==13h

Fix Bug #1670509: wrong video attrs for int 10h, ah==13h The subroutine set_cursor_position is trashing %bx. Unfortunately, %bl contains the video attribute for write_string.

The fix saves %bx in the function prolog and restores it in the epilog.

---
Removed incorrect code deletions from set_current_cursor. Removed explanation of same from the commit message.

BTW, I didn't see any test cases for this code, but if they exist and somebody points me at them, I should be able to generate a very small qcow2 file that demonstrates the problem.

 sgabios.S | 2 ++
 1 file changed, 2 insertions(+)
sgabios.S +2 -0
index 275d063..96c4e23 100644
@@ -1728,6 +1728,7 @@ write_string_tail:
 
 set_cursor_position:
   pushw %ax
+  pushw %bx
   pushw %ds
   pushw $BDA_SEG
   popw %ds                             /* ds = 0x40 */
@@ -1738,6 +1739,7 @@ set_cursor_position:
   movw %ax, %bx                        /* bx = cursor save offset */
   movw %dx, (%bx)                      /* save new cursor value */
   popw %ds
+  popw %bx
   popw %ax
   ret
 
Signature · 1 line
1.8.3.1
Reviewed-by on v3 1/1
#1 lore raw
Quoted 8 lines · Herbie Robinson

Fix Bug #1670509: wrong video attrs for int 10h, ah==13h The subroutine set_cursor_position is trashing %bx. Unfortunately, %bl contains the video attribute for write_string.

The fix saves %bx in the function prolog and restores it in the epilog.

Quoted 32 lines

---
Removed incorrect code deletions from set_current_cursor. Removed explanation of same from the commit message.

BTW, I didn't see any test cases for this code, but if they exist and somebody points me at them, I should be able to generate a very small qcow2 file that demonstrates the problem.

 sgabios.S | 2 ++
 1 file changed, 2 insertions(+)
sgabios.S +2 -0
index 275d063..96c4e23 100644
@@ -1728,6 +1728,7 @@ write_string_tail:
 
 set_cursor_position:
   pushw %ax
+  pushw %bx
   pushw %ds
   pushw $BDA_SEG
   popw %ds                             /* ds = 0x40 */
@@ -1738,6 +1739,7 @@ set_cursor_position:
   movw %ax, %bx                        /* bx = cursor save offset */
   movw %dx, (%bx)                      /* save new cursor value */
   popw %ds
+  popw %bx
   popw %ax
   ret
 
#2 lore raw
In reply to Herbie Robinson

sgabios.S

Quoted 20 lines · Herbie Robinson

Fix Bug #1670509: wrong video attrs for int 10h, ah==13h The subroutine set_cursor_position is trashing %bx. Unfortunately, %bl contains the video attribute for write_string.

The fix saves %bx in the function prolog and restores it in the epilog.

---
Removed incorrect code deletions from set_current_cursor. Removed explanation of same from the commit message.

BTW, I didn't see any test cases for this code, but if they exist and somebody points me at them, I should be able to generate a very small qcow2 file that demonstrates the problem.

 sgabios.S | 2 ++
 1 file changed, 2 insertions(+)
sgabios.S +0 -0

Now I'm not quite sure what to do with this.

It is part of sgabios, which is not qemu code but a submodule.

Maybe it's better to apply it upstream?
Or should we apply it directly?

Thanks,

/mjt

#3 lore raw
Quoted 20 lines · Michael Tokarev
Quoted 19 lines · Herbie Robinson

Fix Bug #1670509: wrong video attrs for int 10h, ah==13h The subroutine set_cursor_position is trashing %bx. Unfortunately, %bl contains the video attribute for write_string.

The fix saves %bx in the function prolog and restores it in the epilog.

---
Removed incorrect code deletions from set_current_cursor. Removed explanation of same from the commit message.

BTW, I didn't see any test cases for this code, but if they exist and somebody points me at them, I should be able to generate a very small qcow2 file that demonstrates the problem.

 sgabios.S | 2 ++
 1 file changed, 2 insertions(+)
Quoted 8 lines

sgabios.S

Quoted 1 line
sgabios.S +0 -0

Now I'm not quite sure what to do with this.

It is part of sgabios, which is not qemu code but a submodule.

Maybe it's better to apply it upstream?
Or should we apply it directly?

The original project is hosted by code.google.com, that has been closed in 2015. I doesn't appear there is a real alive repository hosting this project now (except some multiple clones on github).

So I think you should apply it directly (and regenerate sgabios.bin)

I cc Paolo as he has added the submodule.

Thanks,
Laurent