]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/X64/Nasm.inc
MdePkg/Nasm.inc: add macros for C types used in structure definition
[mirror_edk2.git] / MdePkg / Include / X64 / Nasm.inc
1 ;------------------------------------------------------------------------------
2 ;
3 ; Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
4 ; SPDX-License-Identifier: BSD-2-Clause-Patent
5 ;
6 ; Abstract:
7 ;
8 ; This file provides macro definitions for NASM files.
9 ;
10 ;------------------------------------------------------------------------------
11
12 %macro SAVEPREVSSP 0
13 DB 0xF3, 0x0F, 0x01, 0xEA
14 %endmacro
15
16 %macro CLRSSBSY_RAX 0
17 DB 0xF3, 0x0F, 0xAE, 0x30
18 %endmacro
19
20 %macro RSTORSSP_RAX 0
21 DB 0xF3, 0x0F, 0x01, 0x28
22 %endmacro
23
24 %macro SETSSBSY 0
25 DB 0xF3, 0x0F, 0x01, 0xE8
26 %endmacro
27
28 %macro READSSP_RAX 0
29 DB 0xF3, 0x48, 0x0F, 0x1E, 0xC8
30 %endmacro
31
32 %macro INCSSP_RAX 0
33 DB 0xF3, 0x48, 0x0F, 0xAE, 0xE8
34 %endmacro
35
36 ; NASM provides built-in macros STRUC and ENDSTRUC for structure definition.
37 ; For example, to define a structure called mytype containing a longword,
38 ; a word, a byte and a string of bytes, you might code
39 ;
40 ; struc mytype
41 ;
42 ; mt_long: resd 1
43 ; mt_word: resw 1
44 ; mt_byte: resb 1
45 ; mt_str: resb 32
46 ;
47 ; endstruc
48 ;
49 ; Below macros are help to map the C types and the RESB family of pseudo-instructions.
50 ; So that the above structure definition can be coded as
51 ;
52 ; struc mytype
53 ;
54 ; mt_long: CTYPE_UINT32 1
55 ; mt_word: CTYPE_UINT16 1
56 ; mt_byte: CTYPE_UINT8 1
57 ; mt_str: CTYPE_CHAR8 32
58 ;
59 ; endstruc
60 %define CTYPE_UINT64 resq
61 %define CTYPE_INT64 resq
62 %define CTYPE_UINT32 resd
63 %define CTYPE_INT32 resd
64 %define CTYPE_UINT16 resw
65 %define CTYPE_INT16 resw
66 %define CTYPE_BOOLEAN resb
67 %define CTYPE_UINT8 resb
68 %define CTYPE_CHAR8 resb
69 %define CTYPE_INT8 resb
70
71 %define CTYPE_UINTN resq
72 %define CTYPE_INTN resq