From nobody Wed Apr 24 21:15:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1565622714; cv=none; d=zoho.com; s=zohoarc; b=BA05J4gnMBuczviJ8K41LTkALrj6c2d5ZYUQN3K10I+H1GoXlZo/JY/x4v1o4au04LIwzhGAjfWBEME6Q8JfU4us2uphH/xuB0IYe1uSO9FNJ6JhJPIPnIzj19hyuipF0dWqzKpH1iOyNUS0WCiugo6lc0k72GKHMI/tcKFd75k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565622714; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=L2vtCzFjLooGPTEBSBRtPwWweN/zIbpf/Y9y0Ts8Be0=; b=cBdAXkGNY1eNNMEU4RngaHaxatjuKhpgHKjwNaHR51f3OQGzWEoZIHHZUBZUZs2msSWEhq8BWi1LSqiEI/PhG7yY3Y6NxAdgZ9kzjtfDPcWeinyE6yMgoTAMTf5dr2FEPkeNU7lyvs5dcmiVC1JnHtrDDBdp8cKqHcIbNA+zP48= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1565622714561385.49435187323627; Mon, 12 Aug 2019 08:11:54 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hxBy5-0003CQ-8o; Mon, 12 Aug 2019 15:10:41 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hxBy4-0003CL-Fc for xen-devel@lists.xenproject.org; Mon, 12 Aug 2019 15:10:40 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 57dbaf20-bd13-11e9-8980-bc764e045a96; Mon, 12 Aug 2019 15:10:39 +0000 (UTC) X-Inumbo-ID: 57dbaf20-bd13-11e9-8980-bc764e045a96 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1565622639; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=q2JqmZk2jqxaTBSHkx6vRl9fE0darY5Lhc4lnnaCh6Y=; b=K3OXpLB1Ep/x3OtRxaJNX7TvQlf0Yahfuty7/H13VwOy5co8vZvOgJnG MDf3nJXRTz2A7K8i1Qyr9TYcyfZrLRWqorQNbDGETVkEyC2wlB2gplnav AQqEje2c5DWG7Hbxv4BGyy6LIaKPbgqodPsEIbJQR8Z9eTnyLWrKCoeqI E=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: +7JtekCMLAERiS3ApszJEFmNe7uBpx0mhNQJpa4eIyvtQ052DGQa6w5Np4mEl1X8iCXbZ2g0TO wV2l7VjYNAjhfiIs/1nbia4iGc7RMbrRr+Tfe88joqkn8lrFI3zc4K0tj08jcjrsSwC+kx0OlG km0vqIeqPp/uqI6hfFTV7Cc+JL35ejpj/VbtMJlFcXJ8uDQCb4KFAH4xDENkiON70KmrXJtNUX zmqAxI3JFXVclZ3bPhj+SXRkAN+J1D64zUJib6pa1B+9w9QvsjS89GWHwEyIBttxwRCDfyVvzb WEU= X-SBRS: 2.7 X-MesageID: 4171881 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,377,1559534400"; d="scan'208";a="4171881" From: Andrew Cooper To: Xen-devel Date: Mon, 12 Aug 2019 16:10:32 +0100 Message-ID: <20190812151032.9353-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86/boot: Simplify %fs setup in trampoline_setup X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) mov/shr is easier to follow than shld, and doesn't have a merge dependency = on the previous value of %edx. Shorten the rest of the code by streamlining t= he comments. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Reviewed-by: Wei Liu --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 In addition to being clearer to follow, mov/shr is faster than shld to deco= de and execute. See https://godbolt.org/z/A5kvuC for the latency/throughput/p= ort analysis, the Intel Optimisation guide which classifes them as "Slow Int" instructions, or the AMD Optimisation guide which specifically has a section entitled "Alternatives to SHLD Instruction". --- xen/arch/x86/boot/head.S | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 782deac0d4..26b680521d 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -556,24 +556,17 @@ trampoline_setup: /* * Called on legacy BIOS and EFI platforms. * - * Initialize bits 0-15 of BOOT_FS segment descriptor base address. + * Set the BOOT_FS descriptor base address to %esi. */ - mov %si,BOOT_FS+2+sym_esi(trampoline_gdt) - - /* Initialize bits 16-23 of BOOT_FS segment descriptor base addres= s. */ - shld $16,%esi,%edx - mov %dl,BOOT_FS+4+sym_esi(trampoline_gdt) - - /* Initialize bits 24-31 of BOOT_FS segment descriptor base addres= s. */ - mov %dh,BOOT_FS+7+sym_esi(trampoline_gdt) - - /* - * Initialize %fs and later use it to access Xen data where possib= le. - * According to Intel 64 and IA-32 Architectures Software Develope= r's - * Manual it is safe to do that without reloading GDTR before. - */ - mov $BOOT_FS,%edx - mov %edx,%fs + mov %esi, %edx + shr $16, %edx + mov %si, BOOT_FS + 2 + sym_esi(trampoline_gdt) /* Bits 0-15 */ + mov %dl, BOOT_FS + 4 + sym_esi(trampoline_gdt) /* Bits 16-23 */ + mov %dh, BOOT_FS + 7 + sym_esi(trampoline_gdt) /* Bits 24-31 */ + + /* Load %fs to allow for access to Xen data. */ + mov $BOOT_FS, %edx + mov %edx, %fs =20 /* Save Xen image load base address for later use. */ mov %esi,sym_fs(xen_phys_start) --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel