Bug 5706 – Incorrect opcode prefix generated for x86_64 inline assembly

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2011-03-05T10:48:00Z
Last change time
2011-03-29T19:48:29Z
Assigned to
nobody
Creator
govellius

Comments

Comment #0 by govellius — 2011-03-05T10:48:34Z
/* Disassembly of section .text._D1a1aFZv: 0000000000000000 <_D1a1aFZv>: 0: 48 83 f8 01 cmp $0x1,%rax 4: 48 83 f8 01 cmp $0x1,%rax */ void a() { asm { naked; cmp RAX, 1; cmp R8 , 1; // should have REX.b set ( 49 83 f8 01 ) } }
Comment #1 by govellius — 2011-03-06T04:43:01Z
I ran into another one I did not notice earlier. As a side note i've patched my local copy of backend/ptrntab.c to include two opcodes SYSCALL/SYSRET but I don't know how to properly handle SYSRET for 64bit mode as it needs a REX.w prefix === /* Disassembly of section .text._D1a1aFZv: 0000000000000000 <_D1a1aFZv>: 0: 48 89 c2 mov %rax,%rdx 3: 48 89 c2 mov %rax,%rdx */ void a() { asm { naked; mov RDX, RAX; mov R10, RAX; // should have REX.b set ( 49 89 c2 ) } }
Comment #2 by bugzilla — 2011-03-29T19:48:29Z