Author: kevans
Date: Thu Oct 24 03:48:28 2019
New Revision: 354004
URL: https://svnweb.freebsd.org/changeset/base/354004

Log:
  MFC r344560, r344718
  
  r344560:
  stand: Remove unused i386 EFI MD bits
  
  r328169 removed the copy of bootinfo that would've made this somewhat
  functional. However, this is irrelevant- earlier work in r292338 was done to
  exit boot services in the MI bi_load() rather than having N copies of the
  GetMemoryMap/ExitBootServices dance.
  
  i386 never quite caught up to that; ldr_enter was still being called but
  the prereq for that, ldr_bootinfo, was no longer. As a consequence, this
  ExitBootServices() was being called with a mapkey=0, clearly bogus, and
  reportedly breaking the boot in some instances.
  
  r344718:
  EFI: don't call printf after ExitBootServices, since it uses Boot Services
  
  ExitBootServices terminates all boot services including console access.
  Attempting to call printf afterwards can result in a crash, depending on the
  implementation.
  
  Move any printf statements to before we call bi_load, and remove any that
  depend on calling bi_load first.

Deleted:
  stable/12/stand/efi/loader/arch/i386/efimd.c
Modified:
  stable/12/stand/efi/loader/arch/arm/exec.c
  stable/12/stand/efi/loader/arch/i386/Makefile.inc
  stable/12/stand/efi/loader/arch/i386/elf32_freebsd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/loader/arch/arm/exec.c
==============================================================================
--- stable/12/stand/efi/loader/arch/arm/exec.c  Thu Oct 24 03:44:32 2019        
(r354003)
+++ stable/12/stand/efi/loader/arch/arm/exec.c  Thu Oct 24 03:48:28 2019        
(r354004)
@@ -74,16 +74,19 @@ __elfN(arm_exec)(struct preloaded_file *fp)
        e = (Elf_Ehdr *)&fmp->md_data;
 
        efi_time_fini();
+
+       entry = efi_translate(e->e_entry);
+
+       printf("Kernel entry at 0x%x...\n", (unsigned)entry);
+       printf("Kernel args: %s\n", fp->f_args);
+
        if ((error = bi_load(fp->f_args, &modulep, &kernend)) != 0) {
                efi_time_init();
                return (error);
        }
 
-       entry = efi_translate(e->e_entry);
-       printf("Kernel entry at 0x%x...\n", (unsigned)entry);
-       printf("Kernel args: %s\n", fp->f_args);
-       printf("modulep: %#x\n", modulep);
-       printf("relocation_offset %llx\n", __elfN(relocation_offset));
+       /* At this point we've called ExitBootServices, so we can't call
+        * printf or any other function that uses Boot Services */
 
        dev_cleanup();
 

Modified: stable/12/stand/efi/loader/arch/i386/Makefile.inc
==============================================================================
--- stable/12/stand/efi/loader/arch/i386/Makefile.inc   Thu Oct 24 03:44:32 
2019        (r354003)
+++ stable/12/stand/efi/loader/arch/i386/Makefile.inc   Thu Oct 24 03:48:28 
2019        (r354004)
@@ -1,7 +1,6 @@
 # $FreeBSD$
 
 SRCS+= start.S \
-       efimd.c \
        elf32_freebsd.c \
        exec.c
 

Modified: stable/12/stand/efi/loader/arch/i386/elf32_freebsd.c
==============================================================================
--- stable/12/stand/efi/loader/arch/i386/elf32_freebsd.c        Thu Oct 24 
03:44:32 2019        (r354003)
+++ stable/12/stand/efi/loader/arch/i386/elf32_freebsd.c        Thu Oct 24 
03:48:28 2019        (r354004)
@@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$");
 
 extern void __exec(caddr_t addr, ...);
 extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp);
-extern int ldr_enter(const char *kernel);
 
 static int     elf32_exec(struct preloaded_file *amp);
 static int     elf32_obj_exec(struct preloaded_file *amp);
@@ -76,16 +75,19 @@ elf32_exec(struct preloaded_file *fp)
     ehdr = (Elf_Ehdr *)&(md->md_data);
 
     efi_time_fini();
+
+    entry = ehdr->e_entry & 0xffffff;
+
+    printf("Start @ 0x%x ...\n", entry);
+
     err = bi_load(fp->f_args, &modulep, &kernend);
     if (err != 0) {
        efi_time_init();
        return(err);
     }
-    entry = ehdr->e_entry & 0xffffff;
 
-    printf("Start @ 0x%x ...\n", entry);
-
-    ldr_enter(fp->f_name);
+    /* At this point we've called ExitBootServices, so we can't call
+     * printf or any other function that uses Boot Services */
 
     dev_cleanup();
     __exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop, modulep, 
kernend);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to