i.sib.base = i.base_reg->reg_num;
/* x86-64 ignores REX prefix bit here to avoid decoder
complications. */
- if ((i.base_reg->reg_num & 7) == EBP_REG_NUM)
- {
+ if (!(i.base_reg->reg_flags & RegRex)
+ && (i.base_reg->reg_num == EBP_REG_NUM
+ || i.base_reg->reg_num == ESP_REG_NUM))
default_seg = &ss;
- if (i.disp_operands == 0)
- {
- fake_zero_displacement = 1;
- i.types[op].bitfield.disp8 = 1;
- }
- }
- else if (i.base_reg->reg_num == ESP_REG_NUM)
+ if (i.base_reg->reg_num == 5 && i.disp_operands == 0)
{
- default_seg = &ss;
+ fake_zero_displacement = 1;
+ i.types[op].bitfield.disp8 = 1;
}
i.sib.scale = i.log2_scale_factor;
if (i.index_reg == 0)
--- /dev/null
+#objdump: -dw
+#name: x86-64 segment overrides
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <segovr>:
+[ ]*[a-f0-9]+: 8b 00[ ]+mov[ ]+\(%rax\),%eax
+[ ]*[a-f0-9]+: 8b 01[ ]+mov[ ]+\(%rcx\),%eax
+[ ]*[a-f0-9]+: 8b 02[ ]+mov[ ]+\(%rdx\),%eax
+[ ]*[a-f0-9]+: 8b 03[ ]+mov[ ]+\(%rbx\),%eax
+[ ]*[a-f0-9]+: 3e 8b 04 24[ ]+mov[ ]+%ds:\(%rsp\),%eax
+[ ]*[a-f0-9]+: 3e 8b 45 00[ ]+mov[ ]+%ds:((0x)?0)?\(%rbp\),%eax
+[ ]*[a-f0-9]+: 8b 06[ ]+mov[ ]+\(%rsi\),%eax
+[ ]*[a-f0-9]+: 8b 07[ ]+mov[ ]+\(%rdi\),%eax
+[ ]*[a-f0-9]+: 41 8b 00[ ]+mov[ ]+\(%r8\),%eax
+[ ]*[a-f0-9]+: 41 8b 01[ ]+mov[ ]+\(%r9\),%eax
+[ ]*[a-f0-9]+: 41 8b 02[ ]+mov[ ]+\(%r10\),%eax
+[ ]*[a-f0-9]+: 41 8b 03[ ]+mov[ ]+\(%r11\),%eax
+[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),%eax
+#pass
--- /dev/null
+# 64bit segment overrides
+
+ .text
+segovr:
+.irp seg, ds, ss
+ .irp reg, ax, cx, dx, bx, sp, bp, si, di, 8, 9, 10, 11, 12, 13, 14, 15
+ mov %\seg:(%r\reg), %eax
+ .endr
+.endr