]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg/Nasm.inc: add macros for C types used in structure definition
authorRay Ni <ray.ni@intel.com>
Fri, 5 Feb 2021 05:15:42 +0000 (13:15 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 8 Mar 2021 02:22:37 +0000 (02:22 +0000)
Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
MdePkg/Include/Ia32/Nasm.inc
MdePkg/Include/X64/Nasm.inc

index fa42f9d3e99b5d210700d55b2a23a137948c91c4..c794d9ece3774510125a40eb6d30aea2a9382bfc 100644 (file)
@@ -1,6 +1,6 @@
 ;------------------------------------------------------------------------------\r
 ;\r
-; Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>\r
 ; SPDX-License-Identifier: BSD-2-Clause-Patent\r
 ;\r
 ; Abstract:\r
 %macro INCSSP_EAX      0\r
     DB 0xF3, 0x0F, 0xAE, 0xE8\r
 %endmacro\r
+\r
+; NASM provides built-in macros STRUC and ENDSTRUC for structure definition.\r
+; For example, to define a structure called mytype containing a longword,\r
+; a word, a byte and a string of bytes, you might code\r
+;\r
+; struc   mytype\r
+;\r
+;  mt_long:      resd    1\r
+;  mt_word:      resw    1\r
+;  mt_byte:      resb    1\r
+;  mt_str:       resb    32\r
+;\r
+; endstruc\r
+;\r
+; Below macros are help to map the C types and the RESB family of pseudo-instructions.\r
+; So that the above structure definition can be coded as\r
+;\r
+; struc   mytype\r
+;\r
+;  mt_long:      CTYPE_UINT32    1\r
+;  mt_word:      CTYPE_UINT16    1\r
+;  mt_byte:      CTYPE_UINT8     1\r
+;  mt_str:       CTYPE_CHAR8     32\r
+;\r
+; endstruc\r
+%define CTYPE_UINT64    resq\r
+%define CTYPE_INT64     resq\r
+%define CTYPE_UINT32    resd\r
+%define CTYPE_INT32     resd\r
+%define CTYPE_UINT16    resw\r
+%define CTYPE_INT16     resw\r
+%define CTYPE_BOOLEAN   resb\r
+%define CTYPE_UINT8     resb\r
+%define CTYPE_CHAR8     resb\r
+%define CTYPE_INT8      resb\r
+\r
+%define CTYPE_UINTN     resd\r
+%define CTYPE_INTN      resd\r
index e57a803c81a7f3a554835ee19a35a767f6b7de47..527f71e9eb4d34ab9e14d24640f898364e1272bb 100644 (file)
@@ -1,6 +1,6 @@
 ;------------------------------------------------------------------------------\r
 ;\r
-; Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>\r
 ; SPDX-License-Identifier: BSD-2-Clause-Patent\r
 ;\r
 ; Abstract:\r
 %macro INCSSP_RAX      0\r
     DB 0xF3, 0x48, 0x0F, 0xAE, 0xE8\r
 %endmacro\r
+\r
+; NASM provides built-in macros STRUC and ENDSTRUC for structure definition.\r
+; For example, to define a structure called mytype containing a longword,\r
+; a word, a byte and a string of bytes, you might code\r
+;\r
+; struc   mytype\r
+;\r
+;  mt_long:      resd    1\r
+;  mt_word:      resw    1\r
+;  mt_byte:      resb    1\r
+;  mt_str:       resb    32\r
+;\r
+; endstruc\r
+;\r
+; Below macros are help to map the C types and the RESB family of pseudo-instructions.\r
+; So that the above structure definition can be coded as\r
+;\r
+; struc   mytype\r
+;\r
+;  mt_long:      CTYPE_UINT32    1\r
+;  mt_word:      CTYPE_UINT16    1\r
+;  mt_byte:      CTYPE_UINT8     1\r
+;  mt_str:       CTYPE_CHAR8     32\r
+;\r
+; endstruc\r
+%define CTYPE_UINT64    resq\r
+%define CTYPE_INT64     resq\r
+%define CTYPE_UINT32    resd\r
+%define CTYPE_INT32     resd\r
+%define CTYPE_UINT16    resw\r
+%define CTYPE_INT16     resw\r
+%define CTYPE_BOOLEAN   resb\r
+%define CTYPE_UINT8     resb\r
+%define CTYPE_CHAR8     resb\r
+%define CTYPE_INT8      resb\r
+\r
+%define CTYPE_UINTN     resq\r
+%define CTYPE_INTN      resq\r