Skip to content

Ghidra is a software reverse engineering (SRE) framework

GT-3413: Added rdrand/rdseed support to x86-32

ghidorahrexc2847fa9a4d8
diff --git a/Ghidra/Processors/x86/data/languages/rdrand.sinc b/Ghidra/Processors/x86/data/languages/rdrand.sinc
index 8432b8f0fa..5b68faa7a5 100644
--- a/Ghidra/Processors/x86/data/languages/rdrand.sinc
+++ b/Ghidra/Processors/x86/data/languages/rdrand.sinc
@@ -2,5 +2,6 @@ define pcodeop rdrand;
define pcodeop rdrandIsValid;
:RDRAND rm16 is vexMode=0 & opsize=0 & byte=0x0f; byte=0xC7; (rm16 & reg_opcode=6 ...) { rm16 = rdrand(); CF=rdrandIsValid(); }
:RDRAND rm32 is vexMode=0 & opsize=1 & byte=0x0f; byte=0xC7; (rm32 & reg_opcode=6 ...) { rm32 = rdrand(); CF=rdrandIsValid(); }
+@ifdef IA64
:RDRAND rm64 is vexMode=0 & opsize=2 & $(REX_W) & byte=0x0f; byte=0xC7; (rm64 & reg_opcode=6 ...) { rm64 = rdrand(); CF=rdrandIsValid(); }
-
+@endif
diff --git a/Ghidra/Processors/x86/data/languages/rdseed.sinc b/Ghidra/Processors/x86/data/languages/rdseed.sinc
index ba93179e0a..144e56ae19 100644
--- a/Ghidra/Processors/x86/data/languages/rdseed.sinc
+++ b/Ghidra/Processors/x86/data/languages/rdseed.sinc
@@ -2,5 +2,6 @@ define pcodeop rdseed;
define pcodeop rdseedIsValid;
:RDSEED r16 is vexMode=0 & opsize=0 & byte=0x0f; byte=0xC7; r16 & reg_opcode=7 { r16 = rdseed(); CF=rdseedIsValid(); }
:RDSEED r32 is vexMode=0 & opsize=1 & byte=0x0f; byte=0xC7; r32 & reg_opcode=7 { r32 = rdseed(); CF=rdseedIsValid(); }
+@ifdef IA64
:RDSEED r64 is vexMode=0 & opsize=2 & $(REX_W) & byte=0x0f; byte=0xC7; r64 & reg_opcode=7 { r64 = rdseed(); CF=rdseedIsValid(); }
-
+@endif
diff --git a/Ghidra/Processors/x86/data/languages/x86.slaspec b/Ghidra/Processors/x86/data/languages/x86.slaspec
index af5cfda753..49194af394 100644
--- a/Ghidra/Processors/x86/data/languages/x86.slaspec
+++ b/Ghidra/Processors/x86/data/languages/x86.slaspec
@@ -13,3 +13,5 @@
@include "sha.sinc"
@include "smx.sinc"
@include "cet.sinc"
+@include "rdrand.sinc"
+@include "rdseed.sinc"
\ No newline at end of file