Received: by mail.netbsd.org (Postfix, from userid 605) id 68FA084EDE; Thu, 20 Apr 2023 00:42:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 8226284EDC for ; Thu, 20 Apr 2023 00:42:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.netbsd.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id tW04qpz1-esF for ; Thu, 20 Apr 2023 00:42:25 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id B67EE84DA9 for ; Thu, 20 Apr 2023 00:42:24 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id AFF41FA85; Thu, 20 Apr 2023 00:42:24 +0000 (UTC) Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" MIME-Version: 1.0 Date: Thu, 20 Apr 2023 00:42:24 +0000 From: "Emmanuel Dreyfus" Subject: CVS commit: src/sys/arch To: source-changes@NetBSD.org X-Mailer: log_accum Message-Id: <20230420004224.AFF41FA85@cvs.NetBSD.org> Sender: source-changes-owner@NetBSD.org List-Id: Precedence: bulk Reply-To: source-changes-d@NetBSD.org Mail-Reply-To: "Emmanuel Dreyfus" Mail-Followup-To: source-changes-d@NetBSD.org List-Unsubscribe: Module Name: src Committed By: manu Date: Thu Apr 20 00:42:24 UTC 2023 Modified Files: src/sys/arch/amd64/amd64: locore.S src/sys/arch/i386/stand/efiboot: boot.c efiboot.c efiboot.h src/sys/arch/i386/stand/efiboot/bootia32: efibootia32.c startprog32.S src/sys/arch/i386/stand/efiboot/bootx64: efibootx64.c startprog64.S src/sys/arch/i386/stand/lib: exec.c Log Message: Add reloc keyworkd to let EFI bootstrap load amd64 kernel at any address EFI bootstrap assumes it can copy the amd64 kernel to its ELF load address (that is KERNTEXTOFF - KERNBASE = 0x200000), but it can clash with previous UEFI memory allocation, as described here: http://mail-index.netbsd.org/tech-kern/2023/04/07/msg028833.html This change adds a reloc keyword for controling where the EFI boostrap will copy the kernel image. Possible values are: default - the default and prior behavior, copy at 0x200000. none - do not copy and use the kernel image where it was loaded. address - specify an explicit address where to copy the kernel. This comes with an amd64 kernel patch that makes it self-relocatable. It first discover where it was loaded in memory, and if this is different than the expected 0x200000, hhe the kernel relocates itself and start over at the right address. To generate a diff of this commit: cvs rdiff -u -r1.218 -r1.219 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/stand/efiboot/boot.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/efiboot/efiboot.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/efiboot/efiboot.h cvs rdiff -u -r1.5 -r1.6 \ src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c cvs rdiff -u -r1.2 -r1.3 \ src/sys/arch/i386/stand/efiboot/bootia32/startprog32.S cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/efiboot/bootx64/efibootx64.c cvs rdiff -u -r1.3 -r1.4 \ src/sys/arch/i386/stand/efiboot/bootx64/startprog64.S cvs rdiff -u -r1.78 -r1.79 src/sys/arch/i386/stand/lib/exec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.