Hi,
This patch modifies the vmx fault handler to display a message when a
fault occurs in hypervisor.
This includes the followings:
- Break 0 handler is modified to check psr.vm bit instead of cpl.
- External interrupt handler is modified to get current using
MINSTATE_GET_CURRENT instead of r21. r21 has been used in DO_SAVE_MIN
which is called from other fault handlers. I'm not sure why the
original vmx fault handler gets the current from r21.
Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
Signed-off-by: Tetsu Yamamoto <yamamoto.tetsu@xxxxxxxxxxxxxx>
Regards,
Tetsu Yamamoto
diff -r 0d1dab1d9b67 xen/arch/ia64/vmx/vmx_ivt.S
--- a/xen/arch/ia64/vmx/vmx_ivt.S Fri Jun 16 10:18:54 2006 -0600
+++ b/xen/arch/ia64/vmx/vmx_ivt.S Mon Jun 19 10:41:54 2006 +0900
@@ -88,11 +88,13 @@
#include "vmx_minstate.h"
+#define MINSTATE_VIRT /* needed by minstate.h */
+#include "minstate.h"
#define VMX_FAULT(n) \
vmx_fault_##n:; \
- br.sptk vmx_fault_##n; \
+ br.sptk.many dispatch_to_fault_handler; \
;; \
@@ -508,7 +510,8 @@ ENTRY(vmx_interrupt)
;;
.mem.offset 0,0; st8.spill [r16]=r13,16
.mem.offset 8,0; st8.spill [r17]=r8,16 /* save ar.fpsr */
- mov r13=r21 /* establish `current' */
+ /* mov r13=r21 establish `current' */
+ MINSTATE_GET_CURRENT(r13)
;;
.mem.offset 0,0; st8.spill [r16]=r15,16
.mem.offset 8,0; st8.spill [r17]=r14,16
diff -r 0d1dab1d9b67 xen/arch/ia64/vmx/vmx_process.c
--- a/xen/arch/ia64/vmx/vmx_process.c Fri Jun 16 10:18:54 2006 -0600
+++ b/xen/arch/ia64/vmx/vmx_process.c Mon Jun 19 10:41:54 2006 +0900
@@ -126,7 +126,7 @@ vmx_ia64_handle_break (unsigned long ifa
#endif
{
if (iim == 0)
- die_if_kernel("bug check", regs, iim);
+ vmx_die_if_kernel("Break 0 in Hypervisor.", regs, iim);
if (!user_mode(regs)) {
/* Allow hypercalls only when cpl = 0. */
diff -r 0d1dab1d9b67 xen/arch/ia64/xen/ivt.S
--- a/xen/arch/ia64/xen/ivt.S Fri Jun 16 10:18:54 2006 -0600
+++ b/xen/arch/ia64/xen/ivt.S Mon Jun 19 10:41:54 2006 +0900
@@ -1493,7 +1493,7 @@ END(dispatch_unaligned_handler)
* suitable spot...
*/
-ENTRY(dispatch_to_fault_handler)
+GLOBAL_ENTRY(dispatch_to_fault_handler)
/*
* Input:
* psr.ic: off
diff -r 0d1dab1d9b67 xen/arch/ia64/xen/xenmisc.c
--- a/xen/arch/ia64/xen/xenmisc.c Fri Jun 16 10:18:54 2006 -0600
+++ b/xen/arch/ia64/xen/xenmisc.c Mon Jun 19 10:41:54 2006 +0900
@@ -19,6 +19,7 @@
#include <public/sched.h>
#include <asm/vhpt.h>
#include <asm/debugger.h>
+#include <asm/vmx.h>
#include <asm/vmx_vcpu.h>
#include <asm/vcpu.h>
@@ -109,6 +110,17 @@ void die_if_kernel(char *str, struct pt_
domain_crash_synchronous();
}
+void vmx_die_if_kernel(char *str, struct pt_regs *regs, long err) /*
__attribute__ ((noreturn)) */
+{
+ if (vmx_user_mode(regs))
+ return;
+
+ printk("%s: %s %ld\n", __func__, str, err);
+ debugtrace_dump();
+ show_registers(regs);
+ domain_crash_synchronous();
+}
+
long
ia64_peek (struct task_struct *child, struct switch_stack *child_stack,
unsigned long user_rbs_end, unsigned long addr, long *val)
diff -r 0d1dab1d9b67 xen/include/asm-ia64/vmx.h
--- a/xen/include/asm-ia64/vmx.h Fri Jun 16 10:18:54 2006 -0600
+++ b/xen/include/asm-ia64/vmx.h Mon Jun 19 10:41:54 2006 +0900
@@ -24,6 +24,7 @@
#define RR7_SWITCH_SHIFT 12 /* 4k enough */
#include <public/hvm/ioreq.h>
+# define vmx_user_mode(regs)(((struct ia64_psr *) &(regs)->cr_ipsr)->vm == 1)
#define VCPU_LID(v) (((u64)(v)->vcpu_id)<<24)
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
|