Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1281274

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

From "H. Peter Anvin" <hpa@zytor.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/6] x86: Add VMWare Host Communication Macros
Date 2015-12-01 23:50 +0100
Message-ID <qB1Ue-7g2-7@gated-at.bofh.it> (permalink)
References <qB1rb-76P-3@gated-at.bofh.it> <qB1rb-76P-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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");                        \
+})



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/6] x86: Add VMWare Host Communication Macros "Sinclair Yeh" <syeh@vmware.com> - 2015-12-01 23:20 +0100
  [PATCH 2/6] x86: Update vmware.c to use the common VMW_PORT macros "Sinclair Yeh" <syeh@vmware.com> - 2015-12-01 23:20 +0100
  [PATCH 6/6] VMware balloon: Update vmw_balloon.c to use the VMW_PORT macro "Sinclair Yeh" <syeh@vmware.com> - 2015-12-01 23:20 +0100
    Re: [PATCH 6/6] VMware balloon: Update vmw_balloon.c to use the  VMW_PORT macro Xavier Deguillard <xdeguillard@vmware.com> - 2015-12-01 23:40 +0100
      Re: [PATCH 6/6] VMware balloon: Update vmw_balloon.c to use the  VMW_PORT macro "Sinclair Yeh" <syeh@vmware.com> - 2015-12-02 00:20 +0100
  Re: [PATCH 1/6] x86: Add VMWare Host Communication Macros Xavier Deguillard <xdeguillard@vmware.com> - 2015-12-01 23:40 +0100
  Re: [PATCH 1/6] x86: Add VMWare Host Communication Macros "H. Peter Anvin" <hpa@zytor.com> - 2015-12-01 23:50 +0100
    Re: [PATCH 1/6] x86: Add VMWare Host Communication Macros "Sinclair Yeh" <syeh@vmware.com> - 2015-12-04 23:40 +0100

csiph-web