;------------------------------------------------------------------------------\r
;\r
-; Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
-; This program and the accompanying materials\r
-; are licensed and made available under the terms and conditions of the BSD License\r
-; which accompanies this distribution. The full text of the license may be found at\r
-; http://opensource.org/licenses/bsd-license.php.\r
-;\r
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+; Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>\r
+; SPDX-License-Identifier: BSD-2-Clause-Patent\r
;\r
; Abstract:\r
;\r
;\r
;------------------------------------------------------------------------------\r
\r
-%macro SETSSBSY 0\r
- DB 0xF3, 0x0F, 0x01, 0xE8\r
+;\r
+; Macro for the PVALIDATE instruction, defined in AMD APM volume 3.\r
+; NASM feature request URL: https://bugzilla.nasm.us/show_bug.cgi?id=3392753\r
+;\r
+%macro PVALIDATE 0\r
+ DB 0xF2, 0x0F, 0x01, 0xFF\r
%endmacro\r
\r
-%macro READSSP_RAX 0\r
- DB 0xF3, 0x48, 0x0F, 0x1E, 0xC8\r
+;\r
+; Macro for the RMPADJUST instruction, defined in AMD APM volume 3.\r
+; NASM feature request URL: https://bugzilla.nasm.us/show_bug.cgi?id=3392754\r
+;\r
+%macro RMPADJUST 0\r
+ DB 0xF3, 0x0F, 0x01, 0xFE\r
%endmacro\r
\r
-%macro INCSSP_RAX 0\r
- DB 0xF3, 0x48, 0x0F, 0xAE, 0xE8\r
-%endmacro\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