Christian Borntraeger wrote:
Am Donnerstag, 26. Juni 2008 schrieb Avi Kivity:
I don't think "p" should force the contents into memory? Perhaps "m"(*(char *)buffer)?

Anthony, I don't see why a memory clobber would tell gcc that the variables is actually used. The problem is with the void * -> unsigned long cast (__pa), once that happens gcc loses track. It's probably needed anyway since hypercalls _do_ clobber memory.

I I think about that again, the correct solution should be to use 2 input constraints for parameters together with the memory clobber on hypercall.

I think something like the following covers all cases:

static inline long kvm_hypercall1(unsigned int nr, unsigned long p1)
{
        long ret;
        asm volatile(KVM_HYPERCALL
                     : "=a"(ret)
                     : "a"(nr), "b"(p1), "m"(*(char *) p1)
                     : "memory" );
        return ret;
}


The address and the memory content of p1 (if it is a pointer) is not ommitted by gcc. Furthermore, the memory clobbering nature of a hypercall is specified as well.

That only works if p1 is a virtual address. x86 (and ppc) hypercalls use physical addresses.


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to