git: a8adbe528446 - stable/13 - arm64, powerpc: fix calculation of 'used' in GET_STACK_USAGE
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 07 Dec 2021 18:14:27 UTC
The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=a8adbe528446352a27e774c7c33bea027e7a7c15 commit a8adbe528446352a27e774c7c33bea027e7a7c15 Author: Mitchell Horne <mhorne@FreeBSD.org> AuthorDate: 2021-11-30 15:15:44 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2021-12-07 18:13:47 +0000 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 (cherry picked from commit b02908b051c897117ebbc3dcb55848383b17c435) --- sys/arm64/include/proc.h | 4 +--- sys/powerpc/include/proc.h | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/sys/arm64/include/proc.h b/sys/arm64/include/proc.h index bb933dc98241..b34581f0bd8b 100644 --- a/sys/arm64/include/proc.h +++ b/sys/arm64/include/proc.h @@ -60,9 +60,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 diff --git a/sys/powerpc/include/proc.h b/sys/powerpc/include/proc.h index d4df3ccfefef..097891253009 100644 --- a/sys/powerpc/include/proc.h +++ b/sys/powerpc/include/proc.h @@ -74,9 +74,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