summaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-10-02 22:02:58 -0700
committerGabe Black <gblack@eecs.umich.edu>2007-10-02 22:02:58 -0700
commit66a08f7ba4461664738fd88839ad49c0120bf098 (patch)
tree851480004bd6c1c8495fe14f8b315ec39b2a70e5 /src/arch/x86
parentfea7165b55f7eca4b1a549628029b06c5d19aa1c (diff)
downloadgem5-66a08f7ba4461664738fd88839ad49c0120bf098.tar.xz
X86: Implement MOVS
--HG-- extra : convert_revision : 29147e1b86f7c54ce9b5ff68001725802c665fc0
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/isa/decoder/one_byte_opcodes.isa4
-rw-r--r--src/arch/x86/isa/insts/general_purpose/string/move_string.py64
2 files changed, 53 insertions, 15 deletions
diff --git a/src/arch/x86/isa/decoder/one_byte_opcodes.isa b/src/arch/x86/isa/decoder/one_byte_opcodes.isa
index 3e8b893bf..d4e881128 100644
--- a/src/arch/x86/isa/decoder/one_byte_opcodes.isa
+++ b/src/arch/x86/isa/decoder/one_byte_opcodes.isa
@@ -330,8 +330,8 @@
0x1: mov_rAX_Ov();
0x2: mov_Ob_Al();
0x3: mov_Ov_rAX();
- 0x4: movs_Yb_Xb();
- 0x5: movs_Yv_Xv();
+ 0x4: StringInst::MOVS(Yb,Xb);
+ 0x5: StringInst::MOVS(Yv,Xv);
0x6: StringInst::CMPS(Yb,Xb);
0x7: StringInst::CMPS(Yv,Xv);
}
diff --git a/src/arch/x86/isa/insts/general_purpose/string/move_string.py b/src/arch/x86/isa/insts/general_purpose/string/move_string.py
index 0a855b384..6a78a2cd4 100644
--- a/src/arch/x86/isa/insts/general_purpose/string/move_string.py
+++ b/src/arch/x86/isa/insts/general_purpose/string/move_string.py
@@ -53,16 +53,54 @@
#
# Authors: Gabe Black
-microcode = ""
-#let {{
-# class MOVS(Inst):
-# "GenFault ${new UnimpInstFault}"
-# class MOVSB(Inst):
-# "GenFault ${new UnimpInstFault}"
-# class MOVSW(Inst):
-# "GenFault ${new UnimpInstFault}"
-# class MOVSD(Inst):
-# "GenFault ${new UnimpInstFault}"
-# class MOVSQ(Inst):
-# "GenFault ${new UnimpInstFault}"
-#}};
+microcode = '''
+def macroop MOVS_M_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 t1, seg, [1, t0, rsi]
+ st t1, es, [1, t0, rdi]
+
+ add rdi, rdi, t3, dataSize=asz
+ add rsi, rsi, t3, dataSize=asz
+};
+
+def macroop MOVS_E_M_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 t1, seg, [1, t0, rsi]
+ st t1, es, [1, t0, rdi]
+
+ subi rcx, rcx, 1, flags=(EZF,), dataSize=asz
+ add rdi, rdi, t3, dataSize=asz
+ add rsi, rsi, t3, dataSize=asz
+ bri t0, label("topOfLoop"), flags=(CSTRZnEZF,)
+ fault "NoFault"
+};
+
+def macroop MOVS_N_M_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 t1, seg, [1, t0, rsi]
+ st t1, es, [1, t0, rdi]
+
+ subi rcx, rcx, 1, flags=(EZF,), dataSize=asz
+ add rdi, rdi, t3, dataSize=asz
+ add rsi, rsi, t3, dataSize=asz
+ bri t0, label("topOfLoop"), flags=(CSTRnZnEZF,)
+ fault "NoFault"
+};
+'''