[lkml]   [2006]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [kvm-devel] [PATCH] KVM: Avoid using vmx instruction directly
On Thursday 09 November 2006 15:52, Avi Kivity wrote:
> Wouldn't that make inline assembly useless?  Suppose the contents is
> itself a pointer.  What about the pointed-to contents?
> e.g.
>     int x = 3;
>     int *y = &x;
>     int z;
>     asm ("mov %1, %%rax; movl (%%rax), %0" : "=r"(z) : "g"(y) : "rax");
>     assert(z == 3);

Same here, you need to tell gcc what is really accessed, like

asm ("mov %1, %%rax; movl (%%rax), %0" : "=r"(z) : "g"(y), "m"(*y) : "rax");

I know that the s390 kernel developers have hit that problem
frequently with inline assemblies. It may be that it's harder
to hit on x86, because there are fewer registers available and
data therefore tends to spill to the stack.

> > Or gcc
> > might move the assignment of phys_addr to after the inline assembly.
> >  
> "asm volatile" prevents that (and I'm not 100% sure it's necessary).

Yes, I think that's right. The 'volatile' should not be necessary though,
if you get the inputs right.

Arnd <><
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-11-09 17:41    [W:0.090 / U:8.816 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site