From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com []) by mx.groups.io with SMTP id smtpd.web09.5115.1612511895936364606 for ; Thu, 04 Feb 2021 23:58:16 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: ray.ni@intel.com) IronPort-SDR: AhrkeeQKOSC445ndQwRx0l35qNzv7WLte5fSAkFaq4oDNzpwfKiwf04UJrr+6jquUsGvOX5oQE EsC6NJkCqJTw== X-IronPort-AV: E=McAfee;i="6000,8403,9885"; a="242902235" X-IronPort-AV: E=Sophos;i="5.81,154,1610438400"; d="scan'208";a="242902235" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 23:58:15 -0800 IronPort-SDR: 5hpWMCyZq9uGCg7ON7RzrGHqewkCw2Ywy4Ch8wc7yF7hqkuyaYzNtSqG0HsgYqL6aqebJLaist X/XVo/Bpl1/g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,154,1610438400"; d="scan'208";a="434322766" Received: from ray-dev.ccr.corp.intel.com ([10.239.158.87]) by orsmga001.jf.intel.com with ESMTP; 04 Feb 2021 23:58:14 -0800 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [PATCH v2 1/3] MdePkg/Nasm.inc: add macros for C types used in structure definition Date: Fri, 5 Feb 2021 15:58:08 +0800 Message-Id: <20210205075810.981-2-ray.ni@intel.com> X-Mailer: git-send-email 2.27.0.windows.1 In-Reply-To: <20210205075810.981-1-ray.ni@intel.com> References: <20210205075810.981-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