ia64/xen-unstable

changeset 19550:b14dc215dd19

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>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Apr 16 11:52:08 2009 +0100 (2009-04-16)
parents 573e6673e9e0
children 087854cf3ed9
files xen/arch/x86/traps.c
line diff
     1.1 --- a/xen/arch/x86/traps.c	Wed Apr 15 15:47:25 2009 +0100
     1.2 +++ b/xen/arch/x86/traps.c	Thu Apr 16 11:52:08 2009 +0100
     1.3 @@ -1564,11 +1564,11 @@ static void guest_io_write(
     1.4      {
     1.5          switch ( bytes ) {
     1.6          case 1:
     1.7 +            if ( ((port == 0x70) || (port == 0x71)) && pv_rtc_handler )
     1.8 +                pv_rtc_handler(port, (uint8_t)data);
     1.9              outb((uint8_t)data, port);
    1.10              if ( pv_post_outb_hook )
    1.11                  pv_post_outb_hook(port, (uint8_t)data);
    1.12 -            if ( ((port == 0x71) || (port == 0x70)) && pv_rtc_handler )
    1.13 -                pv_rtc_handler(port, (uint8_t)data);
    1.14              break;
    1.15          case 2:
    1.16              outw((uint16_t)data, port);
    1.17 @@ -1937,11 +1937,13 @@ static int emulate_privileged_op(struct 
    1.18              goto fail;
    1.19          if ( admin_io_okay(port, op_bytes, v, regs) )
    1.20          {
    1.21 +            if ( (op_bytes == 1) &&
    1.22 +                 ((port == 0x71) || (port == 0x70)) &&
    1.23 +                 pv_rtc_handler )
    1.24 +                pv_rtc_handler(port, regs->eax);
    1.25              io_emul(regs);            
    1.26              if ( (op_bytes == 1) && pv_post_outb_hook )
    1.27                  pv_post_outb_hook(port, regs->eax);
    1.28 -            if ( ((port == 0x71) || (port == 0x70)) && pv_rtc_handler )
    1.29 -                pv_rtc_handler(port, regs->eax);
    1.30          }
    1.31          else
    1.32          {