ia64/xen-unstable

changeset 14002:b5fc88aad1b0

hvm: Support PUSH from mmio area (opcode 0xFF/6).
Also fix a bogus assertion in vlapic device model.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Sun Feb 18 15:29:40 2007 +0000 (2007-02-18)
parents c5ff7671b9f2
children 5a07ea77a61d
files xen/arch/x86/hvm/io.c xen/arch/x86/hvm/platform.c xen/arch/x86/hvm/vlapic.c xen/include/asm-x86/hvm/io.h
line diff
     1.1 --- a/xen/arch/x86/hvm/io.c	Sat Feb 17 13:26:33 2007 +0000
     1.2 +++ b/xen/arch/x86/hvm/io.c	Sun Feb 18 15:29:40 2007 +0000
     1.3 @@ -686,6 +686,11 @@ static void hvm_mmio_assist(struct cpu_u
     1.4              set_reg_value(size, index, 0, regs, p->data);
     1.5          }
     1.6          break;
     1.7 +
     1.8 +    case INSTR_PUSH:
     1.9 +        mmio_opp->addr += hvm_get_segment_base(current, x86_seg_ss);
    1.10 +        hvm_copy_to_guest_virt(mmio_opp->addr, &p->data, size);
    1.11 +        break;
    1.12      }
    1.13  }
    1.14  
     2.1 --- a/xen/arch/x86/hvm/platform.c	Sat Feb 17 13:26:33 2007 +0000
     2.2 +++ b/xen/arch/x86/hvm/platform.c	Sun Feb 18 15:29:40 2007 +0000
     2.3 @@ -716,6 +716,11 @@ static int mmio_decode(int address_bytes
     2.4              mmio_op->instr = INSTR_SUB;
     2.5              return DECODE_success;
     2.6  
     2.7 +        case 6: /* push */
     2.8 +            mmio_op->instr = INSTR_PUSH;
     2.9 +            mmio_op->operand[0] = mmio_op->operand[1];
    2.10 +            return DECODE_success;
    2.11 +
    2.12          default:
    2.13              printk("%x/%x, This opcode isn't handled yet!\n",
    2.14                     *opcode, ins_subtype);
    2.15 @@ -1131,6 +1136,21 @@ void handle_mmio(unsigned long gpa)
    2.16          mmio_operands(IOREQ_TYPE_XOR, gpa, mmio_op, op_size);
    2.17          break;
    2.18  
    2.19 +    case INSTR_PUSH:
    2.20 +        if ( ad_size == WORD )
    2.21 +        {
    2.22 +            mmio_op->addr = (uint16_t)(regs->esp - op_size);
    2.23 +            regs->esp = mmio_op->addr | (regs->esp & ~0xffff);
    2.24 +        }
    2.25 +        else
    2.26 +        {
    2.27 +            regs->esp -= op_size;
    2.28 +            mmio_op->addr = regs->esp;
    2.29 +        }
    2.30 +        /* send the request and wait for the value */
    2.31 +        send_mmio_req(IOREQ_TYPE_COPY, gpa, 1, op_size, 0, IOREQ_READ, df, 0);
    2.32 +        break;
    2.33 +
    2.34      case INSTR_CMP:        /* Pass through */
    2.35      case INSTR_TEST:
    2.36      case INSTR_SUB:
     3.1 --- a/xen/arch/x86/hvm/vlapic.c	Sat Feb 17 13:26:33 2007 +0000
     3.2 +++ b/xen/arch/x86/hvm/vlapic.c	Sun Feb 18 15:29:40 2007 +0000
     3.3 @@ -459,7 +459,7 @@ static void vlapic_set_tdcr(struct vlapi
     3.4  static void vlapic_read_aligned(struct vlapic *vlapic, unsigned int offset,
     3.5                           unsigned int len, unsigned int *result)
     3.6  {
     3.7 -    ASSERT((len == 4) && (offset > 0) && (offset <= APIC_TDCR));
     3.8 +    ASSERT((len == 4) && (offset >= 0) && (offset <= APIC_TDCR));
     3.9  
    3.10      switch ( offset )
    3.11      {
     4.1 --- a/xen/include/asm-x86/hvm/io.h	Sat Feb 17 13:26:33 2007 +0000
     4.2 +++ b/xen/include/asm-x86/hvm/io.h	Sun Feb 18 15:29:40 2007 +0000
     4.3 @@ -65,6 +65,7 @@
     4.4  #define INSTR_XCHG  14
     4.5  #define INSTR_SUB   15
     4.6  #define INSTR_ADD   16
     4.7 +#define INSTR_PUSH  17
     4.8  
     4.9  #define MAX_INST_LEN      15 /* Maximum instruction length = 15 bytes */
    4.10