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
This commit is contained in:
parent
6f600a733a
commit
6f52967965
@ -74,6 +74,7 @@ emulate_inout(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
|
||||
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 vcpu, int in, int port, int bytes,
|
||||
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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user