Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-1819 addressing code review comments GP-1819 added conditional assignment macro to x86 processor module

Jamesac984f3c7a33
diff --git a/Ghidra/Processors/x86/certification.manifest b/Ghidra/Processors/x86/certification.manifest
index c0acec77c7..7d95a8f6a4 100644
--- a/Ghidra/Processors/x86/certification.manifest
+++ b/Ghidra/Processors/x86/certification.manifest
@@ -12,6 +12,7 @@ data/languages/clwb.sinc||GHIDRA||||END|
data/languages/fma.sinc||GHIDRA||||END|
data/languages/ia.sinc||GHIDRA||||END|
data/languages/lzcnt.sinc||GHIDRA||||END|
+data/languages/macros.sinc||GHIDRA||||END|
data/languages/mpx.sinc||GHIDRA||||END|
data/languages/old/x86RealV1.lang||GHIDRA||||END|
data/languages/old/x86RealV1.trans||GHIDRA||||END|
diff --git a/Ghidra/Processors/x86/data/languages/ia.sinc b/Ghidra/Processors/x86/data/languages/ia.sinc
index 8c0a611374..e6e69c801d 100644
--- a/Ghidra/Processors/x86/data/languages/ia.sinc
+++ b/Ghidra/Processors/x86/data/languages/ia.sinc
@@ -1067,6 +1067,8 @@ repetail: is repprefx=0 & repneprefx=0 { }
# Some macros
+@include "macros.sinc"
+
macro ptr2(r,x) {
r = zext(x);
}
diff --git a/Ghidra/Processors/x86/data/languages/macros.sinc b/Ghidra/Processors/x86/data/languages/macros.sinc
new file mode 100644
index 0000000000..1a199e1a5e
--- /dev/null
+++ b/Ghidra/Processors/x86/data/languages/macros.sinc
@@ -0,0 +1,3 @@
+macro conditionalAssign(dest, cond, trueVal, falseVal) {
+ dest = zext(cond) * trueVal | zext(!cond) * falseVal;
+}
\ No newline at end of file
diff --git a/Ghidra/Processors/x86/data/languages/x86-64.slaspec b/Ghidra/Processors/x86/data/languages/x86-64.slaspec
index 4b1ccf9793..9a04c5bd51 100644
--- a/Ghidra/Processors/x86/data/languages/x86-64.slaspec
+++ b/Ghidra/Processors/x86/data/languages/x86-64.slaspec
@@ -17,3 +17,4 @@
@include "smx.sinc"
@include "cet.sinc"
@include "fma.sinc"
+
diff --git a/Ghidra/Processors/x86/data/languages/x86.slaspec b/Ghidra/Processors/x86/data/languages/x86.slaspec
index 8a4bbee102..65183e394d 100644
--- a/Ghidra/Processors/x86/data/languages/x86.slaspec
+++ b/Ghidra/Processors/x86/data/languages/x86.slaspec
@@ -14,3 +14,4 @@
@include "smx.sinc"
@include "cet.sinc"
@include "rdrand.sinc"
+