hwpmc: use kstack_contains()

This existing helper function is preferable to the hand-rolled
calculation of the kstack bounds.

Make some small style improvements while here. Notably, rename every
instance of "r", the return address, to "ra". Tidy the includes in the
affected files.

Reviewed by:	jkoshy
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39909
This commit is contained in:
Mitchell Horne
2023-05-05 18:59:01 -03:00
parent 5387495773
commit aba91805aa
8 changed files with 61 additions and 93 deletions
+2 -4
View File
@@ -52,11 +52,9 @@ union pmc_md_pmc {
struct pmc_md_armv7_pmc pm_armv7;
};
#define PMC_IN_KERNEL_STACK(S,START,END) \
((S) >= (START) && (S) < (END))
#define PMC_IN_KERNEL_STACK(va) kstack_contains(curthread, (va), sizeof(va))
#define PMC_IN_KERNEL(va) INKERNEL((va))
#define PMC_IN_USERSPACE(va) ((va) <= VM_MAXUSER_ADDRESS)
#define PMC_IN_USERSPACE(va) ((va) <= VM_MAXUSER_ADDRESS)
#define PMC_TRAPFRAME_TO_PC(TF) ((TF)->tf_pc)
#define PMC_TRAPFRAME_TO_FP(TF) ((TF)->tf_r11)