From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com []) by mx.groups.io with SMTP id smtpd.web08.10652.1612880197811148740 for ; Tue, 09 Feb 2021 06:16:41 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: ray.ni@intel.com) IronPort-SDR: AI5mbj53P9VIhScCkNDYjOITVuBPzxv6kKJFaEchEUdjdCcur7NqSG17lw3LK+dbjll9agA/W6 XNV40dj1MWdg== X-IronPort-AV: E=McAfee;i="6000,8403,9889"; a="200959149" X-IronPort-AV: E=Sophos;i="5.81,165,1610438400"; d="scan'208";a="200959149" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2021 06:16:40 -0800 IronPort-SDR: KL17KKdctLme+k4uHW4zBB2ABQUD6tvN9EByUI8G/9hxJ0DU6SyG1K/lSqI4t50rwbdygrbzuw xO8CxFFF4J6g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,165,1610438400"; d="scan'208";a="374969184" Received: from ray-dev.ccr.corp.intel.com ([10.239.158.87]) by orsmga002.jf.intel.com with ESMTP; 09 Feb 2021 06:16:39 -0800 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [PATCH v3 2/4] MdePkg/Nasm.inc: add macros for C types used in structure definition Date: Tue, 9 Feb 2021 22:16:32 +0800 Message-Id: <20210209141634.1999-3-ray.ni@intel.com> X-Mailer: git-send-email 2.27.0.windows.1 In-Reply-To: <20210209141634.1999-1-ray.ni@intel.com> References: <20210209141634.1999-1-ray.ni@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=0D DB 0xF3, 0x0F, 0xAE, 0xE8=0D %endmacro=0D +=0D +; NASM provides built-in macros STRUC and ENDSTRUC for structure definitio= n.=0D +; For example, to define a structure called mytype containing a longword,= =0D +; a word, a byte and a string of bytes, you might code=0D +;=0D +; struc mytype =0D +;=0D +; mt_long: resd 1 =0D +; mt_word: resw 1 =0D +; mt_byte: resb 1 =0D +; mt_str: resb 32 =0D +;=0D +; endstruc=0D +;=0D +; Below macros are help to map the C types and the RESB family of pseudo-i= nstructions.=0D +; So that the above structure definition can be coded as=0D +;=0D +; struc mytype =0D +;=0D +; mt_long: CTYPE_UINT32 1 =0D +; mt_word: CTYPE_UINT16 1 =0D +; mt_byte: CTYPE_UINT8 1 =0D +; mt_str: CTYPE_CHAR8 32 =0D +;=0D +; endstruc=0D +%define CTYPE_UINT64 resq=0D +%define CTYPE_INT64 resq=0D +%define CTYPE_UINT32 resd=0D +%define CTYPE_INT32 resd=0D +%define CTYPE_UINT16 resw=0D +%define CTYPE_INT16 resw=0D +%define CTYPE_BOOLEAN resb=0D +%define CTYPE_UINT8 resb=0D +%define CTYPE_CHAR8 resb=0D +%define CTYPE_INT8 resb=0D +=0D +%define CTYPE_UINTN resd=0D +%define CTYPE_INTN resd=0D 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=0D DB 0xF3, 0x48, 0x0F, 0xAE, 0xE8=0D %endmacro=0D +=0D +; NASM provides built-in macros STRUC and ENDSTRUC for structure definitio= n.=0D +; For example, to define a structure called mytype containing a longword,= =0D +; a word, a byte and a string of bytes, you might code=0D +;=0D +; struc mytype =0D +;=0D +; mt_long: resd 1 =0D +; mt_word: resw 1 =0D +; mt_byte: resb 1 =0D +; mt_str: resb 32 =0D +;=0D +; endstruc=0D +;=0D +; Below macros are help to map the C types and the RESB family of pseudo-i= nstructions.=0D +; So that the above structure definition can be coded as=0D +;=0D +; struc mytype =0D +;=0D +; mt_long: CTYPE_UINT32 1 =0D +; mt_word: CTYPE_UINT16 1 =0D +; mt_byte: CTYPE_UINT8 1 =0D +; mt_str: CTYPE_CHAR8 32 =0D +;=0D +; endstruc=0D +%define CTYPE_UINT64 resq=0D +%define CTYPE_INT64 resq=0D +%define CTYPE_UINT32 resd=0D +%define CTYPE_INT32 resd=0D +%define CTYPE_UINT16 resw=0D +%define CTYPE_INT16 resw=0D +%define CTYPE_BOOLEAN resb=0D +%define CTYPE_UINT8 resb=0D +%define CTYPE_CHAR8 resb=0D +%define CTYPE_INT8 resb=0D +=0D +%define CTYPE_UINTN resq=0D +%define CTYPE_INTN resq=0D --=20 2.27.0.windows.1