Hi,
This patch modifies the interruption handler to display the
information about the interruption and then do panic in the case of the
fault occurred in hypervisor, or reflect to the guest when handling the
fault in guest.
The modification is as follows:
1. In each handler in IVT, the procedure is added to branch to fault
handler or reflection according to ipsr.cpl.
2. In the case of the fault occurred in hypervisor(ipsr.cpl==0), the
fault handler displays the information (vector, registers, and stack by
calling show_registers()), and then do panic().
3. In the case of the fault occurred in guest(ipsr.cpl!=0), it is
reflected to the guest.
With this modification, some faults which were always treated to be
reflected to the guest are changed to do panic when they occur in
hypervisor.
Signed-off-by: Tetsu Yamamoto <yamamoto.tetsu@xxxxxxxxxxxxxx>
Regards,
Tetsu Yamamoto
diff -r de0c04ed4ab7 xen/arch/ia64/xen/ivt.S
--- a/xen/arch/ia64/xen/ivt.S Fri Apr 21 10:40:17 2006 -0600
+++ b/xen/arch/ia64/xen/ivt.S Thu Apr 27 09:20:22 2006 +0900
@@ -100,6 +100,15 @@
mov r19=n;; /* prepare to save predicates */
\
br.sptk.many dispatch_to_fault_handler
+#define FAULT_OR_REFLECT(n)
\
+ mov r31=pr;
\
+ mov r20=cr.ipsr;;
\
+ mov r19=n; /* prepare to save predicates */
\
+ extr.u r20=r20,IA64_PSR_CPL0_BIT,2;;
\
+ cmp.ne p6,p0=r0,r20; /* cpl != 0?*/
\
+(p6) br.dptk.many dispatch_reflection;
\
+ br.sptk.few dispatch_to_fault_handler
+
#ifdef XEN
#define REFLECT(n)
\
mov r31=pr;
\
@@ -629,6 +638,12 @@ ENTRY(nested_dtlb_miss)
ENTRY(nested_dtlb_miss)
DBG_FAULT(5)
#ifdef XEN
+ mov r31=pr
+ mov r20=cr.ipsr;;
+ mov r19=5 /* prepare to save predicates */
+ extr.u r20=r20,IA64_PSR_CPL0_BIT,2;;
+ cmp.ne p6,p0=r0,r20;; /* cpl !=0? */
+(p6) br.sptk.many dispatch_reflection
mov b0=r30
br.sptk.many b0 // return to continuation point
;;
@@ -700,7 +715,7 @@ ENTRY(ikey_miss)
ENTRY(ikey_miss)
DBG_FAULT(6)
#ifdef XEN
- REFLECT(6)
+ FAULT_OR_REFLECT(6)
#endif
FAULT(6)
END(ikey_miss)
@@ -749,7 +764,7 @@ ENTRY(dkey_miss)
ENTRY(dkey_miss)
DBG_FAULT(7)
#ifdef XEN
- REFLECT(7)
+ FAULT_OR_REFLECT(7)
#endif
FAULT(7)
END(dkey_miss)
@@ -760,7 +775,7 @@ ENTRY(dirty_bit)
ENTRY(dirty_bit)
DBG_FAULT(8)
#ifdef XEN
- REFLECT(8)
+ FAULT_OR_REFLECT(8)
#endif
/*
* What we do here is to simply turn on the dirty bit in the PTE. We
need to
@@ -1526,7 +1541,7 @@ ENTRY(page_not_present)
ENTRY(page_not_present)
DBG_FAULT(20)
#ifdef XEN
- REFLECT(20)
+ FAULT_OR_REFLECT(20)
#endif
mov r16=cr.ifa
rsm psr.dt
@@ -1549,7 +1564,7 @@ ENTRY(key_permission)
ENTRY(key_permission)
DBG_FAULT(21)
#ifdef XEN
- REFLECT(21)
+ FAULT_OR_REFLECT(21)
#endif
mov r16=cr.ifa
rsm psr.dt
@@ -1565,7 +1580,7 @@ ENTRY(iaccess_rights)
ENTRY(iaccess_rights)
DBG_FAULT(22)
#ifdef XEN
- REFLECT(22)
+ FAULT_OR_REFLECT(22)
#endif
mov r16=cr.ifa
rsm psr.dt
@@ -1640,7 +1655,7 @@ ENTRY(disabled_fp_reg)
mov pr=r20,-1
;;
#endif
- REFLECT(25)
+ FAULT_OR_REFLECT(25)
//floating_panic:
// br.sptk.many floating_panic
;;
@@ -1659,7 +1674,7 @@ ENTRY(nat_consumption)
ENTRY(nat_consumption)
DBG_FAULT(26)
#ifdef XEN
- REFLECT(26)
+ FAULT_OR_REFLECT(26)
#endif
FAULT(26)
END(nat_consumption)
@@ -1671,7 +1686,7 @@ ENTRY(speculation_vector)
DBG_FAULT(27)
#ifdef XEN
// this probably need not reflect...
- REFLECT(27)
+ FAULT_OR_REFLECT(27)
#endif
/*
* A [f]chk.[as] instruction needs to take the branch to the recovery
code but
@@ -1717,7 +1732,7 @@ ENTRY(debug_vector)
ENTRY(debug_vector)
DBG_FAULT(29)
#ifdef XEN
- REFLECT(29)
+ FAULT_OR_REFLECT(29)
#endif
FAULT(29)
END(debug_vector)
@@ -1728,7 +1743,7 @@ ENTRY(unaligned_access)
ENTRY(unaligned_access)
DBG_FAULT(30)
#ifdef XEN
- REFLECT(30)
+ FAULT_OR_REFLECT(30)
#endif
mov r16=cr.ipsr
mov r31=pr // prepare to save predicates
@@ -1742,7 +1757,7 @@ ENTRY(unsupported_data_reference)
ENTRY(unsupported_data_reference)
DBG_FAULT(31)
#ifdef XEN
- REFLECT(31)
+ FAULT_OR_REFLECT(31)
#endif
FAULT(31)
END(unsupported_data_reference)
@@ -1753,7 +1768,7 @@ ENTRY(floating_point_fault)
ENTRY(floating_point_fault)
DBG_FAULT(32)
#ifdef XEN
- REFLECT(32)
+ FAULT_OR_REFLECT(32)
#endif
FAULT(32)
END(floating_point_fault)
@@ -1764,7 +1779,7 @@ ENTRY(floating_point_trap)
ENTRY(floating_point_trap)
DBG_FAULT(33)
#ifdef XEN
- REFLECT(33)
+ FAULT_OR_REFLECT(33)
#endif
FAULT(33)
END(floating_point_trap)
@@ -1775,7 +1790,7 @@ ENTRY(lower_privilege_trap)
ENTRY(lower_privilege_trap)
DBG_FAULT(34)
#ifdef XEN
- REFLECT(34)
+ FAULT_OR_REFLECT(34)
#endif
FAULT(34)
END(lower_privilege_trap)
@@ -1786,7 +1801,7 @@ ENTRY(taken_branch_trap)
ENTRY(taken_branch_trap)
DBG_FAULT(35)
#ifdef XEN
- REFLECT(35)
+ FAULT_OR_REFLECT(35)
#endif
FAULT(35)
END(taken_branch_trap)
@@ -1797,7 +1812,7 @@ ENTRY(single_step_trap)
ENTRY(single_step_trap)
DBG_FAULT(36)
#ifdef XEN
- REFLECT(36)
+ FAULT_OR_REFLECT(36)
#endif
FAULT(36)
END(single_step_trap)
@@ -1856,7 +1871,7 @@ ENTRY(ia32_exception)
ENTRY(ia32_exception)
DBG_FAULT(45)
#ifdef XEN
- REFLECT(45)
+ FAULT_OR_REFLECT(45)
#endif
FAULT(45)
END(ia32_exception)
@@ -1867,7 +1882,7 @@ ENTRY(ia32_intercept)
ENTRY(ia32_intercept)
DBG_FAULT(46)
#ifdef XEN
- REFLECT(46)
+ FAULT_OR_REFLECT(46)
#endif
#ifdef CONFIG_IA32_SUPPORT
mov r31=pr
@@ -1900,7 +1915,7 @@ ENTRY(ia32_interrupt)
ENTRY(ia32_interrupt)
DBG_FAULT(47)
#ifdef XEN
- REFLECT(47)
+ FAULT_OR_REFLECT(47)
#endif
#ifdef CONFIG_IA32_SUPPORT
mov r31=pr
diff -r de0c04ed4ab7 xen/arch/ia64/xen/process.c
--- a/xen/arch/ia64/xen/process.c Fri Apr 21 10:40:17 2006 -0600
+++ b/xen/arch/ia64/xen/process.c Thu Apr 27 09:20:22 2006 +0900
@@ -359,10 +359,10 @@ ia64_fault (unsigned long vector, unsign
"Unknown fault 9", "Unknown fault 10", "Unknown fault 11",
"Unknown fault 12",
"Unknown fault 13", "Unknown fault 14", "Unknown fault 15"
};
-#if 0
-printf("ia64_fault, vector=0x%p, ifa=%p, iip=%p, ipsr=%p, isr=%p\n",
- vector, ifa, regs->cr_iip, regs->cr_ipsr, isr);
-#endif
+
+ printf("ia64_fault, vector=0x%p, ifa=%p, iip=%p, ipsr=%p, isr=%p\n",
+ vector, ifa, regs->cr_iip, regs->cr_ipsr, isr);
+
if ((isr & IA64_ISR_NA) && ((isr & IA64_ISR_CODE_MASK) ==
IA64_ISR_CODE_LFETCH)) {
/*
@@ -374,179 +374,117 @@ printf("ia64_fault, vector=0x%p, ifa=%p,
return;
}
- switch (vector) {
- case 24: /* General Exception */
- code = (isr >> 4) & 0xf;
- sprintf(buf, "General Exception: %s%s", reason[code],
- (code == 3) ? ((isr & (1UL << 37))
- ? " (RSE access)" : " (data access)") :
"");
- if (code == 8) {
+ switch (vector) {
+
+ case 0:
+ printk("VHPT Translation.\n");
+ break;
+
+ case 4:
+ printk("Alt ITLB.\n");
+ break;
+
+ case 6:
+ printk("Instruction Key Miss.\n");
+ break;
+
+ case 7:
+ printk("Data Key Miss.\n");
+ break;
+
+ case 8:
+ printk("Dirty-bit.\n");
+ break;
+
+ case 20:
+ printk("Page Not Found.\n");
+ break;
+
+ case 21:
+ printk("Key Permission.\n");
+ break;
+
+ case 22:
+ printk("Instruction Access Rights.\n");
+ break;
+
+ case 24: /* General Exception */
+ code = (isr >> 4) & 0xf;
+ sprintf(buf, "General Exception: %s%s", reason[code],
+ (code == 3) ? ((isr & (1UL << 37))
+ ? " (RSE access)" : " (data access)") : "");
+ if (code == 8) {
# ifdef CONFIG_IA64_PRINT_HAZARDS
- printk("%s[%d]: possible hazard @ ip=%016lx (pr =
%016lx)\n",
- current->comm, current->pid, regs->cr_iip +
ia64_psr(regs)->ri,
- regs->pr);
+ printk("%s[%d]: possible hazard @ ip=%016lx (pr = %016lx)\n",
+ current->comm, current->pid, regs->cr_iip +
ia64_psr(regs)->ri,
+ regs->pr);
# endif
- printf("ia64_fault: returning on hazard\n");
- return;
- }
- break;
-
- case 25: /* Disabled FP-Register */
- if (isr & 2) {
- //disabled_fph_fault(regs);
- //return;
- }
- sprintf(buf, "Disabled FPL fault---not supposed to happen!");
- break;
-
- case 26: /* NaT Consumption */
- if (user_mode(regs)) {
- void *addr;
-
- if (((isr >> 4) & 0xf) == 2) {
- /* NaT page consumption */
- //sig = SIGSEGV;
- //code = SEGV_ACCERR;
- addr = (void *) ifa;
- } else {
- /* register NaT consumption */
- //sig = SIGILL;
- //code = ILL_ILLOPN;
- addr = (void *) (regs->cr_iip +
ia64_psr(regs)->ri);
- }
- //siginfo.si_signo = sig;
- //siginfo.si_code = code;
- //siginfo.si_errno = 0;
- //siginfo.si_addr = addr;
- //siginfo.si_imm = vector;
- //siginfo.si_flags = __ISR_VALID;
- //siginfo.si_isr = isr;
- //force_sig_info(sig, &siginfo, current);
- //return;
- } //else if (ia64_done_with_exception(regs))
- //return;
- sprintf(buf, "NaT consumption");
- break;
-
- case 31: /* Unsupported Data Reference */
- if (user_mode(regs)) {
- //siginfo.si_signo = SIGILL;
- //siginfo.si_code = ILL_ILLOPN;
- //siginfo.si_errno = 0;
- //siginfo.si_addr = (void *) (regs->cr_iip +
ia64_psr(regs)->ri);
- //siginfo.si_imm = vector;
- //siginfo.si_flags = __ISR_VALID;
- //siginfo.si_isr = isr;
- //force_sig_info(SIGILL, &siginfo, current);
- //return;
- }
- sprintf(buf, "Unsupported data reference");
- break;
-
- case 29: /* Debug */
- case 35: /* Taken Branch Trap */
- case 36: /* Single Step Trap */
- //if (fsys_mode(current, regs)) {}
- switch (vector) {
- case 29:
- //siginfo.si_code = TRAP_HWBKPT;
-#ifdef CONFIG_ITANIUM
- /*
- * Erratum 10 (IFA may contain incorrect address) now
has
- * "NoFix" status. There are no plans for fixing this.
- */
- if (ia64_psr(regs)->is == 0)
- ifa = regs->cr_iip;
-#endif
- break;
- case 35: ifa = 0; break;
- case 36: ifa = 0; break;
- //case 35: siginfo.si_code = TRAP_BRANCH; ifa = 0; break;
- //case 36: siginfo.si_code = TRAP_TRACE; ifa = 0; break;
- }
- //siginfo.si_signo = SIGTRAP;
- //siginfo.si_errno = 0;
- //siginfo.si_addr = (void *) ifa;
- //siginfo.si_imm = 0;
- //siginfo.si_flags = __ISR_VALID;
- //siginfo.si_isr = isr;
- //force_sig_info(SIGTRAP, &siginfo, current);
- //return;
-
- case 32: /* fp fault */
- case 33: /* fp trap */
- //result = handle_fpu_swa((vector == 32) ? 1 : 0, regs, isr);
- //if ((result < 0) || (current->thread.flags &
IA64_THREAD_FPEMU_SIGFPE)) {
- //siginfo.si_signo = SIGFPE;
- //siginfo.si_errno = 0;
- //siginfo.si_code = FPE_FLTINV;
- //siginfo.si_addr = (void *) (regs->cr_iip +
ia64_psr(regs)->ri);
- //siginfo.si_flags = __ISR_VALID;
- //siginfo.si_isr = isr;
- //siginfo.si_imm = 0;
- //force_sig_info(SIGFPE, &siginfo, current);
- //}
- //return;
- sprintf(buf, "FP fault/trap");
- break;
-
- case 34:
- if (isr & 0x2) {
- /* Lower-Privilege Transfer Trap */
- /*
- * Just clear PSR.lp and then return immediately: all
the
- * interesting work (e.g., signal delivery is done in
the kernel
- * exit path).
- */
- //ia64_psr(regs)->lp = 0;
- //return;
- sprintf(buf, "Lower-Privilege Transfer trap");
- } else {
- /* Unimplemented Instr. Address Trap */
- if (user_mode(regs)) {
- //siginfo.si_signo = SIGILL;
- //siginfo.si_code = ILL_BADIADDR;
- //siginfo.si_errno = 0;
- //siginfo.si_flags = 0;
- //siginfo.si_isr = 0;
- //siginfo.si_imm = 0;
- //siginfo.si_addr = (void *) (regs->cr_iip +
ia64_psr(regs)->ri);
- //force_sig_info(SIGILL, &siginfo, current);
- //return;
- }
- sprintf(buf, "Unimplemented Instruction Address fault");
- }
- break;
-
- case 45:
- printk(KERN_ERR "Unexpected IA-32 exception (Trap 45)\n");
- printk(KERN_ERR " iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx\n",
- regs->cr_iip, ifa, isr);
- //force_sig(SIGSEGV, current);
- break;
-
- case 46:
- printk(KERN_ERR "Unexpected IA-32 intercept trap (Trap 46)\n");
- printk(KERN_ERR " iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx, iim -
0x%lx\n",
- regs->cr_iip, ifa, isr, iim);
- //force_sig(SIGSEGV, current);
- return;
-
- case 47:
- sprintf(buf, "IA-32 Interruption Fault (int 0x%lx)", isr >> 16);
- break;
-
- default:
- sprintf(buf, "Fault %lu", vector);
- break;
- }
- //die_if_kernel(buf, regs, error);
-printk("ia64_fault: %s: reflecting\n",buf);
-PSCB(current,itir) = vcpu_get_itir_on_fault(current,ifa);
-PSCB(current,ifa) = ifa;
-reflect_interruption(isr,regs,IA64_GENEX_VECTOR);
-//while(1);
- //force_sig(SIGILL, current);
+ printf("ia64_fault: returning on hazard\n");
+ return;
+ }
+ break;
+
+ case 25: /* Disabled FP-Register */
+ printk("Disabled FP-Register.\n");
+ break;
+
+ case 26: /* NaT Consumption */
+ printk("NaT consumption.\n");
+ break;
+
+ case 29: /* Debug */
+ printk("Debug.\n");
+ break;
+
+ case 30:
+ printk("Unaligned Reference.\n");
+ break;
+
+ case 31: /* Unsupported Data Reference */
+ printk("Unsupported data reference.\n");
+ break;
+
+ case 32:
+ printk("Floating-Point Fault.\n");
+ break;
+
+ case 33:
+ printk("Floating-Point Trap.\n");
+ break;
+
+ case 34:
+ printk("Lower Privilege Transfer Trap.\n");
+ break;
+
+ case 35: /* Taken Branch Trap */
+ printk("Taken Branch Trap.\n");
+ break;
+
+ case 36: /* Single Step Trap */
+ printk("Single Step Trap.\n");
+ break;
+
+ case 45:
+ printk("IA-32 Exception.\n");
+ break;
+
+ case 46:
+ printk("IA-32 Intercept.\n");
+ break;
+
+ case 47:
+ printk("IA-32 Interrupt.\n");
+ break;
+
+ default:
+ printk("Fault %lu\n", vector);
+ break;
+ }
+
+ show_registers(regs);
+ panic("Fault in Xen.\n");
+
+
}
unsigned long running_on_sim = 0;
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
|