Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A8B9CD98EF for ; Tue, 16 Jun 2026 17:28:53 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1339508.1600733 (Exim 4.92) (envelope-from ) id 1wZXaa-0005At-CE; Tue, 16 Jun 2026 17:28:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1339508.1600733; Tue, 16 Jun 2026 17:28:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZXaa-00059f-8A; Tue, 16 Jun 2026 17:28:40 +0000 Received: by outflank-mailman (input) for mailman id 1339508; Tue, 16 Jun 2026 17:28:39 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZXaY-0004kp-V7 for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 17:28:38 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wZXaY-00Au7B-C6 for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 19:28:38 +0200 Received: from [10.42.69.3] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a318794-bab6-0a2a0a5309dd-0a2a4503ae7a-44 for ; Tue, 16 Jun 2026 19:28:38 +0200 Received: from [209.85.221.44] (helo=mail-wr1-f44.google.com) by tlsNG-33051d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.1) (envelope-from ) id 6a3187c6-672d-0a2a45030019-d155dd2ca4e4-3 for ; Tue, 16 Jun 2026 19:28:38 +0200 Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-45ef1198766so70625f8f.0 for ; Tue, 16 Jun 2026 10:28:38 -0700 (PDT) Received: from localhost.localdomain (5.116.208.46.dyn.plus.net. [46.208.116.5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-461abb44c3dsm5012754f8f.9.2026.06.16.10.28.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2026 10:28:37 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781630918; x=1782235718; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h7zgfFDoBBPNpJ7qeY1DSNzH5DJ0mfqwAdGCYD7M6W0=; b=aXC0sFGT3UZC7hN8LYImicKW06h+nj0WJQU3UBBE8pTwpftVpvbFu7cuouivpGwHe1 WXCkigmORmZg95k3RBLrJF6zKc6rJZB/A8228hsJKllJZszi0qS/AmHIVxNNj2oNcbjA qP0DPDuigtdQZG5M45WyvIem5Nlvw0Qa7jE3u8PDr0tplBiDFwhWJFRHILizJ23OSeuD zX1Lj6c6Ea3ExKsdQoZKqXxjaj3PIMDj2hs5XKie9PxC9SimLMBNE37CRyJetsFK/HT8 moNcOqcvSwHbj/+0DXA4aza+Z5bq5xjv/PUfpSG6lLy8dRZcyAYq0EX/wyAg/Oh/TF45 B4ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781630918; x=1782235718; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=h7zgfFDoBBPNpJ7qeY1DSNzH5DJ0mfqwAdGCYD7M6W0=; b=Eo8aQofbxbIpeOY6YFIuCE6EInMhU8ito8wKBTt6JInX61cdn3I70T5Ge5zgtpjzfC YZQU9eoBrViIU0ux8JLIljlGmaQasUr9iEJe+3I9ByPHwU1fd255EGAVcjzzcVmJQtRV RBOZty/Z2jPGUeYJRcs0mT1UgtZXXXpHa5CGRz8uQ12a2vPV7XChYFQpGtFnNzY8+EoM 8Uz1Bp27ed207DNbjboOI8Q6Eojmn7DFiXjgUDcO4efTsAJw9UBVc7AHkH+boxMHl5XV xTX+J+uO/ZFZmBCEBU124SOl9k/tfWdwnqCC3i5BQFM9KcIm5ax2EvsMBs+4dnCjkqJW CAjQ== X-Gm-Message-State: AOJu0Yx8713vMDo5rwM+WuX75a7fbD9dk5PeFeNeKeHPNFGFIibkPlHr cX4Iv42KyP6eqUO65M9mLfrF4ZSU/Pq+DO/brPWxsvwyw3Mr5ZdbU4MiWhXJK5bzUYo= X-Gm-Gg: Acq92OHpbVQO4KXZeG95fND4I6X6xCCqD5k9lWAwL5r1O4V+JUsmNsZzM6wmh0rsHu8 tVUqFlS1Yo3oyamfwJY3FrMgiS1R9w5tZUhvDn6h5Nf2ANA5DFjzPNlf9JiMQWpwGarcpC7IiEo aaq4E7FOkAXm/fOuaTbRYX3GGU58TrESanSVz3BLkLu0lxX+9pEQHnEhISRqwdhmVBBDTCMJsDD hKHQWHgvsZeV49fP/JtrXLSoMmK7f2IdymTEEzlSuEeuJqyBqCKRuI5y3dBoCr6kbju4RE2t4tF AeD3SkCR09ZBLVS/v1H3KGSODHyBb0wwX+xuZARFBlCC54WgYs3keRllm4r9jbrexT7wuVa2Qih e0giZtcmOgSlSoXLBNNfQASNXxm9M4bFSnP3oM2Ii/Q7gC5lvOdH1ljapRJxsVLrx/lyM5iKylt Uv6JAX5jKua+PQUJkiLrMTOOxLHG+pr/ZHbX/6Xok2inocDtjRrw4uHxDT4kY9fPpyQruSvjKQL ft/hb2OMuu4MyMZVHsAqjb85Jc= X-Received: by 2002:a05:6000:4902:b0:460:6b12:1783 with SMTP id ffacd0b85a97d-4622a7dad13mr1171084f8f.4.1781630917514; Tue, 16 Jun 2026 10:28:37 -0700 (PDT) From: Frediano Ziglio X-Google-Original-From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Daniel P. Smith" , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Jan Beulich , Andrew Cooper , Teddy Astie , Frediano Ziglio Subject: [PATCH v4 3/4] x86/efi: avoid a relocation in efi_arch_post_exit_boot() Date: Tue, 16 Jun 2026 18:28:29 +0100 Message-ID: <20260616172830.111393-4-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260616172830.111393-1-frediano.ziglio@citrix.com> References: <20260616172830.111393-1-frediano.ziglio@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-purgate-ID: tlsNG-33051d/1781630918-4279C938-AF5D7944/0/0 X-purgate-type: clean X-purgate-size: 1923 From: Roger Pau Monné Instead of using the absolute __start_xen address, calculate it as an offset from the current instruction pointer. The relocation would be problematic if the generated PE binary had .init.text as a standalone section with just read and execute permissions." Removing this relocation is necessary to make it safe to split .init. No functional change intended. Signed-off-by: Roger Pau Monné Signed-off-by: Frediano Ziglio Acked-by: Marek Marczykowski-Górecki -- Changes since v1: - Improve commit message. Changes since v3: - Added Acked-by. --- xen/arch/x86/efi/efi-boot.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index d738b839ee..b983f054b5 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -270,7 +270,9 @@ static void __init noreturn efi_arch_post_exit_boot(void) /* Jump to higher mappings. */ "mov stack_start(%%rip), %%rsp\n\t" - "movabs $__start_xen, %[rip]\n\t" + "lea __start_xen(%%rip), %[rip]\n\t" + "add %[offset], %[rip]\n\t" + "push %[cs]\n\t" "push %[rip]\n\t" "lretq" @@ -278,7 +280,8 @@ static void __init noreturn efi_arch_post_exit_boot(void) [cr4] "+&r" (cr4) : [cr3] "r" (idle_pg_table), [cs] "i" (__HYPERVISOR_CS), - [ds] "r" (__HYPERVISOR_DS) + [ds] "r" (__HYPERVISOR_DS), + [offset] "r" (__XEN_VIRT_START - xen_phys_start) : "memory" ); unreachable(); } -- 2.43.0