posix: options: mlock: refine imply for MMU and DEMAND_PAGING
POSIX mlock() and munlock() require an MMU as well as DEMAND_PAGING. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
parent
d4deeebff1
commit
8609a05236
2 changed files with 17 additions and 7 deletions
|
@ -49,7 +49,7 @@ config POSIX_MEMLOCK
|
|||
|
||||
config POSIX_MEMLOCK_RANGE
|
||||
bool "POSIX range memory locking"
|
||||
imply MMU
|
||||
imply MMU if (CPU_HAS_MMU && ARCH_HAS_DEMAND_PAGING)
|
||||
imply DEMAND_PAGING
|
||||
help
|
||||
Select 'y' here and Zephyr will provide support for mlock() and munlock().
|
||||
|
|
|
@ -13,18 +13,28 @@
|
|||
|
||||
int mlock(const void *addr, size_t len)
|
||||
{
|
||||
void *const _addr = (void *)addr;
|
||||
if (IS_ENABLED(CONFIG_DEMAND_PAGING)) {
|
||||
void *const _addr = (void *)addr;
|
||||
|
||||
k_mem_pin(_addr, len);
|
||||
k_mem_pin(_addr, len);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
errno = ENOTSUP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int munlock(const void *addr, size_t len)
|
||||
{
|
||||
void *const _addr = (void *)addr;
|
||||
if (IS_ENABLED(CONFIG_DEMAND_PAGING)) {
|
||||
void *const _addr = (void *)addr;
|
||||
|
||||
k_mem_unpin(_addr, len);
|
||||
k_mem_unpin(_addr, len);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
errno = ENOTSUP;
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue