ia64/xen-unstable

annotate xen/include/asm-x86/hvm/support.h @ 16427:fd3f6d814f6d

x86: single step after instruction emulation

Inject single step trap after emulating instructions if guest's
EFLAGS.TF is set.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Nov 22 18:28:47 2007 +0000 (2007-11-22)
parents db9f62d8f7f4
children e818c24cec03
rev   line source
kaf24@8708 1 /*
kaf24@8708 2 * support.h: HVM support routines used by VT-x and SVM.
kaf24@8708 3 *
kaf24@8708 4 * Leendert van Doorn, leendert@watson.ibm.com
kaf24@8708 5 * Copyright (c) 2005, International Business Machines Corporation.
kaf24@8708 6 *
kaf24@8708 7 * This program is free software; you can redistribute it and/or modify it
kaf24@8708 8 * under the terms and conditions of the GNU General Public License,
kaf24@8708 9 * version 2, as published by the Free Software Foundation.
kaf24@8708 10 *
kaf24@8708 11 * This program is distributed in the hope it will be useful, but WITHOUT
kaf24@8708 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
kaf24@8708 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
kaf24@8708 14 * more details.
kaf24@8708 15 *
kaf24@8708 16 * You should have received a copy of the GNU General Public License along with
kaf24@8708 17 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
kaf24@8708 18 * Place - Suite 330, Boston, MA 02111-1307 USA.
kaf24@8708 19 */
kaf24@8708 20
kaf24@8708 21 #ifndef __ASM_X86_HVM_SUPPORT_H__
kaf24@8708 22 #define __ASM_X86_HVM_SUPPORT_H__
kaf24@8708 23
kaf24@8708 24 #include <xen/sched.h>
keir@16152 25 #include <xen/hvm/save.h>
kaf24@8708 26 #include <asm/types.h>
kaf24@8708 27 #include <asm/regs.h>
kaf24@8708 28 #include <asm/processor.h>
kaf24@8708 29
kaf24@9113 30 #ifndef NDEBUG
kaf24@8708 31 #define HVM_DEBUG 1
kaf24@9113 32 #else
kfraser@10908 33 #define HVM_DEBUG 1
kaf24@9113 34 #endif
kaf24@8708 35
keir@14851 36 static inline vcpu_iodata_t *get_ioreq(struct vcpu *v)
kaf24@8708 37 {
keir@14851 38 struct domain *d = v->domain;
keir@14851 39 shared_iopage_t *p = d->arch.hvm_domain.ioreq.va;
keir@14851 40 ASSERT((v == current) || spin_is_locked(&d->arch.hvm_domain.ioreq.lock));
keir@14851 41 ASSERT(d->arch.hvm_domain.ioreq.va != NULL);
keir@14851 42 return &p->vcpu_iodata[v->vcpu_id];
kaf24@8708 43 }
kaf24@8708 44
kaf24@8708 45 /* XXX these are really VMX specific */
kaf24@8708 46 #define TYPE_MOV_TO_DR (0 << 4)
kaf24@8708 47 #define TYPE_MOV_FROM_DR (1 << 4)
kaf24@8708 48 #define TYPE_MOV_TO_CR (0 << 4)
kaf24@8708 49 #define TYPE_MOV_FROM_CR (1 << 4)
kaf24@8708 50 #define TYPE_CLTS (2 << 4)
kaf24@8708 51 #define TYPE_LMSW (3 << 4)
kaf24@8708 52
keir@16427 53 #define HVM_DELIVER_NO_ERROR_CODE -1
kaf24@8708 54
kaf24@8708 55 #if HVM_DEBUG
kaf24@8708 56 #define DBG_LEVEL_0 (1 << 0)
kaf24@8708 57 #define DBG_LEVEL_1 (1 << 1)
kaf24@8708 58 #define DBG_LEVEL_2 (1 << 2)
kaf24@8708 59 #define DBG_LEVEL_3 (1 << 3)
kaf24@8708 60 #define DBG_LEVEL_IO (1 << 4)
kaf24@8708 61 #define DBG_LEVEL_VMMU (1 << 5)
kaf24@8708 62 #define DBG_LEVEL_VLAPIC (1 << 6)
kaf24@8708 63 #define DBG_LEVEL_VLAPIC_TIMER (1 << 7)
kaf24@9146 64 #define DBG_LEVEL_VLAPIC_INTERRUPT (1 << 8)
kaf24@8708 65 #define DBG_LEVEL_IOAPIC (1 << 9)
kfraser@15106 66 #define DBG_LEVEL_HCALL (1 << 10)
keir@16186 67 #define DBG_LEVEL_MSR (1 << 11)
kaf24@8708 68
kaf24@8708 69 extern unsigned int opt_hvm_debug_level;
tdeegan@11172 70 #define HVM_DBG_LOG(level, _f, _a...) \
tdeegan@11172 71 do { \
kfraser@11654 72 if ( unlikely((level) & opt_hvm_debug_level) ) \
tdeegan@11172 73 printk("[HVM:%d.%d] <%s> " _f "\n", \
tdeegan@11172 74 current->domain->domain_id, current->vcpu_id, __func__, \
tdeegan@11172 75 ## _a); \
tdeegan@11172 76 } while (0)
kaf24@8708 77 #else
kaf24@8708 78 #define HVM_DBG_LOG(level, _f, _a...)
kaf24@8708 79 #endif
kaf24@8708 80
kfraser@13627 81 extern char hvm_io_bitmap[];
kaf24@8708 82
kfraser@14090 83 void hvm_enable(struct hvm_function_table *);
kfraser@13627 84
Tim@12064 85 int hvm_copy_to_guest_phys(paddr_t paddr, void *buf, int size);
Tim@12064 86 int hvm_copy_from_guest_phys(void *buf, paddr_t paddr, int size);
kfraser@11677 87 int hvm_copy_to_guest_virt(unsigned long vaddr, void *buf, int size);
kfraser@11677 88 int hvm_copy_from_guest_virt(void *buf, unsigned long vaddr, int size);
Tim@16313 89 int hvm_fetch_from_guest_virt(void *buf, unsigned long vaddr, int size);
kaf24@8708 90
kfraser@11677 91 void hvm_print_line(struct vcpu *v, const char c);
kfraser@11677 92 void hlt_timer_fn(void *data);
kaf24@8708 93
kfraser@14748 94 #define HVM_HCALL_completed 0 /* hypercall completed - no further action */
kfraser@14748 95 #define HVM_HCALL_preempted 1 /* hypercall preempted - re-execute VMCALL */
kfraser@14748 96 #define HVM_HCALL_invalidate 2 /* invalidate ioemu-dm memory cache */
steven@14725 97 int hvm_do_hypercall(struct cpu_user_regs *pregs);
kfraser@10892 98
kfraser@11164 99 void hvm_hlt(unsigned long rflags);
kfraser@13242 100 void hvm_triple_fault(void);
kfraser@11164 101
keir@16012 102 int hvm_set_efer(uint64_t value);
kfraser@15734 103 int hvm_set_cr0(unsigned long value);
kfraser@15727 104 int hvm_set_cr3(unsigned long value);
kfraser@15729 105 int hvm_set_cr4(unsigned long value);
kfraser@15727 106
kaf24@8708 107 #endif /* __ASM_X86_HVM_SUPPORT_H__ */