def macroop ADD_M_I
{
limm t2, imm
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
add t1, t1, t2, flags=(OF,SF,ZF,AF,PF,CF)
st t1, seg, sib, disp
};
{
rdip t7
limm t2, imm
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
add t1, t1, t2, flags=(OF,SF,ZF,AF,PF,CF)
st t1, seg, riprel, disp
};
def macroop ADD_M_R
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
add t1, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)
st t1, seg, sib, disp
};
def macroop ADD_P_R
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
add t1, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)
st t1, seg, riprel, disp
};
def macroop SUB_M_I
{
limm t2, imm
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
sub t1, t1, t2, flags=(OF,SF,ZF,AF,PF,CF)
st t1, seg, sib, disp
};
{
rdip t7
limm t2, imm
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
sub t1, t1, t2, flags=(OF,SF,ZF,AF,PF,CF)
st t1, seg, riprel, disp
};
def macroop SUB_M_R
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
sub t1, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)
st t1, seg, sib, disp
};
def macroop SUB_P_R
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
sub t1, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)
st t1, seg, riprel, disp
};
def macroop ADC_M_I
{
limm t2, imm
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
adc t1, t1, t2, flags=(OF,SF,ZF,AF,PF,CF)
st t1, seg, sib, disp
};
{
rdip t7
limm t2, imm
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
adc t1, t1, t2, flags=(OF,SF,ZF,AF,PF,CF)
st t1, seg, riprel, disp
};
def macroop ADC_M_R
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
adc t1, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)
st t1, seg, sib, disp
};
def macroop ADC_P_R
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
adc t1, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)
st t1, seg, riprel, disp
};
def macroop SBB_M_I
{
limm t2, imm
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
sbb t1, t1, t2, flags=(OF,SF,ZF,AF,PF,CF)
st t1, seg, sib, disp
};
{
rdip t7
limm t2, imm
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
sbb t1, t1, t2, flags=(OF,SF,ZF,AF,PF,CF)
st t1, seg, riprel, disp
};
def macroop SBB_M_R
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
sbb t1, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)
st t1, seg, sib, disp
};
def macroop SBB_P_R
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
sbb t1, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)
st t1, seg, riprel, disp
};
def macroop NEG_M
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
sub t1, t0, t1, flags=(CF,OF,SF,ZF,AF,PF)
st t1, seg, sib, disp
};
def macroop NEG_P
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
sub t1, t0, t1, flags=(CF,OF,SF,ZF,AF,PF)
st t1, seg, riprel, disp
};
def macroop INC_M
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
addi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
st t1, seg, sib, disp
};
def macroop INC_P
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
addi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
st t1, seg, riprel, disp
};
def macroop DEC_M
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
subi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
st t1, seg, sib, disp
};
def macroop DEC_P
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
subi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
st t1, seg, riprel, disp
};
limm t1, imm
rdip t7
+ # Check target of call
+ st t7, ss, [0, t0, rsp], "-env.dataSize"
subi rsp, rsp, dsz
- st t7, ss, [0, t0, rsp]
wrip t7, t1
};
.adjust_env oszIn64Override
rdip t1
+ # Check target of call
+ st t1, ss, [0, t0, rsp], "-env.dataSize"
subi rsp, rsp, dsz
- st t1, ss, [0, t0, rsp]
wripi reg, 0
};
rdip t7
ld t1, seg, sib, disp
+ # Check target of call
+ st t7, ss, [0, t0, rsp], "-env.dataSize"
subi rsp, rsp, dsz
- st t7, ss, [0, t0, rsp]
wripi t1, 0
};
rdip t7
ld t1, seg, riprel, disp
+ # Check target of call
+ st t7, ss, [0, t0, rsp], "-env.dataSize"
subi rsp, rsp, dsz
- st t7, ss, [0, t0, rsp]
wripi t1, 0
};
'''
.adjust_env oszIn64Override
ld t1, ss, [1, t0, rsp]
+ # Check address of return
addi rsp, rsp, dsz
wripi t1, 0
};
limm t2, imm
ld t1, ss, [1, t0, rsp]
+ # Check address of return
addi rsp, rsp, dsz
add rsp, rsp, t2
wripi t1, 0
.adjust_env oszIn64Override
ld t1, ss, [1, t0, rsp]
+ # Check stack address
addi rsp, rsp, dsz
st t1, seg, sib, disp
};
rdip t7
ld t1, ss, [1, t0, rsp]
+ # Check stack address
addi rsp, rsp, dsz
st t1, seg, riprel, disp
};
.adjust_env oszIn64Override
limm t1, imm
+ st t1, ss, [1, t0, rsp], "-env.dataSize"
subi rsp, rsp, dsz
- st t1, ss, [1, t0, rsp]
};
def macroop PUSH_M {
.adjust_env oszIn64Override
ld t1, seg, sib, disp
+ st t1, ss, [1, t0, rsp], "-env.dataSize"
subi rsp, rsp, dsz
- st t1, ss, [1, t0, rsp]
};
def macroop PUSH_P {
rdip t7
ld t1, seg, riprel, disp
+ # Check stack address
subi rsp, rsp, dsz
st t1, ss, [1, t0, rsp]
};
def macroop PUSHA {
+ # Check all the stack addresses.
st rax, ss, [1, t0, rsp], "-0 * env.dataSize"
st rcx, ss, [1, t0, rsp], "-1 * env.dataSize"
st rdx, ss, [1, t0, rsp], "-2 * env.dataSize"
};
def macroop POPA {
+ # Check all the stack addresses.
ld rdi, ss, [1, t0, rsp], "0 * env.dataSize"
ld rsi, ss, [1, t0, rsp], "1 * env.dataSize"
ld rbp, ss, [1, t0, rsp], "2 * env.dataSize"
# Make the default data size of pops 64 bits in 64 bit mode
.adjust_env oszIn64Override
- mov rsp, rsp, rbp
- ld rbp, ss, [1, t0, rsp]
+ mov t1, t1, rbp
+ ld rbp, ss, [1, t0, t1]
+ mov rsp, rsp, t1
addi rsp, rsp, dsz
};
'''
def macroop XCHG_R_M
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
st reg, seg, sib, disp
mov reg, reg, t1
};
def macroop XCHG_R_P
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
st reg, seg, riprel, disp
mov reg, reg, t1
};
def macroop XCHG_M_R
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
st reg, seg, sib, disp
mov reg, reg, t1
};
def macroop XCHG_P_R
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
st reg, seg, riprel, disp
mov reg, reg, t1
};
def macroop OR_M_I
{
limm t2, imm
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
or t1, t1, t2, flags=(OF,SF,ZF,PF,CF)
st t1, seg, sib, disp
};
{
limm t2, imm
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
or t1, t1, t2, flags=(OF,SF,ZF,PF,CF)
st t1, seg, riprel, disp
};
def macroop OR_M_R
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
or t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
st t1, seg, sib, disp
};
def macroop OR_P_R
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
or t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
st t1, seg, riprel, disp
};
def macroop XOR_M_I
{
limm t2, imm
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
xor t1, t1, t2, flags=(OF,SF,ZF,PF,CF)
st t1, seg, sib, disp
};
{
limm t2, imm
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
xor t1, t1, t2, flags=(OF,SF,ZF,PF,CF)
st t1, seg, riprel, disp
};
def macroop XOR_M_R
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
xor t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
st t1, seg, sib, disp
};
def macroop XOR_P_R
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
xor t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
st t1, seg, riprel, disp
};
def macroop AND_M_I
{
- ld t2, seg, sib, disp
+ ldst t2, seg, sib, disp
limm t1, imm
and t2, t2, t1, flags=(OF,SF,ZF,PF,CF)
st t2, seg, sib, disp
def macroop AND_P_I
{
rdip t7
- ld t2, seg, riprel, disp
+ ldst t2, seg, riprel, disp
limm t1, imm
and t2, t2, t1, flags=(OF,SF,ZF,PF,CF)
st t2, seg, riprel, disp
def macroop AND_M_R
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
and t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
st t1, seg, sib, disp
};
def macroop AND_P_R
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
and t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
st t1, seg, riprel, disp
};
def macroop NOT_M
{
limm t1, -1
- ld t2, seg, sib, disp
+ ldst t2, seg, sib, disp
xor t2, t2, t1
st t2, seg, sib, disp
};
{
limm t1, -1
rdip t7
- ld t2, seg, riprel, disp
+ ldst t2, seg, riprel, disp
xor t2, t2, t1
st t2, seg, riprel, disp
};
def macroop ROL_M_I
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
roli t1, t1, imm
st t1, seg, sib, disp
};
def macroop ROL_P_I
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
roli t1, t1, imm
st t1, seg, riprel, disp
};
def macroop ROL_1_M
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
roli t1, t1, 1
st t1, seg, sib, disp
};
def macroop ROL_1_P
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
roli t1, t1, 1
st t1, seg, riprel, disp
};
def macroop ROL_M_R
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
rol t1, t1, reg
st t1, seg, sib, disp
};
def macroop ROL_P_R
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
rol t1, t1, reg
st t1, seg, riprel, disp
};
def macroop ROR_M_I
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
rori t1, t1, imm
st t1, seg, sib, disp
};
def macroop ROR_P_I
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
rori t1, t1, imm
st t1, seg, riprel, disp
};
def macroop ROR_1_M
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
rori t1, t1, 1
st t1, seg, sib, disp
};
def macroop ROR_1_P
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
rori t1, t1, 1
st t1, seg, riprel, disp
};
def macroop ROR_M_R
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
ror t1, t1, reg
st t1, seg, sib, disp
};
def macroop ROR_P_R
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
ror t1, t1, reg
st t1, seg, riprel, disp
};
def macroop RCL_M_I
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
rcli t1, t1, imm
st t1, seg, sib, disp
};
def macroop RCL_P_I
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
rcli t1, t1, imm
st t1, seg, riprel, disp
};
def macroop RCL_1_M
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
rcli t1, t1, 1
st t1, seg, sib, disp
};
def macroop RCL_1_P
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
rcli t1, t1, 1
st t1, seg, riprel, disp
};
def macroop RCL_M_R
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
rcl t1, t1, reg
st t1, seg, sib, disp
};
def macroop RCL_P_R
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
rcl t1, t1, reg
st t1, seg, riprel, disp
};
def macroop RCR_M_I
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
rcri t1, t1, imm
st t1, seg, sib, disp
};
def macroop RCR_P_I
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
rcri t1, t1, imm
st t1, seg, riprel, disp
};
def macroop RCR_1_M
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
rcri t1, t1, 1
st t1, seg, sib, disp
};
def macroop RCR_1_P
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
rcri t1, t1, 1
st t1, seg, riprel, disp
};
def macroop RCR_M_R
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
rcr t1, t1, reg
st t1, seg, sib, disp
};
def macroop RCR_P_R
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
rcr t1, t1, reg
st t1, seg, riprel, disp
};
def macroop SAL_M_I
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
slli t1, t1, imm, flags=(SF,ZF,PF)
st t1, seg, sib, disp
};
def macroop SAL_P_I
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
slli t1, t1, imm, flags=(SF,ZF,PF)
st t1, seg, riprel, disp
};
def macroop SAL_1_M
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
slli t1, t1, 1, flags=(SF,ZF,PF)
st t1, seg, sib, disp
};
def macroop SAL_1_P
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
slli t1, t1, 1, flags=(SF,ZF,PF)
st t1, seg, riprel, disp
};
def macroop SAL_M_R
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
sll t1, t1, reg, flags=(SF,ZF,PF)
st t1, seg, sib, disp
};
def macroop SAL_P_R
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
sll t1, t1, reg, flags=(SF,ZF,PF)
st t1, seg, riprel, disp
};
def macroop SHR_M_I
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
srli t1, t1, imm, flags=(SF,ZF,PF)
st t1, seg, sib, disp
};
def macroop SHR_P_I
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
srli t1, t1, imm, flags=(SF,ZF,PF)
st t1, seg, riprel, disp
};
def macroop SHR_1_M
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
srli t1, t1, 1, flags=(SF,ZF,PF)
st t1, seg, sib, disp
};
def macroop SHR_1_P
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
srli t1, t1, 1, flags=(SF,ZF,PF)
st t1, seg, riprel, disp
};
def macroop SHR_M_R
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
srl t1, t1, reg, flags=(SF,ZF,PF)
st t1, seg, sib, disp
};
def macroop SHR_P_R
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
srl t1, t1, reg, flags=(SF,ZF,PF)
st t1, seg, riprel, disp
};
def macroop SAR_M_I
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
srai t1, t1, imm, flags=(SF,ZF,PF)
st t1, seg, sib, disp
};
def macroop SAR_P_I
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
srai t1, t1, imm, flags=(SF,ZF,PF)
st t1, seg, riprel, disp
};
def macroop SAR_1_M
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
srai t1, t1, 1, flags=(SF,ZF,PF)
st t1, seg, sib, disp
};
def macroop SAR_1_P
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
srai t1, t1, 1, flags=(SF,ZF,PF)
st t1, seg, riprel, disp
};
def macroop SAR_M_R
{
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
sra t1, t1, reg, flags=(SF,ZF,PF)
st t1, seg, sib, disp
};
def macroop SAR_P_R
{
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
sra t1, t1, reg, flags=(SF,ZF,PF)
st t1, seg, riprel, disp
};
};
def macroop CMPXCHG_M_R {
- ld t1, seg, sib, disp
+ ldst t1, seg, sib, disp
sub t0, rax, t1, flags=(OF, SF, ZF, AF, PF, CF)
mov t1, t1, reg, flags=(CZF,)
def macroop CMPXCHG_P_R {
rdip t7
- ld t1, seg, riprel, disp
+ ldst t1, seg, riprel, disp
sub t0, rax, t1, flags=(OF, SF, ZF, AF, PF, CF)
mov t1, t1, reg, flags=(CZF,)
microcode = '''
def macroop MOVAPS_R_M {
+ # Check low address.
ldfp xmmh, seg, sib, "DISPLACEMENT + 8", dataSize=8
ldfp xmml, seg, sib, disp, dataSize=8
};
def macroop MOVAPS_R_P {
rdip t7
+ # Check low address.
ldfp xmmh, seg, riprel, "DISPLACEMENT + 8", dataSize=8
ldfp xmml, seg, riprel, disp, dataSize=8
};
def macroop MOVAPS_M_R {
+ # Check low address.
stfp xmmh, seg, sib, "DISPLACEMENT + 8", dataSize=8
stfp xmml, seg, sib, disp, dataSize=8
};
def macroop MOVAPS_P_R {
rdip t7
+ # Check low address.
stfp xmmh, seg, riprel, "DISPLACEMENT + 8", dataSize=8
stfp xmml, seg, riprel, disp, dataSize=8
};
def macroop MOVAPS_R_R {
+ # Check low address.
movfp xmml, xmml, xmmlm, dataSize=8
movfp xmmh, xmmh, xmmhm, dataSize=8
};