Module Name:    src
Committed By:   kiyohara
Date:           Sat Jan 12 08:42:53 UTC 2013

Modified Files:
        src/sys/arch/ia64/ia64: trap.c

Log Message:
Add some vector process from FreeBSD.
Remove and add null-line.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/ia64/ia64/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/ia64/ia64/trap.c
diff -u src/sys/arch/ia64/ia64/trap.c:1.11 src/sys/arch/ia64/ia64/trap.c:1.12
--- src/sys/arch/ia64/ia64/trap.c:1.11	Sun Jan  6 11:25:13 2013
+++ src/sys/arch/ia64/ia64/trap.c	Sat Jan 12 08:42:53 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.11 2013/01/06 11:25:13 kiyohara Exp $ */
+/* $NetBSD: trap.c,v 1.12 2013/01/12 08:42:53 kiyohara Exp $ */
 
 /*-
  * Copyright (c) 2005 Marcel Moolenaar
@@ -61,7 +61,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.11 2013/01/06 11:25:13 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.12 2013/01/12 08:42:53 kiyohara Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -414,6 +414,7 @@ trap(int vector, struct trapframe *tf)
 		 */
 		trap_panic(vector, tf);
 		break;
+
 	case IA64_VEC_ITLB:
 	case IA64_VEC_DTLB:
 	case IA64_VEC_EXT_INTR:
@@ -526,7 +527,6 @@ trap(int vector, struct trapframe *tf)
 			} else if (ucode == 0x100000) {
 				break_syscall(tf);
 				return;		/* do_ast() already called. */
-
 			} else if (ucode == 0x180000) {
 				mcontext_t mc;
 
@@ -547,6 +547,63 @@ trap(int vector, struct trapframe *tf)
 		}
 		break;
 
+	case IA64_VEC_PAGE_NOT_PRESENT:
+	case IA64_VEC_INST_ACCESS_RIGHTS:
+	case IA64_VEC_DATA_ACCESS_RIGHTS: {
+		struct pcb * const pcb = lwp_getpcb(l);
+		vaddr_t va;
+		struct vm_map *map;
+		vm_prot_t ftype;
+		uint64_t onfault;
+		int error = 0;
+
+		va = trunc_page(tf->tf_special.ifa);
+
+		if (va >= VM_MAXUSER_ADDRESS) {
+			/*
+			 * Don't allow user-mode faults for kernel virtual
+			 * addresses, including the gateway page.
+			 */
+			if (user)
+				goto no_fault_in;
+			map = kernel_map;
+		} else {
+			map = (p != NULL) ? &p->p_vmspace->vm_map : NULL;
+			if (map == NULL)
+				goto no_fault_in;
+		}
+
+		if (tf->tf_special.isr & IA64_ISR_X)
+			ftype = VM_PROT_EXECUTE;
+		else if (tf->tf_special.isr & IA64_ISR_W)
+			ftype = VM_PROT_WRITE;
+		else
+			ftype = VM_PROT_READ;
+
+		onfault = pcb->pcb_onfault;
+		pcb->pcb_onfault = 0;
+		error = uvm_fault(map, va, ftype);
+		pcb->pcb_onfault = onfault;
+
+		if (error == 0)
+			goto out;
+
+no_fault_in:
+		if (!user) {
+			/* Check for copyin/copyout fault. */
+			if (pcb->pcb_onfault != 0) {
+				tf->tf_special.iip = pcb->pcb_onfault;
+				tf->tf_special.psr &= ~IA64_PSR_RI;
+				tf->tf_scratch.gr8 = error;
+				goto out;
+			}
+			trap_panic(vector, tf);
+		}
+		ucode = va;
+		sig = (error == EACCES) ? SIGBUS : SIGSEGV;
+		break;
+	}
+
 /* XXX: Fill in the rest */
 
 	case IA64_VEC_SPECULATION:

Reply via email to