Ronak Kanabar | 1ae366f | 2023-06-07 01:21:56 +0530 | [diff] [blame^] | 1 | ;------------------------------------------------------------------------------ |
| 2 | ; |
| 3 | ; Copyright (c) 2019 - 2022, 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 | ; |
| 13 | ; Macro for the PVALIDATE instruction, defined in AMD APM volume 3. |
| 14 | ; NASM feature request URL: https://bugzilla.nasm.us/show_bug.cgi?id=3392753 |
| 15 | ; |
| 16 | %macro PVALIDATE 0 |
| 17 | DB 0xF2, 0x0F, 0x01, 0xFF |
| 18 | %endmacro |
| 19 | |
| 20 | ; |
| 21 | ; Macro for the RMPADJUST instruction, defined in AMD APM volume 3. |
| 22 | ; NASM feature request URL: https://bugzilla.nasm.us/show_bug.cgi?id=3392754 |
| 23 | ; |
| 24 | %macro RMPADJUST 0 |
| 25 | DB 0xF3, 0x0F, 0x01, 0xFE |
| 26 | %endmacro |
| 27 | |
| 28 | ; NASM provides built-in macros STRUC and ENDSTRUC for structure definition. |
| 29 | ; For example, to define a structure called mytype containing a longword, |
| 30 | ; a word, a byte and a string of bytes, you might code |
| 31 | ; |
| 32 | ; struc mytype |
| 33 | ; |
| 34 | ; mt_long: resd 1 |
| 35 | ; mt_word: resw 1 |
| 36 | ; mt_byte: resb 1 |
| 37 | ; mt_str: resb 32 |
| 38 | ; |
| 39 | ; endstruc |
| 40 | ; |
| 41 | ; Below macros are help to map the C types and the RESB family of pseudo-instructions. |
| 42 | ; So that the above structure definition can be coded as |
| 43 | ; |
| 44 | ; struc mytype |
| 45 | ; |
| 46 | ; mt_long: CTYPE_UINT32 1 |
| 47 | ; mt_word: CTYPE_UINT16 1 |
| 48 | ; mt_byte: CTYPE_UINT8 1 |
| 49 | ; mt_str: CTYPE_CHAR8 32 |
| 50 | ; |
| 51 | ; endstruc |
| 52 | %define CTYPE_UINT64 resq |
| 53 | %define CTYPE_INT64 resq |
| 54 | %define CTYPE_UINT32 resd |
| 55 | %define CTYPE_INT32 resd |
| 56 | %define CTYPE_UINT16 resw |
| 57 | %define CTYPE_INT16 resw |
| 58 | %define CTYPE_BOOLEAN resb |
| 59 | %define CTYPE_UINT8 resb |
| 60 | %define CTYPE_CHAR8 resb |
| 61 | %define CTYPE_INT8 resb |
| 62 | |
| 63 | %define CTYPE_UINTN resq |
| 64 | %define CTYPE_INTN resq |