x86/boot: Setup correctly fs segment for bogus_real_magic
PATCH 1/1 x86/boot: Setup correctly fs segment for bogus_real_magic
bogus_real_magic code uses fs segment so it should be initialised.
--- xen/arch/x86/boot/wakeup.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
---
OT: Seen another similar patch on ML I suppose this part of code is not that tested. Also, considering EFI code, do we always have VGA available in these cases?
xen/arch/x86/boot/wakeup.S +2 -2
@@ -20,6 +20,8 @@ ENTRY(wakeup_start) movw %ax, %ds movw %ax, %ss # A stack required for BIOS call movw $wakesym(wakeup_stack), %sp + movw $0xb800, %ax + movw %ax, %fs pushl $0 # Kill dangerous flag early popfl
@@ -44,8 +46,6 @@ ENTRY(wakeup_start) call mode_setw 1: # Show some progress if VGA is resumed - movw $0xb800, %ax - movw %ax, %fs movw $0x0e00 + 'L', %fs:(0x10) lidt wakesym(idt_48)
Signature · 1 line
2.34.1
Quoted 1 line · Frediano Ziglio
bogus_real_magiccode uses fs segment so it should be initialised.
Like for Andrew's fix:
Quoted 8 lines
Signed-off-by Frediano Ziglio <[email protected]>--- xen/arch/x86/boot/wakeup.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)---
OT: Seen another similar patch on ML I suppose this part of code is not that tested. Also, considering EFI code, do we always have VGA available in these cases?
No, we can't really assume so. This is "best effort" only, with the hope that if there's no VGA there, then there's also nothing else there which might dislike the writes.
Quoted 12 lines
xen/arch/x86/boot/wakeup.S +2
-0@@ -20,6 +20,8 @@ ENTRY(wakeup_start) movw %ax, %ds movw %ax, %ss # A stack required for BIOS call movw $wakesym(wakeup_stack), %sp + movw $0xb800, %ax + movw %ax, %fs pushl $0 # Kill dangerous flag early popfl
xen/arch/x86/boot/wakeup.S ENTRY(wakeup_start) · line 51
Quoted 8 lines
xen/arch/x86/boot/wakeup.S +0
-2@@ -44,8 +46,6 @@ ENTRY(wakeup_start) call mode_setw 1: # Show some progress if VGA is resumed - movw $0xb800, %ax - movw %ax, %fs movw $0x0e00 + 'L', %fs:(0x10) lidt wakesym(idt_48)
Between these two hunks we have
lcall $0xc000, $3
movw %cs, %ax # In case messed by BIOS
movw %ax, %ds
movw %ax, %ss # Need this? How to ret if clobbered?I'd guess that the loading of %fs was deliberately after that point, in case some BIOSes messed with that, too. Hence I'm unconvinced we can simply move the loading of %fs; I think it needs duplicating instead. (That way it's probably also safer wrt the mode_setw() invocation. That doesn't touch %fs right now, but it's also not said anywhere that it shouldn't.)
Jan