[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] x86: fix early boot output


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 19 Jul 2023 09:38:22 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uXb4NC6XF0E0BgAu0gjiWqBFwYNC73u24iqA1zZv1OA=; b=lKG5DEZaIGw7mLCDrNG8qW4puVnI3mwG+KypYLaOJNiHv8oifDWa3fiyLTv/2Rbp9+nZfjWEaB0XLzt0u8uZa4oZispYS6tvEGZvEBPYpBTE9I6WQO8H3E++gfcYRA41EYHA0gVnS3RKDkz6Ew89erIWPo1NTvZP5cBUaIRRr0HytMkIA2nnUU67ciRTxZAhYyT8D6JCdwVrrkYwb7K5FEr6qAnri4GSjQDhaRNtAWXgEZ2l5UF/7eBgKAF8gRdhrhV3QXZm/xjTm1tDSJ9pH+ZVY+KCNIQAkgCUj2DmBY7AIOXpogEcJ1xy2ROK7vluxnmdtV+aJv33c7+K9dbw8g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AZ8nVvbL5RDd9X4iHrwCAsv7BdEfdWqFGlv1fJts5zqmOlzyyfyYGx7dkRdFk7uFS/1jzF2PvA1hFKFzw/1UsLsl7D8dFC5J8lcBeW5iZmzN66Zwt2LwPMjTaqZdH8quLuaptuhY2VI35s64mcqdMkdf48mxakNS3+pNMf9NALzfKYBpGYNPRfmrpSfXAFFCZQ9Go4oKatEc+FQq1tx9IUQMBJEgJkyqPmtp4yovfYq/HJ152KwkNdpLxHQbNYtyIRfgAaoj97a+FOp8HqgzHYhNi1RvIDodNYGvLS4Fs597O7qAkwE6LTy0FKfar6QomkhWbtHJqnn0GVIyxinVFw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 19 Jul 2023 07:38:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Loading the VGA base address involves sym_esi(), i.e. %esi still needs
to hold the relocation base address. Therefore the address of the
message to output cannot be "passed" in %esi. Put the message offset in
%ecx instead, adding it into %esi _after_ its last use as base address.

Fixes: b28044226e1c ("x86: make Xen early boot code relocatable")
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
This also suggests that 78e693cc1232 ("x86/boot: fix early error
output") was only tested for the no-VGA case (i.e. EFI+MB2), and only
for one of the two paths which bypass the loading of %edi at .Lget_vtb
(or the offset load merely was lucky to pick up a zero).

Clearly when using "vga=current" with MB2 when the screen is already in
graphics mode, there will continue to be no visible output.

--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -146,17 +146,17 @@ efi_platform:
 early_error: /* Here to improve the disassembly. */
 
 .Lbad_cpu:
-        add     $sym_offs(.Lbad_cpu_msg), %esi
+        mov     $sym_offs(.Lbad_cpu_msg), %ecx
         jmp     .Lget_vtb
 .Lnot_multiboot:
-        add     $sym_offs(.Lbad_ldr_msg), %esi
+        mov     $sym_offs(.Lbad_ldr_msg), %ecx
         jmp     .Lget_vtb
 .Lnot_aligned:
-        add     $sym_offs(.Lbag_alg_msg), %esi
+        mov     $sym_offs(.Lbag_alg_msg), %ecx
         jmp     .Lget_vtb
 #ifdef CONFIG_REQUIRE_NX
 .Lno_nx:
-        add     $sym_offs(.Lno_nx_msg), %esi
+        mov     $sym_offs(.Lno_nx_msg), %ecx
         jmp     .Lget_vtb
 #endif
 .Lmb2_no_st:
@@ -164,11 +164,11 @@ early_error: /* Here to improve the disa
          * Here we are on EFI platform. vga_text_buffer was zapped earlier
          * because there is pretty good chance that VGA is unavailable.
          */
-        add     $sym_offs(.Lbad_ldr_nst), %esi
+        mov     $sym_offs(.Lbad_ldr_nst), %ecx
         jmp     .Lget_vtb
 .Lmb2_no_ih:
         /* Ditto. */
-        add     $sym_offs(.Lbad_ldr_nih), %esi
+        mov     $sym_offs(.Lbad_ldr_nih), %ecx
         jmp     .Lget_vtb
 .Lmb2_no_bs:
         /*
@@ -176,7 +176,7 @@ early_error: /* Here to improve the disa
          * via start label. Then reliable vga_text_buffer zap is impossible
          * in Multiboot2 scanning loop and we have to zero %edi below.
          */
-        add     $sym_offs(.Lbad_ldr_nbs), %esi
+        mov     $sym_offs(.Lbad_ldr_nbs), %ecx
         xor     %edi,%edi                       # No VGA text buffer
         jmp     .Lprint_err
 .Lmb2_efi_ia_32:
@@ -184,12 +184,15 @@ early_error: /* Here to improve the disa
          * Here we are on EFI IA-32 platform. Then reliable vga_text_buffer 
zap is
          * impossible in Multiboot2 scanning loop and we have to zero %edi 
below.
          */
-        add     $sym_offs(.Lbad_efi_msg), %esi
+        mov     $sym_offs(.Lbad_efi_msg), %ecx
         xor     %edi,%edi                       # No VGA text buffer
         jmp     .Lprint_err
 .Lget_vtb:
         mov     sym_esi(vga_text_buffer), %edi
 .Lprint_err:
+        add     %ecx, %esi     # Add string offset to relocation base.
+        # NOTE: No further use of sym_esi() till the end of the "function"!
+1:
         lodsb
         test    %al,%al        # Terminate on '\0' sentinel
         je      .Lhalt
@@ -202,11 +205,11 @@ early_error: /* Here to improve the disa
         mov     %bl,%al
         out     %al,%dx        # Send a character over the serial line
         test    %edi,%edi      # Is the VGA text buffer available?
-        jz      .Lprint_err
+        jz      1b
         stosb                  # Write a character to the VGA text buffer
         mov     $7,%al
         stosb                  # Write an attribute to the VGA text buffer
-        jmp     .Lprint_err
+        jmp     1b
 .Lhalt: hlt
         jmp     .Lhalt
 



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.