mirror of
https://github.com/danog/ir.git
synced 2025-01-22 05:31:32 +01:00
SWITCH elated fixes
This commit is contained in:
parent
4a39bda507
commit
77f7d7e2af
12
ir_disasm.c
12
ir_disasm.c
@ -228,6 +228,14 @@ static uint64_t ir_disasm_rodata_reference(csh cs, const cs_insn *insn)
|
||||
return (uint32_t)insn->detail->x86.operands[i].mem.disp;
|
||||
}
|
||||
}
|
||||
if (cs_insn_group(cs, insn, X86_GRP_JUMP)) {
|
||||
for (i = 0; i < insn->detail->x86.op_count; i++) {
|
||||
if (insn->detail->x86.operands[i].type == X86_OP_MEM
|
||||
&& insn->detail->x86.operands[i].mem.disp) {
|
||||
return (uint32_t)insn->detail->x86.operands[i].mem.disp;
|
||||
}
|
||||
}
|
||||
}
|
||||
#elif defined(IR_TARGET_X64)
|
||||
for (i = 0; i < insn->detail->x86.op_count; i++) {
|
||||
if (insn->detail->x86.operands[i].type == X86_OP_MEM
|
||||
@ -617,6 +625,10 @@ int ir_disasm(const char *name,
|
||||
}
|
||||
r++;
|
||||
}
|
||||
if (p - 1 != q && *(q-2) == '-') {
|
||||
q--;
|
||||
addr = (uint32_t)(-addr);
|
||||
}
|
||||
if (addr >= (uint64_t)(uintptr_t)start && addr < (uint64_t)(uintptr_t)orig_end) {
|
||||
l = ir_addrtab_find(&labels, (uint32_t)((uintptr_t)addr - (uintptr_t)start));
|
||||
if (l >= 0) {
|
||||
|
@ -4717,7 +4717,7 @@ static void ir_emit_switch(ir_ctx *ctx, int b, ir_ref def, ir_insn *insn)
|
||||
}
|
||||
|
||||
if (IR_IS_32BIT(type, min)) {
|
||||
offset = -min.i64 * 8;
|
||||
offset = -min.i64 * sizeof(void*);
|
||||
if (IR_IS_SIGNED_32BIT(offset)) {
|
||||
| ASM_REG_IMM_OP cmp, type, op2_reg, min.i32
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user