Bug 18553 – Inline assembler: CR2, CR3 control registers not available in 64-bit code
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-03-04T19:25:28Z
Last change time
2018-03-22T07:33:17Z
Assigned to
No Owner
Creator
Jon
Comments
Comment #0 by jonfandrew — 2018-03-04T19:25:28Z
The following code fails to compile in 64-bit mode, even though CR2 and CR3 become 64-bit registers in 64-bit code.
void main()
{
size_t faultAddress;
asm
{
mov RAX, CR2;
mov faultAddress[RBP], RAX;
}
}
The equivalent 32-bit code compiles fine when using dmd -m32:
void main()
{
size_t faultAddress;
asm
{
mov EAX, CR2;
mov faultAddress[EBP], EAX;
}
}
I think adding CR2 and CR3 to the regtab64 array in iasm.d will correct the problem, but I'm not super smart on the compiler internals and didn't want to embarrass myself with an ignorant PR.
-Doc