diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2026-07-19 00:29:40 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2026-07-19 00:29:40 +0000 |
| commit | a7e483ee146a93ac89357676fdb9af62ac58b4bc (patch) | |
| tree | e1e529344fe6098436d9b176ac58a4554fedff66 /sys/amd64 | |
| parent | cbd442efe85d9ae371581565670dfc0287afbf8e (diff) | |
vm_phys: Add a sysctl to dump registered fictitious memory ranges
I've wanted this a couple of times in the past. Save the memattr in
the fictitious memory segment structure so that we can report it from
the sysctl handler, and add conversion routines for each platform.
Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D58283
Diffstat (limited to 'sys/amd64')
| -rw-r--r-- | sys/amd64/include/vm.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/amd64/include/vm.h b/sys/amd64/include/vm.h index 2e156b1cb1be..7219f8650a9f 100644 --- a/sys/amd64/include/vm.h +++ b/sys/amd64/include/vm.h @@ -43,4 +43,27 @@ #define VM_MEMATTR_DEFAULT VM_MEMATTR_WRITE_BACK #define VM_MEMATTR_DEVICE VM_MEMATTR_UNCACHEABLE +#ifdef _KERNEL +static inline const char * +vm_memattr_name(vm_memattr_t memattr) +{ + switch (memattr) { + case VM_MEMATTR_UNCACHEABLE: + return ("uncacheable"); + case VM_MEMATTR_WRITE_COMBINING: + return ("write-combining"); + case VM_MEMATTR_WRITE_THROUGH: + return ("write-through"); + case VM_MEMATTR_WRITE_PROTECTED: + return ("write-protected"); + case VM_MEMATTR_WRITE_BACK: + return ("write-back"); + case VM_MEMATTR_WEAK_UNCACHEABLE: + return ("weak-uncacheable"); + default: + return (NULL); + } +} +#endif + #endif /* !_MACHINE_VM_H_ */ |
