mirror of
https://github.com/frida/tinycc
synced 2025-01-12 14:49:18 +03:00
i386-asm: fix imul
With imul the 3rd operand defaults to the 2nd on. The previous logic left 'op_type[2]' uninitialized which caused the bug to show up only sometimes.
This commit is contained in:
parent
56d6abdb3d
commit
e500c9118a
@ -676,10 +676,11 @@ static void asm_opcode(TCCState *s1, int opcode)
|
|||||||
g(seg_prefix);
|
g(seg_prefix);
|
||||||
|
|
||||||
v = pa->opcode;
|
v = pa->opcode;
|
||||||
if (v == 0x69 || v == 0x69) {
|
if ((v == 0x69 || v == 0x6b) && nb_ops == 2) {
|
||||||
/* kludge for imul $im, %reg */
|
/* kludge for imul $im, %reg */
|
||||||
nb_ops = 3;
|
nb_ops = 3;
|
||||||
ops[2] = ops[1];
|
ops[2] = ops[1];
|
||||||
|
op_type[2] = op_type[1];
|
||||||
} else if (v == 0xcd && ops[0].e.v == 3 && !ops[0].e.sym) {
|
} else if (v == 0xcd && ops[0].e.v == 3 && !ops[0].e.sym) {
|
||||||
v--; /* int $3 case */
|
v--; /* int $3 case */
|
||||||
nb_ops = 0;
|
nb_ops = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user