Arnd Bergmann wrote: > On Thursday 09 November 2006 14:36, Avi Kivity wrote: > >>> I'm not an expert on inline assembly, but don't you need an extra >>> '"m" (phys_addr)' to make sure that gcc actually puts the variable >>> on the stack instead of passing a NULL pointer as '"a"(&phys_addr)'? >>> >> Taking a variable's address should force its contents into memory (like >> calling an uninlined function with &var). >> > > No it doesn't. You're not telling gcc that the inline assembly cares > about the contents of the variable, so it could be a reference to > a stack slot while the contents are still in a register.
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); > 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). -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel