Feature request: inline assembly clobbering
Do you have any suggested syntax?
Do you have any suggested syntax?
not at all but here goes some:
uint cr0;
asm
{
"movl %0, $cr0 "
}(eax);
another thing i though was explicit input/output operands maybe using attributes style?
Umm.. did you test the asm syntax yet?
Umm.. did you test the asm syntax yet?
i haven't figure out how to do blocks and i think processing asm blocks at the end is a bad idea in some cases like:
u32 cr0;
asm volatile ("mov %%cr0, %0" : "=r" (cr0));
cr0 |= 1 << 31;
asm volatile ("mov %0, %%cr0" : : "r" (cr0));
Umm.. did you test the asm syntax yet?
i haven't figure out how to do blocks and i think processing asm blocks at the end is a bad idea in some cases like:
u32 cr0; asm volatile ("mov %%cr0, %0" : "=r" (cr0)); cr0 |= 1 << 31; asm volatile ("mov %0, %%cr0" : : "r" (cr0));
this is an example in C
The way asm works in C3 is like:
int x;
asm
{
in $eax, 3;
in $ax, $dx;
incb $al;
incl [&x];
...
}
A clobber would perhaps look like
asm
{
@invalidate($eax);
@invalidate(mem);
}
The way asm works in C3 is like:
int x; asm { in $eax, 3; in $ax, $dx; incb $al; incl [&x]; ... }
A clobber would perhaps look like
asm { @invalidate($eax); @invalidate(mem); }
yeah that looks nice