From owner-svn-src-all@freebsd.org Thu Oct 24 03:48:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6ABD157FA9; Thu, 24 Oct 2019 03:48:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCrs5ZzTz4N1Z; Thu, 24 Oct 2019 03:48:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A29098297; Thu, 24 Oct 2019 03:48:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O3mT8X031864; Thu, 24 Oct 2019 03:48:29 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3mTR3031859; Thu, 24 Oct 2019 03:48:29 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240348.x9O3mTR3031859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354004 - in stable/12/stand/efi/loader/arch: arm i386 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand/efi/loader/arch: arm i386 X-SVN-Commit-Revision: 354004 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:48:30 -0000 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);