lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20151204223308.GA28421@syeh-linux>
Date:	Fri, 4 Dec 2015 14:33:08 -0800
From:	"Sinclair Yeh" <syeh@...are.com>
To:	"H. Peter Anvin" <hpa@...or.com>
Cc:	x86@...nel.org, Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	Alok Kataria <akataria@...are.com>,
	linux-kernel@...r.kernel.org,
	virtualization@...ts.linux-foundation.org,
	Xavier Deguillard <xdeguillard@...are.com>
Subject: Re: [PATCH 1/6] x86: Add VMWare Host Communication Macros

Thanks Peter.


On Tue, Dec 01, 2015 at 02:49:11PM -0800, H. Peter Anvin wrote:
> 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

Ok, I'm not sure why this worked and compiled before.  Fixed.

> 
> 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.

Good catch.  Fixed.

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

This is great.  Changed.

Updated patch set incoming.

Sinclair

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ