From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5B7A02194EB7A for ; Wed, 20 Feb 2019 01:47:05 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B3012C7E89; Wed, 20 Feb 2019 09:47:03 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-220.rdu2.redhat.com [10.10.120.220]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F9C527188; Wed, 20 Feb 2019 09:46:55 +0000 (UTC) To: Andrew Fish Cc: Jordan Justen , edk2-devel@lists.01.org, Anthony Perard , Peter Fang References: <20190218101015.23399-1-jordan.l.justen@intel.com> <8426BEC3-E35D-45D2-9632-4C33817D4B36@apple.com> From: Laszlo Ersek Message-ID: Date: Wed, 20 Feb 2019 10:46:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <8426BEC3-E35D-45D2-9632-4C33817D4B36@apple.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 20 Feb 2019 09:47:04 +0000 (UTC) Subject: Re: [PATCH] OvmfPkg/Sec: Clear the Cache Disable flag in the CR0 register X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 09:47:05 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 02/19/19 20:51, Andrew Fish wrote: > > >> On Feb 18, 2019, at 5:23 AM, Laszlo Ersek wrote: >> >> generic comment (applies to all NASM usage I guess): >> >> On 02/18/19 11:10, Jordan Justen wrote: >> >>> + mov eax, cr0 >>> + and eax, ~(1 << 30) >>> + mov cr0, eax >> >>> + mov rax, cr0 >>> + and eax, ~(1 << 30) >>> + mov cr0, rax >> >> I've read up on the << and ~ operators in the NASM documentation, and I >> think the above build-time calculations of the masks are well-defined >> and correct. >> >> - bit shifts are always unsigned >> - given bit position 30, ~(1 << 30) will be a value with 32 bits >> - bit-neg simply flips bits (one's complement) >> >> On the other hand, I find these NASM specifics counter-intuitive. The >> expression ~(1 << 30) looks like valid C, but in C, it means a quite >> different thing. >> >> I think calculating the mask with "strict dword" somehow (not exactly >> sure how) would make this more readable; or else the BTR instruction would. >> >> Opinions? (Again, pertaining to all NASM usage in edk2.) >> > > Lazlo, > > I guess comments, or #defines, are other options? Good point! They are. Thanks, Laszlo > Thanks, > > Andrew Fish > >> Thanks >> Laszlo >> _______________________________________________ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel >