diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 510c6d375a2..dbad85096a1 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1367,7 +1367,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) thread0.td_kstack = (char *)physfree - kernphys + KERNSTART; thread0.td_kstack_pages = kstack_pages; - kstack0_sz = thread0.td_kstack_pages * PAGE_SIZE; + kstack0_sz = ptoa(kstack_pages); bzero(thread0.td_kstack, kstack0_sz); cpu_thread_new_kstack(&thread0); physfree += kstack0_sz; diff --git a/sys/amd64/include/stack.h b/sys/amd64/include/stack.h index 765a8e78dae..7d821348be0 100644 --- a/sys/amd64/include/stack.h +++ b/sys/amd64/include/stack.h @@ -12,7 +12,7 @@ /* Get the current kernel thread stack usage. */ #define GET_STACK_USAGE(total, used) do { \ struct thread *td = curthread; \ - (total) = td->td_kstack_pages * PAGE_SIZE; \ + (total) = ptoa(td->td_kstack_pages); \ (used) = td_kstack_top(td) - (char *)&td; \ } while (0) diff --git a/sys/arm/include/stack.h b/sys/arm/include/stack.h index 6af9418aba4..f6bc67dbe77 100644 --- a/sys/arm/include/stack.h +++ b/sys/arm/include/stack.h @@ -68,7 +68,7 @@ void unwind_module_unloaded(struct linker_file *); /* Get the current kernel thread stack usage. */ #define GET_STACK_USAGE(total, used) do { \ struct thread *td = curthread; \ - (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \ + (total) = ptoa(td->td_kstack_pages) - sizeof(struct pcb); \ (used) = td->td_kstack + (total) - (char *)&td; \ } while (0) diff --git a/sys/arm64/include/stack.h b/sys/arm64/include/stack.h index b89019fbbec..0aa483e15e6 100644 --- a/sys/arm64/include/stack.h +++ b/sys/arm64/include/stack.h @@ -43,7 +43,7 @@ bool unwind_frame(struct thread *, struct unwind_state *); #define GET_STACK_USAGE(total, used) do { \ struct thread *td = curthread; \ - (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \ + (total) = ptoa(td->td_kstack_pages) - sizeof(struct pcb); \ (used) = td->td_kstack + (total) - (char *)&td; \ } while (0) diff --git a/sys/powerpc/include/stack.h b/sys/powerpc/include/stack.h index 0fb9a929128..533ff0fa205 100644 --- a/sys/powerpc/include/stack.h +++ b/sys/powerpc/include/stack.h @@ -38,7 +38,7 @@ extern int end[]; /* Get the current kernel thread stack usage. */ #define GET_STACK_USAGE(total, used) do { \ struct thread *td = curthread; \ - (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \ + (total) = ptoa(td->td_kstack_pages) - sizeof(struct pcb); \ (used) = td->td_kstack + (total) - (char *)&td; \ } while (0) diff --git a/sys/riscv/include/stack.h b/sys/riscv/include/stack.h index 7de9f05b567..5669dcda6c6 100644 --- a/sys/riscv/include/stack.h +++ b/sys/riscv/include/stack.h @@ -53,7 +53,7 @@ bool unwind_frame(struct thread *, struct unwind_state *); /* Get the current kernel thread stack usage. */ #define GET_STACK_USAGE(total, used) do { \ struct thread *td = curthread; \ - (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \ + (total) = ptoa(td->td_kstack_pages) - sizeof(struct pcb); \ (used) = td->td_kstack + (total) - (char *)&td; \ } while (0)