Subrata Banik | 20fe24b | 2021-12-09 02:46:38 +0530 | [diff] [blame] | 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 | ; |
| 37 | ; Macro for the PVALIDATE instruction, defined in AMD APM volume 3. |
| 38 | ; NASM feature request URL: https://bugzilla.nasm.us/show_bug.cgi?id=3392753 |
| 39 | ; |
| 40 | %macro PVALIDATE 0 |
| 41 | DB 0xF2, 0x0F, 0x01, 0xFF |
| 42 | %endmacro |
| 43 | |
| 44 | ; |
| 45 | ; Macro for the RMPADJUST instruction, defined in AMD APM volume 3. |
| 46 | ; NASM feature request URL: https://bugzilla.nasm.us/show_bug.cgi?id=3392754 |
| 47 | ; |
| 48 | %macro RMPADJUST 0 |
| 49 | DB 0xF3, 0x0F, 0x01, 0xFE |
| 50 | %endmacro |
| 51 | |
| 52 | ; NASM provides built-in macros STRUC and ENDSTRUC for structure definition. |
| 53 | ; For example, to define a structure called mytype containing a longword, |
| 54 | ; a word, a byte and a string of bytes, you might code |
| 55 | ; |
| 56 | ; struc mytype |
| 57 | ; |
| 58 | ; mt_long: resd 1 |
| 59 | ; mt_word: resw 1 |
| 60 | ; mt_byte: resb 1 |
| 61 | ; mt_str: resb 32 |
| 62 | ; |
| 63 | ; endstruc |
| 64 | ; |
| 65 | ; Below macros are help to map the C types and the RESB family of pseudo-instructions. |
| 66 | ; So that the above structure definition can be coded as |
| 67 | ; |
| 68 | ; struc mytype |
| 69 | ; |
| 70 | ; mt_long: CTYPE_UINT32 1 |
| 71 | ; mt_word: CTYPE_UINT16 1 |
| 72 | ; mt_byte: CTYPE_UINT8 1 |
| 73 | ; mt_str: CTYPE_CHAR8 32 |
| 74 | ; |
| 75 | ; endstruc |
| 76 | %define CTYPE_UINT64 resq |
| 77 | %define CTYPE_INT64 resq |
| 78 | %define CTYPE_UINT32 resd |
| 79 | %define CTYPE_INT32 resd |
| 80 | %define CTYPE_UINT16 resw |
| 81 | %define CTYPE_INT16 resw |
| 82 | %define CTYPE_BOOLEAN resb |
| 83 | %define CTYPE_UINT8 resb |
| 84 | %define CTYPE_CHAR8 resb |
| 85 | %define CTYPE_INT8 resb |
| 86 | |
| 87 | %define CTYPE_UINTN resq |
| 88 | %define CTYPE_INTN resq |