ia64/xen-unstable

changeset 13620:348c2983ff02

emulator: Add new hook functions for load/store privileged state.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu Jan 25 13:02:03 2007 +0000 (2007-01-25)
parents a9165141e52d
children 2a9b6b1f848f
files xen/arch/x86/x86_emulate.c xen/include/asm-x86/x86_emulate.h
line diff
     1.1 --- a/xen/arch/x86/x86_emulate.c	Thu Jan 25 12:30:25 2007 +0000
     1.2 +++ b/xen/arch/x86/x86_emulate.c	Thu Jan 25 13:02:03 2007 +0000
     1.3 @@ -4,6 +4,7 @@
     1.4   * Generic x86 (32-bit and 64-bit) instruction decoder and emulator.
     1.5   * 
     1.6   * Copyright (c) 2005-2007 Keir Fraser
     1.7 + * Copyright (c) 2005-2007 XenSource Inc.
     1.8   * 
     1.9   * This program is free software; you can redistribute it and/or modify
    1.10   * it under the terms of the GNU General Public License as published by
     2.1 --- a/xen/include/asm-x86/x86_emulate.h	Thu Jan 25 12:30:25 2007 +0000
     2.2 +++ b/xen/include/asm-x86/x86_emulate.h	Thu Jan 25 13:02:03 2007 +0000
     2.3 @@ -4,6 +4,7 @@
     2.4   * Generic x86 (32-bit and 64-bit) instruction decoder and emulator.
     2.5   * 
     2.6   * Copyright (c) 2005-2007 Keir Fraser
     2.7 + * Copyright (c) 2005-2007 XenSource Inc.
     2.8   * 
     2.9   * This program is free software; you can redistribute it and/or modify
    2.10   * it under the terms of the GNU General Public License as published by
    2.11 @@ -69,16 +70,19 @@ struct x86_emulate_ops
    2.12  {
    2.13      /*
    2.14       * All functions:
    2.15 +     *  @ctxt:  [IN ] Emulation context info as passed to the emulator.
    2.16 +     * All memory-access functions:
    2.17       *  @seg:   [IN ] Segment being dereferenced (specified as x86_seg_??).
    2.18       *  @offset:[IN ] Offset within segment.
    2.19 -     *  @ctxt:  [IN ] Emulation context info as passed to the emulator.
    2.20 +     * Read functions:
    2.21 +     *  @val:   [OUT] Value read, zero-extended to 'ulong'.
    2.22 +     * Write functions:
    2.23 +     *  @val:   [IN ] Value to write (low-order bytes used as req'd).
    2.24 +     * Variable-length access functions:
    2.25 +     *  @bytes: [IN ] Number of bytes to read or write.
    2.26       */
    2.27  
    2.28 -    /*
    2.29 -     * read: Emulate a memory read.
    2.30 -     *  @val:   [OUT] Value read from memory, zero-extended to 'ulong'.
    2.31 -     *  @bytes: [IN ] Number of bytes to read from memory.
    2.32 -     */
    2.33 +    /* read: Emulate a memory read. */
    2.34      int (*read)(
    2.35          enum x86_segment seg,
    2.36          unsigned long offset,
    2.37 @@ -97,11 +101,7 @@ struct x86_emulate_ops
    2.38          unsigned int bytes,
    2.39          struct x86_emulate_ctxt *ctxt);
    2.40  
    2.41 -    /*
    2.42 -     * write: Emulate a memory write.
    2.43 -     *  @val:   [IN ] Value to write to memory (low-order bytes used as req'd).
    2.44 -     *  @bytes: [IN ] Number of bytes to write to memory.
    2.45 -     */
    2.46 +    /* write: Emulate a memory write. */
    2.47      int (*write)(
    2.48          enum x86_segment seg,
    2.49          unsigned long offset,
    2.50 @@ -113,7 +113,6 @@ struct x86_emulate_ops
    2.51       * cmpxchg: Emulate an atomic (LOCKed) CMPXCHG operation.
    2.52       *  @old:   [IN ] Value expected to be current at @addr.
    2.53       *  @new:   [IN ] Value to write to @addr.
    2.54 -     *  @bytes: [IN ] Number of bytes to access using CMPXCHG.
    2.55       */
    2.56      int (*cmpxchg)(
    2.57          enum x86_segment seg,
    2.58 @@ -141,6 +140,89 @@ struct x86_emulate_ops
    2.59          unsigned long new_lo,
    2.60          unsigned long new_hi,
    2.61          struct x86_emulate_ctxt *ctxt);
    2.62 +
    2.63 +    /*
    2.64 +     * read_io: Read from I/O port(s).
    2.65 +     *  @port:  [IN ] Base port for access.
    2.66 +     */
    2.67 +    int (*read_io)(
    2.68 +        unsigned int port,
    2.69 +        unsigned int bytes,
    2.70 +        unsigned long *val,
    2.71 +        struct x86_emulate_ctxt *ctxt);
    2.72 +
    2.73 +    /*
    2.74 +     * write_io: Write to I/O port(s).
    2.75 +     *  @port:  [IN ] Base port for access.
    2.76 +     */
    2.77 +    int (*write_io)(
    2.78 +        unsigned int port,
    2.79 +        unsigned int bytes,
    2.80 +        unsigned long val,
    2.81 +        struct x86_emulate_ctxt *ctxt);
    2.82 +
    2.83 +    /*
    2.84 +     * read_cr: Read from control register.
    2.85 +     *  @reg:   [IN ] Register to read (0-15).
    2.86 +     */
    2.87 +    int (*read_cr)(
    2.88 +        unsigned int reg,
    2.89 +        unsigned long *val,
    2.90 +        struct x86_emulate_ctxt *ctxt);
    2.91 +
    2.92 +    /*
    2.93 +     * write_cr: Write to control register.
    2.94 +     *  @reg:   [IN ] Register to write (0-15).
    2.95 +     */
    2.96 +    int (*write_cr)(
    2.97 +        unsigned int reg,
    2.98 +        unsigned long val,
    2.99 +        struct x86_emulate_ctxt *ctxt);
   2.100 +
   2.101 +    /*
   2.102 +     * read_dr: Read from debug register.
   2.103 +     *  @reg:   [IN ] Register to read (0-15).
   2.104 +     */
   2.105 +    int (*read_dr)(
   2.106 +        unsigned int reg,
   2.107 +        unsigned long *val,
   2.108 +        struct x86_emulate_ctxt *ctxt);
   2.109 +
   2.110 +    /*
   2.111 +     * write_dr: Write to debug register.
   2.112 +     *  @reg:   [IN ] Register to write (0-15).
   2.113 +     */
   2.114 +    int (*write_dr)(
   2.115 +        unsigned int reg,
   2.116 +        unsigned long val,
   2.117 +        struct x86_emulate_ctxt *ctxt);
   2.118 +
   2.119 +    /*
   2.120 +     * read_msr: Read from model-specific register.
   2.121 +     *  @reg:   [IN ] Register to read.
   2.122 +     */
   2.123 +    int (*read_msr)(
   2.124 +        unsigned long reg,
   2.125 +        uint64_t *val,
   2.126 +        struct x86_emulate_ctxt *ctxt);
   2.127 +
   2.128 +    /*
   2.129 +     * write_dr: Write to model-specific register.
   2.130 +     *  @reg:   [IN ] Register to write.
   2.131 +     */
   2.132 +    int (*write_msr)(
   2.133 +        unsigned long reg,
   2.134 +        uint64_t val,
   2.135 +        struct x86_emulate_ctxt *ctxt);
   2.136 +
   2.137 +    /* write_rflags: Modify privileged bits in RFLAGS. */
   2.138 +    int (*write_rflags)(
   2.139 +        unsigned long val,
   2.140 +        struct x86_emulate_ctxt *ctxt);
   2.141 +
   2.142 +    /* wbinvd: Write-back and invalidate cache contents. */
   2.143 +    int (*wbinvd)(
   2.144 +        struct x86_emulate_ctxt *ctxt);
   2.145  };
   2.146  
   2.147  struct cpu_user_regs;