Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Nov 2002 16:03:56 -0800 (PST)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 21190 for review
Message-ID:  <200211180003.gAI03uph034009@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=21190

Change 21190 by marcel@marcel_nfs on 2002/11/17 16:03:41

	When we get a pagefault in the syscall page, wire it in. Exclude
	the syscall/gateway page from the vmspace. Note that I assume
	for now that we have just a single page even though I created a
	range of 1MB. I think having a larger range for this helps, but
	only in the case we hardcode this stuff. Peter already mentioned
	that we could pass the information to the process. That's a
	detail I leave for later.
	
	Note that the actual syscall sequence (CALLSYS_NOERROR) has not
	been changed. It would immediately break things. To test the
	syscall page, do something like:
	
	\begin{verbatim}
	#include <sys/param.h>
	#include <stdio.h>
	#include <vm/vm.h>
	#include <vm/pmap.h>
	#include <vm/vm_param.h>
	
	int main()
	{
	        u_long lid;
	        printf("syscall page at %lx\n", (long)USRSTACK);
	        __asm __volatile("mov b6 = %1; br.call.sptk rp = b6;; mov %0 = r8"
		    : "=r" (lid) : "r" USRSTACK);
		printf("LID=%lx\n", lid);
		return 0;
	}
	\end{verbatim}
	
	This test uses the stub and returns the CPU id of the current CPU
	by using a privileged instruction (to prove that the epc works).

Affected files ...

.. //depot/projects/ia64/sys/ia64/ia64/pmap.c#46 edit
.. //depot/projects/ia64/sys/ia64/ia64/trap.c#37 edit
.. //depot/projects/ia64/sys/ia64/include/pmap.h#7 edit
.. //depot/projects/ia64/sys/ia64/include/vmparam.h#6 edit

Differences ...

==== //depot/projects/ia64/sys/ia64/ia64/pmap.c#46 (text+ko) ====

@@ -191,6 +191,9 @@
 
 vm_offset_t vhpt_base, vhpt_size;
 
+/* Syscall gateway page. */
+extern u_int64_t ia64_syscall_page[];
+
 /*
  * We use an object to own the kernel's 'page tables'. For simplicity,
  * we use one page directory to index a set of pages containing
@@ -451,13 +454,6 @@
 	 */
 	ia64_set_rr(IA64_RR_BASE(6), (6 << 8) | (28 << 2));
 	ia64_set_rr(IA64_RR_BASE(7), (7 << 8) | (28 << 2));
-			 
-	/*
-	 * Set up proc0's PCB.
-	 */
-#if 0
-	thread0.td_pcb->pcb_hw.apcb_asn = 0;
-#endif
 
 	/*
 	 * Reserve some memory for allocating pvs while bootstrapping
@@ -874,7 +870,7 @@
 }
 
 /***************************************************
-* Pmap allocation/deallocation routines.
+ * Pmap allocation/deallocation routines.
  ***************************************************/
 
 /*
@@ -1782,6 +1778,19 @@
 	pmap_install(oldpmap);
 }
 
+int
+pmap_wire_syscall_page(pmap)
+	pmap_t pmap;
+{
+	struct ia64_lpte *pte;
+
+	pte = pmap_find_pte(VM_MAX_ADDRESS);
+	pmap_set_pte(pte, VM_MAX_ADDRESS,
+	    IA64_RR_MASK((u_int64_t)ia64_syscall_page), PTE_IG_MANAGED,
+	    PTE_PL_KERN, PTE_AR_X_RX);
+	return (0);
+}
+
 /*
  * Make temporary mapping for a physical address. This is called
  * during dump.

==== //depot/projects/ia64/sys/ia64/ia64/trap.c#37 (text+ko) ====

@@ -562,6 +562,10 @@
 			vm = (p != NULL) ? p->p_vmspace : NULL;
 			if (vm == NULL)
 				goto no_fault_in;
+			if (va == VM_MAX_ADDRESS) {
+				if (!pmap_wire_syscall_page(&vm->vm_pmap))
+					goto out;
+			}
 			map = &vm->vm_map;
 		}
 

==== //depot/projects/ia64/sys/ia64/include/pmap.h#7 (text+ko) ====

@@ -137,6 +137,7 @@
 void	pmap_set_opt	(unsigned *);
 void	pmap_set_opt_bsp	(void);
 struct pmap *pmap_install(struct pmap *pmap);
+int	pmap_wire_syscall_page(struct pmap *pmap);
 
 #endif /* _KERNEL */
 

==== //depot/projects/ia64/sys/ia64/include/vmparam.h#6 (text+ko) ====

@@ -50,11 +50,10 @@
 /*
  * USRTEXT is the start of the user text/data space, while USRSTACK
  * is the top (end) of the user stack.  Immediately above the user stack
- * resides the user structure, which is UPAGES long and contains the
- * kernel stack.
+ * resides the syscall gateway page.
  */
 #define	USRTEXT		CLBYTES
-#define	USRSTACK	VM_MAXUSER_ADDRESS
+#define	USRSTACK	VM_MAX_ADDRESS
 
 /*
  * Virtual memory related constants, all in bytes
@@ -141,7 +140,7 @@
 /* user/kernel map constants */
 #define VM_MIN_ADDRESS		0
 #define VM_MAXUSER_ADDRESS	IA64_RR_BASE(5)
-#define VM_MAX_ADDRESS		VM_MAXUSER_ADDRESS
+#define VM_MAX_ADDRESS		VM_MAXUSER_ADDRESS - (1024*1024)
 #define VM_MIN_KERNEL_ADDRESS	IA64_RR_BASE(5)
 #define VM_MAX_KERNEL_ADDRESS	(IA64_RR_BASE(6) - 1)
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211180003.gAI03uph034009>