X86: Implement MOVS

--HG--
extra : convert_revision : 29147e1b86f7c54ce9b5ff68001725802c665fc0
This commit is contained in:
Gabe Black 2007-10-02 22:02:58 -07:00
parent fea7165b55
commit 66a08f7ba4
2 changed files with 53 additions and 15 deletions

View file

@ -330,8 +330,8 @@
0x1: mov_rAX_Ov(); 0x1: mov_rAX_Ov();
0x2: mov_Ob_Al(); 0x2: mov_Ob_Al();
0x3: mov_Ov_rAX(); 0x3: mov_Ov_rAX();
0x4: movs_Yb_Xb(); 0x4: StringInst::MOVS(Yb,Xb);
0x5: movs_Yv_Xv(); 0x5: StringInst::MOVS(Yv,Xv);
0x6: StringInst::CMPS(Yb,Xb); 0x6: StringInst::CMPS(Yb,Xb);
0x7: StringInst::CMPS(Yv,Xv); 0x7: StringInst::CMPS(Yv,Xv);
} }

View file

@ -53,16 +53,54 @@
# #
# Authors: Gabe Black # Authors: Gabe Black
microcode = "" microcode = '''
#let {{ def macroop MOVS_M_M {
# class MOVS(Inst): # Find the constant we need to either add or subtract from rdi
# "GenFault ${new UnimpInstFault}" ruflag t0, 10
# class MOVSB(Inst): movi t3, t3, dsz, flags=(CEZF,), dataSize=asz
# "GenFault ${new UnimpInstFault}" subi t4, t0, dsz, dataSize=asz
# class MOVSW(Inst): mov t3, t3, t4, flags=(nCEZF,), dataSize=asz
# "GenFault ${new UnimpInstFault}"
# class MOVSD(Inst): ld t1, seg, [1, t0, rsi]
# "GenFault ${new UnimpInstFault}" st t1, es, [1, t0, rdi]
# class MOVSQ(Inst):
# "GenFault ${new UnimpInstFault}" 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"
};
'''