summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/BaseLib/X64/Pvalidate.nasm
blob: a7d177913405cb032f61960f060331e96d0ba6ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
;-----------------------------------------------------------------------------
;
; Copyright (c) 2021, AMD. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
;-----------------------------------------------------------------------------

%include "Nasm.inc"

    SECTION .text

;-----------------------------------------------------------------------------
;  UINT32
;  EFIAPI
;  AsmPvalidate (
;    IN   UINT32              PageSize
;    IN   UINT32              Validate,
;    IN   UINT64              Address
;    )
;-----------------------------------------------------------------------------
global ASM_PFX(AsmPvalidate)
ASM_PFX(AsmPvalidate):
  mov     rax, r8

  PVALIDATE

  ; Save the carry flag.
  setc    dl

  ; The PVALIDATE instruction returns the status in rax register.
  cmp     rax, 0
  jne     PvalidateExit

  ; Check the carry flag to determine if RMP entry was updated.
  cmp     dl, 0
  je      PvalidateExit

  ; Return the PVALIDATE_RET_NO_RMPUPDATE.
  mov     rax, 255

PvalidateExit:
  ret