Skip to content

Ghidra is a software reverse engineering (SRE) framework

Corrected toy language compile issues

ghidra140b747acee7b
diff --git a/Ghidra/Processors/Toy/certification.manifest b/Ghidra/Processors/Toy/certification.manifest
index 64b3d74d83..aa0ac5fa89 100644
--- a/Ghidra/Processors/Toy/certification.manifest
+++ b/Ghidra/Processors/Toy/certification.manifest
@@ -5,12 +5,6 @@ data/languages/old/ToyV00BE64.lang||GHIDRA||||END|
data/languages/old/ToyV0BE64.trans||GHIDRA||||END|
data/languages/old/ToyV0LE64.lang||GHIDRA||||END|
data/languages/old/ToyV0LE64.trans||GHIDRA||||END|
-data/languages/old/v01stuff/toy.cspec||GHIDRA|exclude|||END|
-data/languages/old/v01stuff/toy.ldefs_v01||GHIDRA|exclude|||END|
-data/languages/old/v01stuff/toy.sinc||GHIDRA|exclude|||END|
-data/languages/old/v01stuff/toy64.cspec||GHIDRA|exclude|||END|
-data/languages/old/v01stuff/toyInstructions.sinc||GHIDRA|exclude|||END|
-data/languages/old/v01stuff/toyPosStack.cspec||GHIDRA|exclude|||END|
data/languages/toy.cspec||GHIDRA||||END|
data/languages/toy.ldefs||GHIDRA||||END|
data/languages/toy.pspec||GHIDRA||reviewed||END|
diff --git a/Ghidra/Processors/Toy/data/languages/toy.sinc b/Ghidra/Processors/Toy/data/languages/toy.sinc
index 566bbd3109..2601f72035 100644
--- a/Ghidra/Processors/Toy/data/languages/toy.sinc
+++ b/Ghidra/Processors/Toy/data/languages/toy.sinc
@@ -1,12 +1,16 @@
-# Main slaspec must define endianess and alignment
-
-define endian=$(ENDIAN);
-
+# Main slaspec must define ENDIAN and ALIGN
@ifndef WORDSIZE
@define WORDSIZE "1"
@endif
+@ifndef ALIGN
+@define ALIGN "1"
+@endif
+
+define endian=$(ENDIAN);
+define alignment=$(ALIGN);
+
define space ram type=ram_space size=$(SIZE) wordsize=$(WORDSIZE) default;
define space register type=register_space size=2;
@@ -26,22 +30,3 @@ define register offset=0x1100 size=1 [
C Z N V
];
-
-@if SIZE == "4"
-@define HALFSIZE "2"
-@endif
-@if SIZE == "8"
-@define HALFSIZE "4"
-@endif
-
-@if ENDIAN == "little"
-define register offset=0x1000 size=$(HALFSIZE) [
- r0l r0h r1l r1h r2l r2h r3l r3h r4l r4h r5l r5h r6l r6h r7l r7h
- r8l r8h r9l r9h r10l r10h r11l r1lh r12l r12h spl sph lrl lrh pcl pch
-];
-@else # ENDIAN == "big"
-define register offset=0x1000 size=$(HALFSIZE) [
- r0h r0l r1h r1l r2h r2l r3h r3l r4h r4l r5h r5l r6h r6l r7h r7l
- r8h r8l r9h r9l r10h r10l r11h r1ll r12h r12l sph spl lrh lrl pch pcl
-];
-#endif # ENDIAN
diff --git a/Ghidra/Processors/Toy/data/languages/toy64_be.slaspec b/Ghidra/Processors/Toy/data/languages/toy64_be.slaspec
index c8730249a2..7833a4394a 100644
--- a/Ghidra/Processors/Toy/data/languages/toy64_be.slaspec
+++ b/Ghidra/Processors/Toy/data/languages/toy64_be.slaspec
@@ -1,5 +1,4 @@
@define ENDIAN "big"
-
@define SIZE "8"
@define INSTR_PHASE "" # not used by basic toy language
diff --git a/Ghidra/Processors/Toy/data/languages/toy64_be_harvard.slaspec b/Ghidra/Processors/Toy/data/languages/toy64_be_harvard.slaspec
index 4b4db4950a..869f58faf7 100644
--- a/Ghidra/Processors/Toy/data/languages/toy64_be_harvard.slaspec
+++ b/Ghidra/Processors/Toy/data/languages/toy64_be_harvard.slaspec
@@ -1,5 +1,4 @@
@define ENDIAN "big"
-
@define SIZE "8"
@define INSTR_PHASE "" # not used by basic toy language
diff --git a/Ghidra/Processors/Toy/data/languages/toy64_le.slaspec b/Ghidra/Processors/Toy/data/languages/toy64_le.slaspec
index d87ae03f10..ccd9b83615 100644
--- a/Ghidra/Processors/Toy/data/languages/toy64_le.slaspec
+++ b/Ghidra/Processors/Toy/data/languages/toy64_le.slaspec
@@ -1,5 +1,4 @@
@define ENDIAN "little"
-
@define SIZE "8"
@define INSTR_PHASE "" # not used by basic toy language
diff --git a/Ghidra/Processors/Toy/data/languages/toy_be.slaspec b/Ghidra/Processors/Toy/data/languages/toy_be.slaspec
index 772807c38e..40373b6c06 100644
--- a/Ghidra/Processors/Toy/data/languages/toy_be.slaspec
+++ b/Ghidra/Processors/Toy/data/languages/toy_be.slaspec
@@ -1,5 +1,4 @@
@define ENDIAN "big"
-
@define SIZE "4"
@define INSTR_PHASE "" # not used by basic toy language
diff --git a/Ghidra/Processors/Toy/data/languages/toy_be_posStack.slaspec b/Ghidra/Processors/Toy/data/languages/toy_be_posStack.slaspec
index 3aee6c08fd..f699953e25 100644
--- a/Ghidra/Processors/Toy/data/languages/toy_be_posStack.slaspec
+++ b/Ghidra/Processors/Toy/data/languages/toy_be_posStack.slaspec
@@ -1,5 +1,4 @@
@define ENDIAN "big"
-
@define SIZE "4"
@define INSTR_PHASE "" # not used by basic toy language
diff --git a/Ghidra/Processors/Toy/data/languages/toy_builder_be.slaspec b/Ghidra/Processors/Toy/data/languages/toy_builder_be.slaspec
index bf5ee2202d..2deedc5019 100644
--- a/Ghidra/Processors/Toy/data/languages/toy_builder_be.slaspec
+++ b/Ghidra/Processors/Toy/data/languages/toy_builder_be.slaspec
@@ -1,5 +1,4 @@
@define ENDIAN "big"
-
@define SIZE "4"
@include "toy_builder.sinc"
diff --git a/Ghidra/Processors/Toy/data/languages/toy_builder_be_align2.slaspec b/Ghidra/Processors/Toy/data/languages/toy_builder_be_align2.slaspec
index bc91a73e45..182c51b045 100644
--- a/Ghidra/Processors/Toy/data/languages/toy_builder_be_align2.slaspec
+++ b/Ghidra/Processors/Toy/data/languages/toy_builder_be_align2.slaspec
@@ -1,6 +1,5 @@
@define ENDIAN "big"
-define alignment=2;
-
+@define ALIGN "2"
@define SIZE "4"
@include "toy_builder.sinc"
diff --git a/Ghidra/Processors/Toy/data/languages/toy_builder_le.slaspec b/Ghidra/Processors/Toy/data/languages/toy_builder_le.slaspec
index 8e99da3a02..da7005e2fa 100644
--- a/Ghidra/Processors/Toy/data/languages/toy_builder_le.slaspec
+++ b/Ghidra/Processors/Toy/data/languages/toy_builder_le.slaspec
@@ -1,5 +1,4 @@
@define ENDIAN "little"
-
@define SIZE "4"
@include "toy_builder.sinc"
diff --git a/Ghidra/Processors/Toy/data/languages/toy_builder_le_align2.slaspec b/Ghidra/Processors/Toy/data/languages/toy_builder_le_align2.slaspec
index f7b3e0e215..631137eee9 100644
--- a/Ghidra/Processors/Toy/data/languages/toy_builder_le_align2.slaspec
+++ b/Ghidra/Processors/Toy/data/languages/toy_builder_le_align2.slaspec
@@ -1,6 +1,5 @@
@define ENDIAN "little"
-define alignment=2;
-
+@define ALIGN "2"
@define SIZE "4"
@include "toy_builder.sinc"
diff --git a/Ghidra/Processors/Toy/data/languages/toy_le.slaspec b/Ghidra/Processors/Toy/data/languages/toy_le.slaspec
index 2dad04500e..3fa3904b76 100644
--- a/Ghidra/Processors/Toy/data/languages/toy_le.slaspec
+++ b/Ghidra/Processors/Toy/data/languages/toy_le.slaspec
@@ -1,5 +1,4 @@
@define ENDIAN "little"
-
@define SIZE "4"
@define INSTR_PHASE "" # not used by basic toy language
diff --git a/Ghidra/Processors/Toy/data/languages/toy_wsz_be.slaspec b/Ghidra/Processors/Toy/data/languages/toy_wsz_be.slaspec
index fb7146336c..6246fcbdbe 100644
--- a/Ghidra/Processors/Toy/data/languages/toy_wsz_be.slaspec
+++ b/Ghidra/Processors/Toy/data/languages/toy_wsz_be.slaspec
@@ -1,6 +1,5 @@
@define ENDIAN "big"
-define alignment=2;
-
+@define ALIGN "2"
@define SIZE "4"
@define WORDSIZE "2"
diff --git a/Ghidra/Processors/Toy/data/languages/toy_wsz_le.slaspec b/Ghidra/Processors/Toy/data/languages/toy_wsz_le.slaspec
index 16b9b06c9a..9734ae0bac 100644
--- a/Ghidra/Processors/Toy/data/languages/toy_wsz_le.slaspec
+++ b/Ghidra/Processors/Toy/data/languages/toy_wsz_le.slaspec
@@ -1,6 +1,5 @@
@define ENDIAN "little"
-define alignment=2;
-
+@define ALIGN "2"
@define SIZE "4"
@define WORDSIZE "2"