From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by mx.groups.io with SMTP id smtpd.web11.8379.1679297480912835866 for ; Mon, 20 Mar 2023 00:31:20 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dzJIzBJM; spf=pass (domain: gmail.com, ip: 209.85.216.47, mailfrom: pedro.falcato@gmail.com) Received: by mail-pj1-f47.google.com with SMTP id fy10-20020a17090b020a00b0023b4bcf0727so11440798pjb.0 for ; Mon, 20 Mar 2023 00:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679297480; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+t9LGtziUktYfrXeWuzGKerbOH+HjVxZMLmlPmCyywE=; b=dzJIzBJM5CjnaUzTCmmUbSdkHZhPLHa5KT3T+3lwrU/wJsIwKq1qgJaFgocrfJXYoP U3ELGAgvyfvaGQrDNQkwjAl4dc2wtyqzQIpoDxonFIKgAYPlFHmcUtRFP4pk37eaafQU A7UlCVA1gN4Cu35guIr5ycPJuiszcHjjnd0x0NxYGmbO9vqKIIqrmn1Y+yw67SUcKLNC n0cs9/4hxZbvKjd0h65mSXJ8ZaGyb91OVnUH+60bC0CfeHR4m8ZPr3OR8TdJKUXiMT+W LaCgzT5mn5eFwR92ZatCtCHDX3n9w76Dkgu4HLQLp3HTDy8kqCPGgC4zb5QA3KV6SXo0 pVyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679297480; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+t9LGtziUktYfrXeWuzGKerbOH+HjVxZMLmlPmCyywE=; b=liCNtEowT0cWfQk5XbA2EewNbzo89mC9nNemdZTLGMH38hCkZw50yalzwvYIGFYYfL cDgksku3AbifUgxE8oxEC0pv4uoashHZvoy8HWYDrvu20aNgpfuQ0wHqHfk+o7f0l16n VfQcRdSoqPKoiSWNDEmy70KXYoXhKkV3L291lZyJUBtYl0Klf0Lg0pq6lN7DJWwydH9S w5Hf6PSz1/KEx/tiAIZ40nOUui7X5mg0w4DkJA3Ebx4MZjx76pLqm9Ll2ECelP+EHW4E XbgVi+xnUsSE6ibh9IxyWGcMc78ZuQcNjL3XrekRd8FFXVsS50cVgmUAQaA0A6jeNJMJ 22xQ== X-Gm-Message-State: AO0yUKWsBi/OIpHnq58h6c4jlqdJA5kfLG4vJzQgjH425bLe5pEjUdlQ jOkjanKw5PBr2JzyHydHKj5Mw5Q/nr1bbNHALEFtosMBNVQ= X-Google-Smtp-Source: AK7set8mBG7c5LzkOZpMwAQ/8hATFJSPRw/68J+fFZ9rly148XTRvQJkMgzPx1XPwtdR/MMlyKgiZuOWb2XAgduXRG0= X-Received: by 2002:a17:90b:3183:b0:236:6e4c:8a1e with SMTP id hc3-20020a17090b318300b002366e4c8a1emr4333695pjb.1.1679297479964; Mon, 20 Mar 2023 00:31:19 -0700 (PDT) MIME-Version: 1.0 References: <20230317172050.1228-1-chasel.chiu@intel.com> In-Reply-To: From: "Pedro Falcato" Date: Mon, 20 Mar 2023 07:31:08 +0000 Message-ID: Subject: Re: [edk2-devel] [PATCH v2] IntelFsp2Pkg: Fix NASM X64 build warnings. To: devel@edk2.groups.io, ray.ni@intel.com Cc: "Chiu, Chasel" , "Desimone, Nathaniel L" , "Zeng, Star" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Mar 20, 2023 at 6:03=E2=80=AFAM Ni, Ray wrote: > > > ASM_PFX(FspInfoHeaderRelativeOff): > > > > DD 0x12345678 ; This value must be patched by the = build script > > > > - and rax, 0xffffffff > > > > + mov eax, eax ; equal to and rax, 0xFFFFFFFF > > Based on the discussion, we know "mov eax, eax" clears upper 32bits of RA= X. > But this code looks very confusing. Is there any other instruction that c= an do the same thing? Hi Ray, Any instruction that writes to the lower 32-bits should zero the upper bits= . (Pardon my AT&T syntax, just reverse the operands for Intel syntax) and $0xffffffff,%eax gets you a 3 byte opcode (since imm8 is signed, you only need 0xff as the immediate) and %eax, %eax gets you 2 bytes mov %eax, %eax gets you 2 bytes even something silly like adding 0 to EAX should work. But in a pure efficiency+size POV, the last 2 instructions should be optimal. --=20 Pedro