arm64, powerpc: fix calculation of 'used' in GET_STACK_USAGE

We do not consider the space reserved for the pcb to be part of the
total kstack size, so it should not be included in the calculation of
the used stack size.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mitchell Horne 2021-11-30 11:15:44 -04:00
parent 8bc792b384
commit b02908b051
2 changed files with 2 additions and 6 deletions

View File

@ -62,9 +62,7 @@ struct syscall_args {
#define GET_STACK_USAGE(total, used) do { \
struct thread *td = curthread; \
(total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \
(used) = (char *)td->td_kstack + \
td->td_kstack_pages * PAGE_SIZE - \
(char *)&td; \
(used) = td->td_kstack + (total) - (vm_offset_t)&td; \
} while (0)
#endif

View File

@ -75,9 +75,7 @@ struct syscall_args {
#define GET_STACK_USAGE(total, used) do { \
struct thread *td = curthread; \
(total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \
(used) = (char *)td->td_kstack + \
td->td_kstack_pages * PAGE_SIZE - \
(char *)&td; \
(used) = td->td_kstack + (total) - (vm_offset_t)&td; \
} while (0)
#endif