Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jun 2002 12:48:49 -0700 (PDT)
From:      Julian Elischer <julian@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 12331 for review
Message-ID:  <200206031948.g53JmnZ32562@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=12331

Change 12331 by julian@julian_ref on 2002/06/03 12:48:07

	free the KV address space teh thread was using for its stack
	(does this happpen for the proc u-area yet?)

Affected files ...

... //depot/projects/kse/sys/i386/i386/pmap.c#34 edit

Differences ...

==== //depot/projects/kse/sys/i386/i386/pmap.c#34 (text+ko) ====

@@ -1093,14 +1093,19 @@
 {
 	int i;
 	vm_object_t ksobj;
-	vm_offset_t ks;
+	vm_offset_t ks, ks2;
 	vm_page_t m;
 	pt_entry_t *ptek, oldpte;
 
 	ksobj = td->td_kstack_obj;
 	ks = td->td_kstack;
 	ptek = vtopte(ks);
+#ifdef KSTACK_GUARD
+	ks -= PAGE_SIZE;
+	for (i = 1; i < (KSTACK_PAGES + 1); i++) {
+#else
 	for (i = 0; i < KSTACK_PAGES; i++) {
+#endif
 		m = vm_page_lookup(ksobj, i);
 		if (m == NULL)
 			panic("pmap_dispose_thread: kstack already missing?");
@@ -1116,6 +1121,15 @@
 #ifdef I386_CPU
 	invltlb();
 #endif
+	/*
+	 * Free the space that this stack was mapped to in the kernel
+	 * address map.
+	 */
+#ifdef KSTACK_GUARD
+	kmem_free(kernel_map, ks, (KSTACK_PAGES + 1) * PAGE_SIZE);
+#else
+	kmem_free(kernel_map, ks, KSTACK_PAGES * PAGE_SIZE);
+#endif
 
 	/*
 	 * If the thread got swapped out some of its KSTACK might have gotten

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?200206031948.g53JmnZ32562>