summaryrefslogtreecommitdiff
path: root/src/arch/x86/isa/insts
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-10-12 20:07:28 -0700
committerGabe Black <gblack@eecs.umich.edu>2007-10-12 20:07:28 -0700
commitd82d3bbda5b5860c5a69816ebbb8ae217c4bcef4 (patch)
tree827bc32c8f5cb848d05a5f909e44fbda6d5a2fad /src/arch/x86/isa/insts
parent9498e536c0231b808669f2bacb4c0628d1ec309a (diff)
downloadgem5-d82d3bbda5b5860c5a69816ebbb8ae217c4bcef4.tar.xz
X86: Implemented LODS.
--HG-- extra : convert_revision : 4bd8f15bbc25f5dce16ea0504ad6dd21805fa56a
Diffstat (limited to 'src/arch/x86/isa/insts')
-rw-r--r--src/arch/x86/isa/insts/general_purpose/string/load_string.py42
1 files changed, 29 insertions, 13 deletions
diff --git a/src/arch/x86/isa/insts/general_purpose/string/load_string.py b/src/arch/x86/isa/insts/general_purpose/string/load_string.py
index 0f749a273..61525c2f2 100644
--- a/src/arch/x86/isa/insts/general_purpose/string/load_string.py
+++ b/src/arch/x86/isa/insts/general_purpose/string/load_string.py
@@ -53,16 +53,32 @@
#
# Authors: Gabe Black
-microcode = ""
-#let {{
-# class LODS(Inst):
-# "GenFault ${new UnimpInstFault}"
-# class LODSB(Inst):
-# "GenFault ${new UnimpInstFault}"
-# class LODSW(Inst):
-# "GenFault ${new UnimpInstFault}"
-# class LODSD(Inst):
-# "GenFault ${new UnimpInstFault}"
-# class LODSQ(Inst):
-# "GenFault ${new UnimpInstFault}"
-#}};
+microcode = '''
+def macroop LODS_M {
+ # Find the constant we need to either add or subtract from rdi
+ ruflag t0, 10
+ movi t3, t3, dsz, flags=(CEZF,), dataSize=asz
+ subi t4, t0, dsz, dataSize=asz
+ mov t3, t3, t4, flags=(nCEZF,), dataSize=asz
+
+ ld rax, seg, [1, t0, rdi]
+
+ add rdi, rdi, t3, dataSize=asz
+};
+
+def macroop LODS_E_M {
+ # Find the constant we need to either add or subtract from rdi
+ ruflag t0, 10
+ movi t3, t3, dsz, flags=(CEZF,), dataSize=asz
+ subi t4, t0, dsz, dataSize=asz
+ mov t3, t3, t4, flags=(nCEZF,), dataSize=asz
+
+topOfLoop:
+ ld rax, seg, [1, t0, rdi]
+
+ subi rcx, rcx, 1, flags=(EZF,), dataSize=asz
+ add rdi, rdi, t3, dataSize=asz
+ bri t0, label("topOfLoop"), flags=(nCEZF,)
+ fault "NoFault"
+};
+'''