LDC inline assembler

Kai Nacke via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Wed May 6 03:31:13 PDT 2015


Hi Mike!

This should do the trick:

extern(C) ulong dosyscall(ulong a, ulong b, ulong c)
{
     import ldc.llvmasm;

     ulong result = __asm!ulong("syscall", 
"={rax},{rax},{rdi},{rsi},{rdx},~{rcx},~{r11}", 1, a, b, c);
     return result;
}

A named register must be surrounded with { }. If any register is 
ok then you can use simply r. As far as I know there is no way 
that to tell LLVM that a memory range is clobbered.

Regardsm
Kai


More information about the digitalmars-d-ldc mailing list