aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-04-16 11:52:08 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-04-16 11:52:08 +0100
commit5f4f4697d5b159b712727fb8cbc327187b0f22a8 (patch)
tree327471856627756ffe9ee12d8b0384bd7c2481f6
parentd09486dba36ab114e3f85ad034c68f2c1e808690 (diff)
downloadxen-5f4f4697d5b159b712727fb8cbc327187b0f22a8.tar.gz
xen-5f4f4697d5b159b712727fb8cbc327187b0f22a8.tar.bz2
xen-5f4f4697d5b159b712727fb8cbc327187b0f22a8.zip
cpuidle: Fix PV RTC I/O port access hook
Call hook before writing to I/O ports. Only hook single-byte writes. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
-rw-r--r--xen/arch/x86/traps.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index cbc0d012a0..98555a42d4 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1564,11 +1564,11 @@ static void guest_io_write(
{
switch ( bytes ) {
case 1:
+ if ( ((port == 0x70) || (port == 0x71)) && pv_rtc_handler )
+ pv_rtc_handler(port, (uint8_t)data);
outb((uint8_t)data, port);
if ( pv_post_outb_hook )
pv_post_outb_hook(port, (uint8_t)data);
- if ( ((port == 0x71) || (port == 0x70)) && pv_rtc_handler )
- pv_rtc_handler(port, (uint8_t)data);
break;
case 2:
outw((uint16_t)data, port);
@@ -1937,11 +1937,13 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
goto fail;
if ( admin_io_okay(port, op_bytes, v, regs) )
{
+ if ( (op_bytes == 1) &&
+ ((port == 0x71) || (port == 0x70)) &&
+ pv_rtc_handler )
+ pv_rtc_handler(port, regs->eax);
io_emul(regs);
if ( (op_bytes == 1) && pv_post_outb_hook )
pv_post_outb_hook(port, regs->eax);
- if ( ((port == 0x71) || (port == 0x70)) && pv_rtc_handler )
- pv_rtc_handler(port, regs->eax);
}
else
{