ia64/xen-unstable

changeset 11469:8c0cf4d3c412

[XEN] Allow direct reads of port 0x61 by any guest.
Often used by BIOS code which may be executed e.g., when starting
an X server.
From: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Sep 13 14:46:54 2006 +0100 (2006-09-13)
parents 3bff5c5b9206
children 6160da08a238
files xen/arch/x86/traps.c
line diff
     1.1 --- a/xen/arch/x86/traps.c	Wed Sep 13 14:34:34 2006 +0100
     1.2 +++ b/xen/arch/x86/traps.c	Wed Sep 13 14:46:54 2006 +0100
     1.3 @@ -1003,7 +1003,21 @@ static inline int admin_io_okay(
     1.4  }
     1.5  
     1.6  /* Check admin limits. Silently fail the access if it is disallowed. */
     1.7 -#define inb_user(_p, _d, _r) (admin_io_okay(_p, 1, _d, _r) ? inb(_p) : ~0)
     1.8 +static inline unsigned char inb_user(
     1.9 +    unsigned int port, struct vcpu *v, struct cpu_user_regs *regs)
    1.10 +{
    1.11 +    /*
    1.12 +     * Allow read access to port 0x61. Bit 4 oscillates with period 30us, and
    1.13 +     * so it is often used for timing loops in BIOS code. This hack can go
    1.14 +     * away when we have separate read/write permission rangesets.
    1.15 +     * Note that we could emulate bit 4 instead of directly reading port 0x61,
    1.16 +     * but there's not really a good reason to do so.
    1.17 +     */
    1.18 +    if ( admin_io_okay(port, 1, v, regs) || (port == 0x61) )
    1.19 +        return inb(port);
    1.20 +    return ~0;
    1.21 +}
    1.22 +//#define inb_user(_p, _d, _r) (admin_io_okay(_p, 1, _d, _r) ? inb(_p) : ~0)
    1.23  #define inw_user(_p, _d, _r) (admin_io_okay(_p, 2, _d, _r) ? inw(_p) : ~0)
    1.24  #define inl_user(_p, _d, _r) (admin_io_okay(_p, 4, _d, _r) ? inl(_p) : ~0)
    1.25  #define outb_user(_v, _p, _d, _r) \