X86: Implement STOS.
--HG-- extra : convert_revision : 95f3bf185f07fe644d6ab96bbb6e598e406b92f4
This commit is contained in:
parent
2dd65dc254
commit
fea7165b55
2 changed files with 47 additions and 15 deletions
|
@ -338,8 +338,8 @@
|
||||||
0x15: decode OPCODE_OP_BOTTOM3 {
|
0x15: decode OPCODE_OP_BOTTOM3 {
|
||||||
0x0: Inst::TEST(rAb,Ib);
|
0x0: Inst::TEST(rAb,Ib);
|
||||||
0x1: Inst::TEST(rAv,Iz);
|
0x1: Inst::TEST(rAv,Iz);
|
||||||
0x2: stos_Yb_Al();
|
0x2: StringInst::STOS(Yb);
|
||||||
0x3: stos_Yv_rAX();
|
0x3: StringInst::STOS(Yv);
|
||||||
0x4: lods_Al_Xb();
|
0x4: lods_Al_Xb();
|
||||||
0x5: lods_rAX_Xv();
|
0x5: lods_rAX_Xv();
|
||||||
0x6: StringInst::SCAS(Yb);
|
0x6: StringInst::SCAS(Yb);
|
||||||
|
|
|
@ -53,16 +53,48 @@
|
||||||
#
|
#
|
||||||
# Authors: Gabe Black
|
# Authors: Gabe Black
|
||||||
|
|
||||||
microcode = ""
|
microcode = '''
|
||||||
#let {{
|
def macroop STOS_M {
|
||||||
# class STOS(Inst):
|
# Find the constant we need to either add or subtract from rdi
|
||||||
# "Add 0 0 0"
|
ruflag t0, 10
|
||||||
# class STOSB(Inst):
|
movi t3, t3, dsz, flags=(CEZF,), dataSize=asz
|
||||||
# "Add 0 0 0"
|
subi t4, t0, dsz, dataSize=asz
|
||||||
# class STOSW(Inst):
|
mov t3, t3, t4, flags=(nCEZF,), dataSize=asz
|
||||||
# "Add 0 0 0"
|
|
||||||
# class STOSD(Inst):
|
st rax, es, [1, t0, rdi]
|
||||||
# "Add 0 0 0"
|
|
||||||
# class STOSQ(Inst):
|
add rdi, rdi, t3, dataSize=asz
|
||||||
# "Add 0 0 0"
|
};
|
||||||
#}};
|
|
||||||
|
def macroop STOS_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:
|
||||||
|
st rax, es, [1, t0, rdi]
|
||||||
|
|
||||||
|
subi rcx, rcx, 1, flags=(EZF,), dataSize=asz
|
||||||
|
add rdi, rdi, t3, dataSize=asz
|
||||||
|
bri t0, label("topOfLoop"), flags=(CSTRZnEZF,)
|
||||||
|
fault "NoFault"
|
||||||
|
};
|
||||||
|
|
||||||
|
def macroop STOS_N_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:
|
||||||
|
st rax, es, [1, t0, rdi]
|
||||||
|
|
||||||
|
subi rcx, rcx, 1, flags=(EZF,), dataSize=asz
|
||||||
|
add rdi, rdi, t3, dataSize=asz
|
||||||
|
bri t0, label("topOfLoop"), flags=(CSTRnZnEZF,)
|
||||||
|
fault "NoFault"
|
||||||
|
};
|
||||||
|
'''
|
||||||
|
|
Loading…
Reference in a new issue