From nobody Sun Nov 24 04:51:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=cloud.com ARC-Seal: i=1; a=rsa-sha256; t=1723624521; cv=none; d=zohomail.com; s=zohoarc; b=NC68VKFiSESY3AbOMsRjFajdag1PJQAb+iFDW6m/EJGVbmdWPDjZaARyMy+iJdSVcB3EflrMWaC7ChjU+8KMJIZI5evBHoQlqVneWx7Ri2eJyoNy/WRQEWPb1Y60yVH6o8nV7Tj4NHOiKBvsfW94ArQddNJYgQ/LlgsIO9H7/ww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723624521; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8cx+yFVCJfgxWpnsCCMINuRQ/ctq1Ga1ijOLJ+Mk9mo=; b=Tlin/lKjn/mDAz04Nv5IhCQZensw3Ucx1/Zn5eggVRs14wTKg2U/zLFjvoZ+MSCqq+yHlGDe72VODWBL9ZlbiqLXUn/XkKgmpBzmJdnTSIzjttrdJKTaAbumNmH/hwTe4sFT0cMyMRLpxjr4Ck3DOQEh26Y6tRshQ/OstSgWrY4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1723624521901205.54415518259657; Wed, 14 Aug 2024 01:35:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.776851.1187066 (Exim 4.92) (envelope-from ) id 1se9TD-0004qh-LH; Wed, 14 Aug 2024 08:35:03 +0000 Received: by outflank-mailman (output) from mailman id 776851.1187066; Wed, 14 Aug 2024 08:35:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1se9TD-0004qW-HB; Wed, 14 Aug 2024 08:35:03 +0000 Received: by outflank-mailman (input) for mailman id 776851; Wed, 14 Aug 2024 08:35:02 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1se9TC-0002t1-1Q for xen-devel@lists.xenproject.org; Wed, 14 Aug 2024 08:35:02 +0000 Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [2607:f8b0:4864:20::72c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 18748825-5a18-11ef-a505-bb4a2ccca743; Wed, 14 Aug 2024 10:35:01 +0200 (CEST) Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-7a1dac7f0b7so433371885a.0 for ; Wed, 14 Aug 2024 01:35:01 -0700 (PDT) Received: from fziglio-xenia-fedora.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a4c7e05595sm407786785a.122.2024.08.14.01.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 01:34:59 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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" X-Inumbo-ID: 18748825-5a18-11ef-a505-bb4a2ccca743 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1723624500; x=1724229300; 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=8cx+yFVCJfgxWpnsCCMINuRQ/ctq1Ga1ijOLJ+Mk9mo=; b=az8blai454zBbhhrTHV6Kk0zNQXleVGKjhEpAfDMNQ4gOaR3TyIDLIewHInPiL+MMz sIv5m1zqwWNfq4AxeRGinH8Ji7zv5kbhX1oDtsKpdxUNNWXyVUpfVmFNp8etNIBX7U0E /aoUBk4aRC69/GiPlCb7/ubwAuZ7n3Rt8awDY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723624500; x=1724229300; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8cx+yFVCJfgxWpnsCCMINuRQ/ctq1Ga1ijOLJ+Mk9mo=; b=sC0NKDKJq+QC1mbucCmP6D1yLegdb28k8Ot9aWRpjyz2ErKCTkTqxJtU8aQ06ELg9z cOqxqMpEWWdH4iGIjDpx2XNSuygyjj80k4g8KJ91NK1BqgAOXw+1r0dJrD8UyXZsxNBh 0K3/Qr2KhxoDZBBeChsImpHMVT17t/hezRBGhck4jqE7SyosYOVLvlh6UThV2lZmHntN DmIhr16Knnjkmj3xSrJwnlAAQR9klVwpxsOnBLtT7BIOENtEdkvGEZhNPe31152ZXItd tEzQkmlnbqD2VKtO2zKxOr2giXUGEkdfQSN9ZrdWcpFttbQzRlFHvIlhSwyn7Asjn0jR z+MQ== X-Gm-Message-State: AOJu0YxAFTt81phoaOMmR8fKfxsS23Hfb4PgT9zaMjVz/JNHwkqD2pya fipAP3OwEaL86HMQWwh+iLDN/NLj/INacItRBHbRtAZbX36gWXvBWoKuf4lOUzqB9fx0AwdwAjQ / X-Google-Smtp-Source: AGHT+IH9FUz7tjCeqZVLYlglNRnjlEx+UsjubjRMdy3lW/lyF98I7fqJhsyulPcCyllSixJ04vyVjA== X-Received: by 2002:a05:620a:28c1:b0:79f:9b5:ff78 with SMTP id af79cd13be357-7a4ee33c969mr246582985a.34.1723624500146; Wed, 14 Aug 2024 01:35:00 -0700 (PDT) From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: Frediano Ziglio , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v2 4/5] x86: Compensate relocation in case of EFI Date: Wed, 14 Aug 2024 09:34:13 +0100 Message-ID: <20240814083428.3012-5-frediano.ziglio@cloud.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240814083428.3012-1-frediano.ziglio@cloud.com> References: <20240814083428.3012-1-frediano.ziglio@cloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @cloud.com) X-ZM-MESSAGEID: 1723624522147116600 Content-Type: text/plain; charset="utf-8" If code is loaded by EFI the loader will relocate the image under 4GB. This causes offsets in x86 code generated by sym_offs(SYMBOL) to be relocated too (basically they won't be offsets from image base). In order to get wanted address when using sym_offs an sym_esi compensate the difference in %esi. Signed-off-by: Frediano Ziglio --- xen/arch/x86/boot/head.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- Changes since v1: - Completely different way to cope with the issue, much more easier. diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 666e341bc5..86805389f9 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -380,7 +380,8 @@ x86_32_switch: lgdt gdt_boot_descr(%rip) =20 /* Store Xen image load base address in place accessible for 32-bi= t code. */ - lea __image_base__(%rip),%esi + lea __image_base__(%rip), %esi + sub $sym_offs(__image_base__), %esi =20 /* Reload code selector. */ pushq $BOOT_CS32 --=20 2.45.2