svn commit: r243349 - projects/bhyve/usr.sbin/bhyve
Neel Natu
neel at FreeBSD.org
Wed Nov 21 00:14:04 UTC 2012
Author: neel
Date: Wed Nov 21 00:14:03 2012
New Revision: 243349
URL: http://svnweb.freebsd.org/changeset/base/243349
Log:
Mask the %eax register properly based on whether the "out" instruction is
operating on 1, 2 or 4 bytes.
There could be garbage in the unused bytes so zero them off.
Obtained from: NetApp
Modified:
projects/bhyve/usr.sbin/bhyve/inout.c
Modified: projects/bhyve/usr.sbin/bhyve/inout.c
==============================================================================
--- projects/bhyve/usr.sbin/bhyve/inout.c Tue Nov 20 21:26:13 2012 (r243348)
+++ projects/bhyve/usr.sbin/bhyve/inout.c Wed Nov 21 00:14:03 2012 (r243349)
@@ -74,6 +74,7 @@ emulate_inout(struct vmctx *ctx, int vcp
uint32_t *eax, int strict)
{
int flags;
+ uint32_t mask;
inout_func_t handler;
void *arg;
@@ -84,6 +85,21 @@ emulate_inout(struct vmctx *ctx, int vcp
if (strict && handler == default_inout)
return (-1);
+ if (!in) {
+ switch (bytes) {
+ case 1:
+ mask = 0xff;
+ break;
+ case 2:
+ mask = 0xffff;
+ break;
+ default:
+ mask = 0xffffffff;
+ break;
+ }
+ *eax = *eax & mask;
+ }
+
flags = inout_handlers[port].flags;
arg = inout_handlers[port].arg;
More information about the svn-src-projects
mailing list