summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/aim
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/aim
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/aim')
-rw-r--r--sys/powerpc/aim/mmu_oea.c8
-rw-r--r--sys/powerpc/aim/mmu_oea64.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c
index 4734738..d45b34e 100644
--- a/sys/powerpc/aim/mmu_oea.c
+++ b/sys/powerpc/aim/mmu_oea.c
@@ -932,13 +932,13 @@ moea_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend)
* Allocate a kernel stack with a guard page for thread0 and map it
* into the kernel page map.
*/
- pa = moea_bootstrap_alloc(KSTACK_PAGES * PAGE_SIZE, PAGE_SIZE);
+ pa = moea_bootstrap_alloc(kstack_pages * PAGE_SIZE, PAGE_SIZE);
va = virtual_avail + KSTACK_GUARD_PAGES * PAGE_SIZE;
- virtual_avail = va + KSTACK_PAGES * PAGE_SIZE;
+ virtual_avail = va + kstack_pages * PAGE_SIZE;
CTR2(KTR_PMAP, "moea_bootstrap: kstack0 at %#x (%#x)", pa, va);
thread0.td_kstack = va;
- thread0.td_kstack_pages = KSTACK_PAGES;
- for (i = 0; i < KSTACK_PAGES; i++) {
+ thread0.td_kstack_pages = kstack_pages;
+ for (i = 0; i < kstack_pages; i++) {
moea_kenter(mmup, va, pa);
pa += PAGE_SIZE;
va += PAGE_SIZE;
diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c
index 44caec6..3766d86 100644
--- a/sys/powerpc/aim/mmu_oea64.c
+++ b/sys/powerpc/aim/mmu_oea64.c
@@ -917,13 +917,13 @@ moea64_late_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend
* Allocate a kernel stack with a guard page for thread0 and map it
* into the kernel page map.
*/
- pa = moea64_bootstrap_alloc(KSTACK_PAGES * PAGE_SIZE, PAGE_SIZE);
+ pa = moea64_bootstrap_alloc(kstack_pages * PAGE_SIZE, PAGE_SIZE);
va = virtual_avail + KSTACK_GUARD_PAGES * PAGE_SIZE;
- virtual_avail = va + KSTACK_PAGES * PAGE_SIZE;
+ virtual_avail = va + kstack_pages * PAGE_SIZE;
CTR2(KTR_PMAP, "moea64_bootstrap: kstack0 at %#x (%#x)", pa, va);
thread0.td_kstack = va;
- thread0.td_kstack_pages = KSTACK_PAGES;
- for (i = 0; i < KSTACK_PAGES; i++) {
+ thread0.td_kstack_pages = kstack_pages;
+ for (i = 0; i < kstack_pages; i++) {
moea64_kenter(mmup, va, pa);
pa += PAGE_SIZE;
va += PAGE_SIZE;
OpenPOWER on IntegriCloud