Re: [PATCH 1/6] x86: Add VMWare Host Communication Macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/01/15 14:18, Sinclair Yeh wrote:
> These macros will be used by multiple VMWare modules for handling
> host communication.

> +	__asm__ __volatile__ ("inl %%dx" :                              \

This is odd at best; the standard assembly form of this instruction is:

	inl (%dx),%eax

Also, we don't need the underscored forms of asm and volatile for kernel
code.

> +	__asm__ __volatile__ ("movq %13, %%rbp;"        \
> +		"cld; rep outsb; "                      \
> +		"movq %%rbp, %6" :                      \

cld shouldn't be necessary here, DF=0 is part of the normal ABI environment.

You also don't save/restore %rbp here, but you do below?  Seems very odd.

It might be better do so something like:

+#define VMW_PORT_HB_OUT(in1, in2, port_num, magic,     \
+			eax, ebx, ecx, edx, si, di, bp) \
+({                                                     \
+	__asm__ __volatile__ ("xchgq %6, %%rbp;"        \
+		"cld; rep outsb; "                      \
+		"xchgq %%rbp, %6" :                     \
+		"=a"(eax),                              \
+		"=b"(ebx),                              \
+		"=c"(ecx),                              \
+		"=d"(edx),                              \
+		"+S"(si),                               \
+		"+D"(di),                               \
+		"+r"(bp) :                              \
+		"a"(magic),                             \
+		"b"(in1),                               \
+		"c"(in2),                               \
+		"d"(port_num) :                         \
+		"memory", "cc");                        \
+})



_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization



[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux