From 42fe6ce765989792d2990e2da25b4b3255a1381d Mon Sep 17 00:00:00 2001 From: Chuck Crayne Date: Sun, 3 Jun 2007 02:42:41 +0000 Subject: [PATCH] Support 32-bit direct addressing in 64-bit mode without base or index regs --- assemble.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/assemble.c b/assemble.c index e32df62..0c63eb9 100644 --- a/assemble.c +++ b/assemble.c @@ -1667,10 +1667,20 @@ static ea *process_ea(operand * input, ea * output, int addrbits, /* it's a pure offset */ if (input->addr_size) addrbits = input->addr_size; - - output->sib_present = FALSE; - output->bytes = (addrbits != 16 ? 4 : 2); - output->modrm = (addrbits != 16 ? 5 : 6) | ((rfield & 7) << 3); + if (addrbits == 64) { + int scale, index, base; + output->sib_present = TRUE; + scale = 0; + index = 4; + base = 5; + output->sib = (scale << 6) | (index << 3) | base; + output->bytes = 4; + output->modrm = 4 | ((rfield & 7) << 3); + } else { + output->sib_present = FALSE; + output->bytes = (addrbits != 16 ? 4 : 2); + output->modrm = (addrbits != 16 ? 5 : 6) | ((rfield & 7) << 3); + } } else { /* it's an indirection */ int i = input->indexreg, b = input->basereg, s = input->scale; int32_t o = input->offset, seg = input->segment; -- 2.7.4