summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/booke
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-08-10 17:18:21 +0000
committerkib <kib@FreeBSD.org>2015-08-10 17:18:21 +0000
commit9033c894a1c694d3e946571d9e57c05349a235eb (patch)
tree6c5e3b30f16040565000131df5f7348a27c34a56 /sys/powerpc/booke
parent141883cce0cea307fd0365430906181b1954df86 (diff)
downloadFreeBSD-src-9033c894a1c694d3e946571d9e57c05349a235eb.zip
FreeBSD-src-9033c894a1c694d3e946571d9e57c05349a235eb.tar.gz
Make kstack_pages a tunable on arm, x86, and powepc. On i386, the
initial thread stack is not adjusted by the tunable, the stack is allocated too early to get access to the kernel environment. See TD0_KSTACK_PAGES for the thread0 stack sizing on i386. The tunable was tested on x86 only. From the visual inspection, it seems that it might work on arm and powerpc. The arm USPACE_SVC_STACK_TOP and powerpc USPACE macros seems to be already incorrect for the threads with non-default kstack size. I only changed the macros to use variable instead of constant, since I cannot test. On arm64, mips and sparc64, some static data structures are sized by KSTACK_PAGES, so the tunable is disabled. Sponsored by: The FreeBSD Foundation MFC after: 2 week
Diffstat (limited to 'sys/powerpc/booke')
-rw-r--r--sys/powerpc/booke/pmap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c
index 275ae8d..223500c 100644
--- a/sys/powerpc/booke/pmap.c
+++ b/sys/powerpc/booke/pmap.c
@@ -1207,7 +1207,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_offset_t kernelend)
/* Steal physical memory for kernel stack from the end */
/* of the first avail region */
/*******************************************************/
- kstack0_sz = KSTACK_PAGES * PAGE_SIZE;
+ kstack0_sz = kstack_pages * PAGE_SIZE;
kstack0_phys = availmem_regions[0].mr_start +
availmem_regions[0].mr_size;
kstack0_phys -= kstack0_sz;
@@ -1312,7 +1312,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_offset_t kernelend)
/* Enter kstack0 into kernel map, provide guard page */
kstack0 = virtual_avail + KSTACK_GUARD_PAGES * PAGE_SIZE;
thread0.td_kstack = kstack0;
- thread0.td_kstack_pages = KSTACK_PAGES;
+ thread0.td_kstack_pages = kstack_pages;
debugf("kstack_sz = 0x%08x\n", kstack0_sz);
debugf("kstack0_phys at 0x%08x - 0x%08x\n",
@@ -1320,7 +1320,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_offset_t kernelend)
debugf("kstack0 at 0x%08x - 0x%08x\n", kstack0, kstack0 + kstack0_sz);
virtual_avail += KSTACK_GUARD_PAGES * PAGE_SIZE + kstack0_sz;
- for (i = 0; i < KSTACK_PAGES; i++) {
+ for (i = 0; i < kstack_pages; i++) {
mmu_booke_kenter(mmu, kstack0, kstack0_phys);
kstack0 += PAGE_SIZE;
kstack0_phys += PAGE_SIZE;
OpenPOWER on IntegriCloud