From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.groups.io with SMTP id smtpd.web11.9331.1612537382930882578 for ; Fri, 05 Feb 2021 07:03:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QBReL+xD; spf=pass (domain: redhat.com, ip: 63.128.21.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612537382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cwQDyCM3Daw8pF4gQlxU/u+3FSw1hqWRZmt/HmQVWSc=; b=QBReL+xDP06FLKm2dU2muafVVuNo7dBtk//EP0R1NgGvUYEfOwy09G5rU+GLl6mXT+q2Bj JJD7d0WHeHNjbS+lb04k0MUq11IsOHlV8nlY7/vDzdQF0QpoqxKcb77ev2T3wfB+z/N+LV dmO3cj0FrJJmMJh5G5UbsziAkYEvcME= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-222-yufyhnlVNUebICfPIpDkSw-1; Fri, 05 Feb 2021 10:02:58 -0500 X-MC-Unique: yufyhnlVNUebICfPIpDkSw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 306EE80364B; Fri, 5 Feb 2021 15:02:57 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-245.ams2.redhat.com [10.36.113.245]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B16B5D6AB; Fri, 5 Feb 2021 15:02:54 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v2 1/3] MdePkg/Nasm.inc: add macros for C types used in structure definition To: devel@edk2.groups.io, ray.ni@intel.com Cc: Michael D Kinney , Liming Gao , Zhiguang Liu References: <20210205075810.981-1-ray.ni@intel.com> <20210205075810.981-2-ray.ni@intel.com> From: "Laszlo Ersek" Message-ID: <3d1e6971-20b5-33fd-dc96-1a058d802b13@redhat.com> Date: Fri, 5 Feb 2021 16:02:54 +0100 MIME-Version: 1.0 In-Reply-To: <20210205075810.981-2-ray.ni@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 02/05/21 08:58, Ni, Ray wrote: > Signed-off-by: Ray Ni > Cc: Michael D Kinney > Cc: Liming Gao > Cc: Zhiguang Liu > --- > MdePkg/Include/Ia32/Nasm.inc | 38 ++++++++++++++++++++++++++++++++++++ > MdePkg/Include/X64/Nasm.inc | 38 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 76 insertions(+) > > diff --git a/MdePkg/Include/Ia32/Nasm.inc b/MdePkg/Include/Ia32/Nasm.inc > index 31ce861f1e..017fe5ffd8 100644 > --- a/MdePkg/Include/Ia32/Nasm.inc > +++ b/MdePkg/Include/Ia32/Nasm.inc > @@ -20,3 +20,41 @@ > %macro INCSSP_EAX 0 > DB 0xF3, 0x0F, 0xAE, 0xE8 > %endmacro > + > +; NASM provides built-in macros STRUC and ENDSTRUC for structure definition. > +; For example, to define a structure called mytype containing a longword, > +; a word, a byte and a string of bytes, you might code > +; > +; struc mytype > +; > +; mt_long: resd 1 > +; mt_word: resw 1 > +; mt_byte: resb 1 > +; mt_str: resb 32 > +; > +; endstruc > +; > +; Below macros are help to map the C types and the RESB family of pseudo-instructions. > +; So that the above structure definition can be coded as > +; > +; struc mytype > +; > +; mt_long: CTYPE_UINT32 1 > +; mt_word: CTYPE_UINT16 1 > +; mt_byte: CTYPE_UINT8 1 > +; mt_str: CTYPE_CHAR8 32 > +; > +; endstruc > +%define CTYPE_UINT64 resq > +%define CTYPE_INT64 resq > +%define CTYPE_UINT32 resd > +%define CTYPE_INT32 resd > +%define CTYPE_UINT16 resw > +%define CTYPE_INT16 resw > +%define CTYPE_BOOLEAN resb > +%define CTYPE_UINT8 resb > +%define CTYPE_CHAR8 resb > +%define CTYPE_INT8 resb > + > +%define CTYPE_UINTN resd > +%define CTYPE_INTN resd > diff --git a/MdePkg/Include/X64/Nasm.inc b/MdePkg/Include/X64/Nasm.inc > index 42412735ea..b48d8680bb 100644 > --- a/MdePkg/Include/X64/Nasm.inc > +++ b/MdePkg/Include/X64/Nasm.inc > @@ -20,3 +20,41 @@ > %macro INCSSP_RAX 0 > DB 0xF3, 0x48, 0x0F, 0xAE, 0xE8 > %endmacro > + > +; NASM provides built-in macros STRUC and ENDSTRUC for structure definition. > +; For example, to define a structure called mytype containing a longword, > +; a word, a byte and a string of bytes, you might code > +; > +; struc mytype > +; > +; mt_long: resd 1 > +; mt_word: resw 1 > +; mt_byte: resb 1 > +; mt_str: resb 32 > +; > +; endstruc > +; > +; Below macros are help to map the C types and the RESB family of pseudo-instructions. > +; So that the above structure definition can be coded as > +; > +; struc mytype > +; > +; mt_long: CTYPE_UINT32 1 > +; mt_word: CTYPE_UINT16 1 > +; mt_byte: CTYPE_UINT8 1 > +; mt_str: CTYPE_CHAR8 32 > +; > +; endstruc > +%define CTYPE_UINT64 resq > +%define CTYPE_INT64 resq > +%define CTYPE_UINT32 resd > +%define CTYPE_INT32 resd > +%define CTYPE_UINT16 resw > +%define CTYPE_INT16 resw > +%define CTYPE_BOOLEAN resb > +%define CTYPE_UINT8 resb > +%define CTYPE_CHAR8 resb > +%define CTYPE_INT8 resb > + > +%define CTYPE_UINTN resq > +%define CTYPE_INTN resq > Reviewed-by: Laszlo Ersek