From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A5D1606A322 for ; Fri, 4 Dec 2026 20:51:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=UaVsCuHi Received: from list by lists.xenproject.org with outflank-mailman.1514951.1705678 (Exim 4.92) (envelope-from ) id 1xZaFB-0004vG-EO; Fri, 04 Dec 2026 20:51:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1514951.1705678; Fri, 04 Dec 2026 20:51:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xZaFB-0004th-7D; Fri, 04 Dec 2026 20:51:01 +0000 Received: by outflank-mailman (input) for mailman id 1514951; Fri, 04 Dec 2026 20:50:59 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xZaF9-0004IG-O1 for xen-devel@lists.xenproject.org; Fri, 04 Dec 2026 20:50:59 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xZaF9-0016G1-4r for xen-devel@lists.xenproject.org; Fri, 04 Dec 2026 21:50:59 +0100 Received: from [10.42.69.4] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6b1327a1-e002-0a2a0a5209dd-0a2a45049140-22 for ; Fri, 04 Dec 2026 21:50:59 +0100 Received: from [209.85.221.53] (helo=mail-wr1-f53.google.com) by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6b1327b2-b57f-0a2a45040019-d155dd35c502-3 for ; Fri, 04 Dec 2026 21:50:59 +0100 Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-4c8fef0a906so839258f8f.1 for ; Fri, 04 Dec 2026 12:50:59 -0800 (PST) Received: from localhost.localdomain (89.246.200.146.dyn.plus.net. [146.200.246.89]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4d17426821asm6895228f8f.45.2026.12.04.12.50.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 12:50:58 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Post: List-Help: List-Subscribe: , Precedence: list Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20260707 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:Sender" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796417458; x=1797022258; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to:content-type; bh=J0unEu4oNegKrHcuxxpLFui97TXVP+F41PZppgrWqSw=; b=UaVsCuHiNB3avrR2zR7JT58bY0W4k9camJyNqAO3msKqNzrCG8xeihyb4X/V+ps+54 SQaecHSZjBWBSy5uqZOqAoAXFcvT38fRjzUbBdoq1bHT/T+uFcc4FDVBAQTbdTmH1KY6 gseCNOgij4zoQzcx44gPY14VHBDiMCYZebObVg35NJDN9TLK9rBmSG9qD6UzUmnR8R/v YwRPQDw8UUa4d71pPGac/Bq8nq8cfE6sSbz7JUMMYQe0R+FDtwz+X0xpQem+gZJBSTjf gKJPKVSaXPo9nMHot2wQPlpnhdtdw5KAGwU/T5K57suBmxamdCLR1GgKJFGPaJL86P2B X3og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796417458; x=1797022258; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=J0unEu4oNegKrHcuxxpLFui97TXVP+F41PZppgrWqSw=; b=B4Rne1hx2rUxHblblqXSw8XHXsAt1c4QOgoZPkJLmTkX9NK3nBemNE7ctJ7vt3CCqV I5G6FxY4HZeVygaBBfZO0KdSjNnNxbaL7Yf26X1OTrDjPrRHT2MLxy5oJgYxI4xRQ3s7 7cKWa+LkUeFQctW87I+IwixKw31iHsIJPXL7Kk3rvZ8BuzbOAk9W4eMoApU+48W/y87k YdQLvpRtmX7yjdvCif6jsHrz5S/vJeSGGiJk+QDmAHtMZNz4riFzgMaWuv4TeERXAQX0 I26yu30IeJNjST1gVILJpSHo0Z3s3czqNDxGzlBXzJ0udKDEcAT7KcXV4LWSNDKLwQfm lteg== X-Gm-Message-State: AB4q+uHDvyRNWEm9CMoYzco9zqWxFGPzRVqtWWdl1VdqRTtAp/KFSzB/ kwMGB6Z5K4BhcMdSv1TwgtZKnypXVEV9qf4HvwL04YY29Q6wvuFoQeS37cHhEEpj X-Gm-Gg: AZFdTZe1Wg2Uyxs2FBJvNz/Kp8CxiZQ0TthFddwe02yaZYgYNFwCLG/pWVCxu9w7W4y OsLEHfYsILizYEkPT0DQeTKRsM6s5jSwIIlTsBpaNNFULySUo484lhD1yfjfUelkWbxfjoLeAIs 9aS/a4N2niuS576jMOYh6PlGYUsbdrhPpqbasXuB2GnD8+kSnbotpJvlmetmU9nwlCIL471Rwed E/LC8h5teli2yy4mNq1z+EmKHFZMmHGxGigsH9nXbWS+6VDa4CfGked+rtcdlQ8wLoaxmXtmXwC GtUztAS3plBgpbFnsjyF06ZwUCVLJy1R2/N35bp0iZciAmYZQ117NLbrB9v8jRol7MwC6Oymbuq OrIX+4A7nHocPZE/MDiempM8K7PFxkoqQOxDLogFPcB8JYEHCK7fi5yHNyCfJ5zAMmQPJUMzBqo yL1qGfmeaIV2hz/Dc6sjFUwXn9mqQi6J6Jel8k3KhQeg9H9pjZZ72tOUJbaLtWnWgoOx1rld6+C i6p1LMWu98mFyYjfjn42YOXUpTjjwYmZNltU86l83nZG1qLEMhdnRZyQ4TkD5qGY+OXzQsU2ndC Q5/nSA1XJK/N8LynKCdIDTW4bTP36Bqm1F8ZVFb0I1BclzDyHH09bEPQ+wY2PzQ84PzdsGV6ryV 46lqij+lFxc8EkGkFahfvv6UDVAmyKQwo0NVvxy8SQHmPNQ== X-Received: by 2002:a05:6000:1841:b0:48e:6f76:de9d with SMTP id ffacd0b85a97d-4d1ea69e39bmr6961560f8f.46.1796417458301; Fri, 04 Dec 2026 12:50:58 -0800 (PST) Sender: Frediano Ziglio From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: Frediano Ziglio , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie Subject: [PATCH 06/11] x86/boot: Use stack to remove a relocation from trampoline code Date: Fri, 4 Dec 2026 20:50:39 +0000 Message-ID: <20261204205045.596093-7-freddy77@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261204205045.596093-1-freddy77@gmail.com> References: <20261204205045.596093-1-freddy77@gmail.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-purgate-ID: tlsNG-ebf023/1796417459-50AD8B50-23E72EDA/0/0 X-purgate-type: clean X-purgate-size: 1967 X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 The destination selector is computed from a GDT entry. The stack is setup anyway to allow calling real mode interrupts. Signed-off-by: Frediano Ziglio --- xen/arch/x86/boot/trampoline.S | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S index c52c27795d..faa5bb9e30 100644 --- a/xen/arch/x86/boot/trampoline.S +++ b/xen/arch/x86/boot/trampoline.S @@ -27,13 +27,6 @@ .long 111b - (off) - .; \ .popsection -#define bootsym_segrel(sym, off) \ - $0,$bootsym(sym); \ -111:; \ - .pushsection .trampoline_seg, "a"; \ - .long 111b - (off) - .; \ - .popsection - /* Start of the permanent trampoline code. */ .code16 @@ -210,6 +203,9 @@ trampoline_boot_cpu_entry: mov %eax,%gs mov %eax,%ss + /* Initialise stack pointer. */ + xor %esp, %esp + /* Switch to pseudo-rm CS, enter real mode, and flush insn queue. */ mov %cr0,%eax dec %eax @@ -218,14 +214,16 @@ trampoline_boot_cpu_entry: 1: mov %eax,%cr0 # CR0.PE = 0 (leave protected mode) /* Load proper real-mode values into %cs, %ds, %es and %ss. */ - ljmp bootsym_segrel(1f,2) -1: mov %cs,%ax - mov %ax,%ds + mov bootsym(trampoline_gdt)+BOOT_PSEUDORM_DS+3, %ax + shl $4, %ax + pushw %ax + pushw $bootsym(1f) + lretw +1: mov %ax,%ds mov %ax,%es mov %ax,%ss - /* Initialise stack pointer and IDT, and enable irqs. */ - xor %esp,%esp + /* Initialise IDT, and enable irqs. */ lidt bootsym(rm_idt) sti -- 2.43.0