Skip to content

Commit

Permalink
Support RMPQUERY and RMPREAD (AMD)
Browse files Browse the repository at this point in the history
  • Loading branch information
aengelke committed Aug 14, 2024
1 parent 522b010 commit ee11137
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
13 changes: 13 additions & 0 deletions decode-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -3921,6 +3921,19 @@ main(int argc, char** argv)
TEST("\xc4\xe3\xe9\xcf\xc1\x01", "vgf2p8affineinvqb xmm0, xmm2, xmm1, 0x1");
TEST("\xc4\xe3\xed\xcf\xc1\x01", "vgf2p8affineinvqb ymm0, ymm2, ymm1, 0x1");

// AMD RDPRU
TEST64("\x0f\x01\xfd", "rdpru");
TEST64("\x66\x0f\x01\xfd", "rdpru"); // 66 prefix ignored

// AMD SNP
TEST64("\xf3\x0f\x01\xfd", "rmpquery");
TEST64("\xf2\x0f\x01\xfd", "rmpread");
TEST64("\xf3\x0f\x01\xfe", "rmpadjust");
TEST64("\xf2\x0f\x01\xfe", "rmpupdate");
TEST64("\xf3\x0f\x01\xff", "psmash");
TEST64("\xf2\x0f\x01\xff", "pvalidate");


puts(failed ? "Some tests FAILED" : "All tests PASSED");
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
}
15 changes: 9 additions & 6 deletions instrs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1596,7 +1596,8 @@ F3.0fc7/6m M Mq - - - VMXON F=VMX EFL=0--0m0
0f01fc A Rv - - - CLZERO F=CLZERO ONLYAMD

# AMD RDPRU
0f01fd NP - - - - RDPRU F=RDPRU ONLYAMD
# Tested on hardware, 66 prefix also accepted. F2/F3 trigger UD.
NFx.0f01fd NP - - - - RDPRU F=RDPRU ONLYAMD

# AMD SVM
0f01d8 NP - - - - VMRUN F=SVM ONLYAMD CPL0
Expand All @@ -1607,7 +1608,7 @@ F2.0f01d9 NP - - - - VMGEXIT F=SEVES ONLYAMD
0f01db NP - - - - VMSAVE F=SVM ONLYAMD CPL0
0f01dc NP - - - - STGI F=SKINIT ONLYAMD CPL0
0f01dd NP - - - - CLGI F=SKINIT ONLYAMD CPL0
0f01de NP - - - - SKINIT F=SKINIT ONLYAMD CPL0
0f01de NP - - - - SKINIT EFL=00000000 F=SKINIT ONLYAMD CPL0
0f01df NP - - - - INVLPGA F=SVM ONLYAMD CPL0
NP.0f01fa NP - - - - MONITORX F=MONITORX ONLYAMD
F3.0f01fa NP - - - - MCOMMIT F=MCOMMIT ONLYAMD
Expand All @@ -1616,10 +1617,12 @@ NP.0f01fe NP - - - - INVLPGB F=INVLPGB ONLYAM
NP.0f01ff NP - - - - TLBSYNC F=INVLPGB ONLYAMD CPL0

# AMD SNP
F3.0f01fe NP - - - - RMPADJUST O64 F=SNP ONLYAMD CPL0
F2.0f01fe NP - - - - RMPUPDATE O64 F=SNP ONLYAMD CPL0
F3.0f01ff NP - - - - PSMASH O64 F=SNP ONLYAMD
F2.0f01ff NP - - - - PVALIDATE O64 F=SNP ONLYAMD
F3.0f01fd NP - - - - RMPQUERY O64 EFL=m--mmmm- F=RMPQUERY ONLYAMD CPL0
F2.0f01fd NP - - - - RMPREAD O64 EFL=m--mmmm- F=RMPREAD ONLYAMD CPL0
F3.0f01fe NP - - - - RMPADJUST O64 EFL=m--mmmm- F=SNP ONLYAMD CPL0
F2.0f01fe NP - - - - RMPUPDATE O64 EFL=m--mmmm- F=SNP ONLYAMD CPL0
F3.0f01ff NP - - - - PSMASH O64 EFL=m--mmmm- F=SNP ONLYAMD
F2.0f01ff NP - - - - PVALIDATE O64 EFL=m--mmmmm F=SNP ONLYAMD

# WAITPKG
66.0fae/6r M Rd - - - TPAUSE F=WAITPKG EFL=0--0000m
Expand Down

0 comments on commit ee11137

Please sign in to comment.