svn commit: r241744 - projects/bhyve/usr.sbin/bhyve

Jilles Tjoelker jilles at stack.nl
Sun Oct 21 12:10:13 UTC 2012


On Fri, Oct 19, 2012 at 06:11:18PM +0000, Peter Grehan wrote:
> Author: grehan
> Date: Fri Oct 19 18:11:17 2012
> New Revision: 241744
> URL: http://svn.freebsd.org/changeset/base/241744

> [snip]
>    instruction_emul.c/h - remove old region interface.
>    Use gpa from EPT exit to avoid a tablewalk to
>    determine operand address. Determine operand size
>    and use when calling through to region handler.
> [snip]
> Modified: projects/bhyve/usr.sbin/bhyve/instruction_emul.c
> ==============================================================================
> --- projects/bhyve/usr.sbin/bhyve/instruction_emul.c	Fri Oct 19 17:45:56 2012	(r241743)
> +++ projects/bhyve/usr.sbin/bhyve/instruction_emul.c	Fri Oct 19 18:11:17 2012	(r241744)
> [snip]
> +static uint64_t
> +adjust_write(uint64_t reg, uint64_t operand, int size)
> +{
> +	uint64_t val;
> +
> +	switch (size) {
> +	case 1:
> +		val = (reg & ~0xff) | (operand & 0xff);
> +		break;
> +	case 2:
> +		val = (reg & ~0xffff) | (operand & 0xffff);
> +		break;
> +	case 4:
> +		val = (reg & ~0xffffffff) | (operand & 0xffffffff);
> +		break;
> +	case 8:
> +		val = operand;
> +	default:
> +		break;
> +	}
> +
> +	return (val);
>  }

Case 4 looks wrong. A 32-bit write clears the top 32 bits of the
register instead of preserving them.

I have no idea whether this will actually fix/break anything.

-- 
Jilles Tjoelker


More information about the svn-src-projects mailing list