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 6F807CCF9E9 for ; Thu, 26 Sep 2024 06:50:38 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.804941.1215927 (Exim 4.92) (envelope-from ) id 1stiKb-000588-Ma; Thu, 26 Sep 2024 06:50:29 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 804941.1215927; Thu, 26 Sep 2024 06:50:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1stiKb-000581-Jx; Thu, 26 Sep 2024 06:50:29 +0000 Received: by outflank-mailman (input) for mailman id 804941; Thu, 26 Sep 2024 06:50:28 +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 1stiKa-0004pX-L3 for xen-devel@lists.xenproject.org; Thu, 26 Sep 2024 06:50:28 +0000 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [2a00:1450:4864:20::22c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9d57570e-7bd3-11ef-a0ba-8be0dac302b0; Thu, 26 Sep 2024 08:50:28 +0200 (CEST) Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2f8ca33ef19so8047791fa.2 for ; Wed, 25 Sep 2024 23:50:28 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9392f34291sm318266466b.14.2024.09.25.23.50.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Sep 2024 23:50:27 -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" X-Inumbo-ID: 9d57570e-7bd3-11ef-a0ba-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1727333427; x=1727938227; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=wgoi8CYH125Xpf+L61ZN42o44y9/8eYrWERuvEtkdQw=; b=BL7750WaNUCtvuB5UtkMg0M4dS9RjKqKAITSLMf3zF7Y1+PBrz7rWfdX+ZxL7y6dcq pliAmNU6oHBmBRBANTh7jNgt6ASudz+B440PWYGVxrx5igssUDKUwy1mmsmzsNVlnImo QTQW49ma0NwJHdAg2WNOxi6GfaiovN732Gh+r24A7elIY6rFg5ObYgfZOIb4sFfmKuZf 1dJCem8UZ2Y0/y4k+shw9gtqPbc1pQPzfDRyxDWhAG1Sz1uQa+KFMBkJtbHj7qwQeWQe 3QDCCkaK8+7xklptvu9EHv3ZnHqwjjSqSUOR+g/b9Sm3SzTijsNF8F61PYbyWxLh1XVR exXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727333427; x=1727938227; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wgoi8CYH125Xpf+L61ZN42o44y9/8eYrWERuvEtkdQw=; b=nJ3P+H+lMdsZBMhl1HFxFFbBI1H9NWbpZkpgrQX8Qxu9GXnutmu8ed4juv0HFNG0Uu OCcyEJ8YxKbnInW7gNof9SiKWZ9OewpxTyzQRqWp3+bdM9OfO8ouvE4+Q69Vjvd2mmRn Zyh0ab7csZsbUXNHNvLoV3ER+dx4wqDBkKLYpf+NqL9ZWKAq2nBbk/c5KO4Mdq3siYR6 a84zSalrTv0kMthh12MzraoHTUtDbbdFxJWnoKFb5ClP3s2767zMF8QElqM8c00cazjX cjYOyHPOuZDm3HHFHVEdzFIo9BYjIKfE73XdVvon7aR6FA9Rkcahb0+7Wu4UANU4FbH9 kmqA== X-Forwarded-Encrypted: i=1; AJvYcCWvT1nabrhfUG5dHgEyxBzLM+J2K/+oDTOijvA/j7AtV+TCCeHhEqTs8uGyYXWHu4OtIEqRU4lCSrE=@lists.xenproject.org X-Gm-Message-State: AOJu0YzuexjCXaylkcuoGwR/Bt4YY5lyhkeYqXB0dWmaLSx9c+P0UXYK TEGkjPhTcykcj+oQ19Dl3qIlvLbNsXI33tuW4vnahvK8mYoADrZQXUeVQ9xDtg== X-Google-Smtp-Source: AGHT+IElBa1AeusaJ7Rc+EYN40MevDb4JqaRXy9GSmz4m1lAkuyebAviUYmtpq/8QpnvKiqHR/sQPw== X-Received: by 2002:a2e:a543:0:b0:2f6:6198:1cfa with SMTP id 38308e7fff4ca-2f91ca4a9a2mr46958151fa.41.1727333427416; Wed, 25 Sep 2024 23:50:27 -0700 (PDT) Message-ID: <2c550860-97fc-487d-9799-e543de15fff7@suse.com> Date: Thu, 26 Sep 2024 08:50:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 2/4] x86/boot: Refactor BIOS/PVH start To: Andrew Cooper Cc: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , Frediano Ziglio , xen-devel@lists.xenproject.org References: <20240925060101.259244-1-frediano.ziglio@cloud.com> <20240925060101.259244-3-frediano.ziglio@cloud.com> <88189db4-c89c-430d-b96f-46259993fb5e@citrix.com> Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6z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/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <88189db4-c89c-430d-b96f-46259993fb5e@citrix.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 25.09.2024 21:33, Andrew Cooper wrote: > On 25/09/2024 7:00 am, Frediano Ziglio wrote: >> @@ -449,62 +458,40 @@ __pvh_start: >> mov %ecx, %es >> mov %ecx, %ss >> >> - /* Skip bootloader setup and bios setup, go straight to trampoline */ >> - movb $1, sym_esi(pvh_boot) >> - movb $1, sym_esi(skip_realmode) >> + /* Load null selector to unused segment registers. */ >> + xor %ecx, %ecx >> + mov %ecx, %fs >> + mov %ecx, %gs > > Honestly, the more I look at this, the more bizarre it is. > > We should just set up %fs/gs like we do %ds/es, which in this case is > simply to drop the comment and the xor. What's bizarre here? As long as we don't use %fs/%gs, it doesn't matter much what we set them to. So yes, they may be set to what %ds etc are set to, but they may as well be marked unusable. Documentation-wise that's cleaner imo, as down the road - when a need to use one arises - it then won't require auditing of all code to figure where the register(s) is(are) actually used (just to find: nowhere). Even if a comment to this effect was left here, I for one wouldn't trust it in a couple of years time, but rather fear it went stale. Jan