Make vm_map_max/min/pmap KBI stable.

There are out of tree consumers of vm_map_min() and vm_map_max(), and
I believe there are consumers of vm_map_pmap(), although the later is
arguably less in the need of KBI-stable interface. For the consumers
benefit, make modules using this KPI not depended on the struct vm_map
layout.

Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D14902
This commit is contained in:
Konstantin Belousov 2018-03-30 10:55:31 +00:00
parent c93ff841aa
commit 19ea042eb8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=331760
2 changed files with 30 additions and 0 deletions

View File

@ -4315,6 +4315,27 @@ vm_map_lookup_done(vm_map_t map, vm_map_entry_t entry)
vm_map_unlock_read(map);
}
vm_offset_t
vm_map_max_KBI(const struct vm_map *map)
{
return (map->max_offset);
}
vm_offset_t
vm_map_min_KBI(const struct vm_map *map)
{
return (map->min_offset);
}
pmap_t
vm_map_pmap_KBI(vm_map_t map)
{
return (map->pmap);
}
#include "opt_ddb.h"
#ifdef DDB
#include <sys/kernel.h>

View File

@ -206,6 +206,11 @@ struct vm_map {
#define MAP_BUSY_WAKEUP 0x02
#ifdef _KERNEL
#ifdef KLD_MODULE
#define vm_map_max(map) vm_map_max_KBI((map))
#define vm_map_min(map) vm_map_min_KBI((map))
#define vm_map_pmap(map) vm_map_pmap_KBI((map))
#else
static __inline vm_offset_t
vm_map_max(const struct vm_map *map)
{
@ -229,6 +234,7 @@ vm_map_modflags(vm_map_t map, vm_flags_t set, vm_flags_t clear)
{
map->flags = (map->flags | set) & ~clear;
}
#endif /* KLD_MODULE */
#endif /* _KERNEL */
/*
@ -289,6 +295,9 @@ void vm_map_wakeup(vm_map_t map);
void vm_map_busy(vm_map_t map);
void vm_map_unbusy(vm_map_t map);
void vm_map_wait_busy(vm_map_t map);
vm_offset_t vm_map_max_KBI(const struct vm_map *map);
vm_offset_t vm_map_min_KBI(const struct vm_map *map);
pmap_t vm_map_pmap_KBI(vm_map_t map);
#define vm_map_lock(map) _vm_map_lock(map, LOCK_FILE, LOCK_LINE)
#define vm_map_unlock(map) _vm_map_unlock(map, LOCK_FILE, LOCK_LINE)