summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2002-10-11 22:29:22 +0000
committerpeter <peter@FreeBSD.org>2002-10-11 22:29:22 +0000
commitedc920d80d67ec9fe56566b02c06a40770fa5303 (patch)
treecc3f363cdb3faa489b5b98caa7aadb3bb7498c6d /sys
parent4c790ce0328026e32805fd8c5c6fa4b2c117c3d7 (diff)
downloadFreeBSD-src-edc920d80d67ec9fe56566b02c06a40770fa5303.zip
FreeBSD-src-edc920d80d67ec9fe56566b02c06a40770fa5303.tar.gz
cut/paste the pmap_new_altkstack stuff from the other platforms.
It's no different here. Update the rest of the kstack API's for scottl's changes.
Diffstat (limited to 'sys')
-rw-r--r--sys/ia64/ia64/pmap.c50
1 files changed, 47 insertions, 3 deletions
diff --git a/sys/ia64/ia64/pmap.c b/sys/ia64/ia64/pmap.c
index 8d88d33..66634d7 100644
--- a/sys/ia64/ia64/pmap.c
+++ b/sys/ia64/ia64/pmap.c
@@ -712,21 +712,31 @@ pmap_track_modified(vm_offset_t va)
return 0;
}
+#ifndef KSTACK_MAX_PAGES
+#define KSTACK_MAX_PAGES 32
+#endif
+
/*
* Create the KSTACK for a new thread.
* This routine directly affects the fork perf for a process/thread.
*/
void
-pmap_new_thread(struct thread *td)
+pmap_new_thread(struct thread *td, int pages)
{
vm_offset_t *ks;
+ /* Bounds check */
+ if (pages <= 1)
+ pages = KSTACK_PAGES;
+ else if (pages > KSTACK_MAX_PAGES)
+ pages = KSTACK_MAX_PAGES;
+
/*
* Use contigmalloc for user area so that we can use a region
* 7 address for it which makes it impossible to accidentally
* lose when recording a trapframe.
*/
- ks = contigmalloc(KSTACK_PAGES * PAGE_SIZE, M_PMAP,
+ ks = contigmalloc(pages * PAGE_SIZE, M_PMAP,
M_WAITOK,
0ul,
256*1024*1024 - 1,
@@ -738,6 +748,7 @@ pmap_new_thread(struct thread *td)
KSTACK_PAGES);
td->td_md.md_kstackvirt = ks;
td->td_kstack = IA64_PHYS_TO_RR7(ia64_tpa((u_int64_t)ks));
+ td->td_kstack_pages = pages;
}
/*
@@ -747,12 +758,45 @@ pmap_new_thread(struct thread *td)
void
pmap_dispose_thread(struct thread *td)
{
- contigfree(td->td_md.md_kstackvirt, KSTACK_PAGES * PAGE_SIZE, M_PMAP);
+ int pages;
+
+ pages = td->td_kstack_pages;
+ contigfree(td->td_md.md_kstackvirt, pages * PAGE_SIZE, M_PMAP);
td->td_md.md_kstackvirt = 0;
td->td_kstack = 0;
}
/*
+ * Set up a variable sized alternate kstack. This appears to be MI.
+ */
+void
+pmap_new_altkstack(struct thread *td, int pages)
+{
+
+ /* shuffle the original stack */
+ td->td_altkstack_obj = td->td_kstack_obj;
+ td->td_altkstack = td->td_kstack;
+ td->td_altkstack_pages = td->td_kstack_pages;
+
+ pmap_new_thread(td, pages);
+}
+
+void
+pmap_dispose_altkstack(struct thread *td)
+{
+
+ pmap_dispose_thread(td);
+
+ /* restore the original kstack */
+ td->td_kstack = td->td_altkstack;
+ td->td_kstack_obj = td->td_altkstack_obj;
+ td->td_kstack_pages = td->td_altkstack_pages;
+ td->td_altkstack = 0;
+ td->td_altkstack_obj = NULL;
+ td->td_altkstack_pages = 0;
+}
+
+/*
* Allow the KSTACK for a thread to be prejudicially paged out.
*/
void
OpenPOWER on IntegriCloud