Skip to content

Commit

Permalink
arch/addrenv: Add utility function to wipe one page
Browse files Browse the repository at this point in the history
up_addrenv_page_wipe can be used to wipe a single page of memory.
  • Loading branch information
pussuw committed Feb 6, 2024
1 parent ff63fc5 commit 6f98b11
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
20 changes: 20 additions & 0 deletions arch/risc-v/src/common/riscv_addrenv_pgmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,26 @@ bool up_addrenv_user_vaddr(uintptr_t vaddr)
return riscv_uservaddr(vaddr);
}

/****************************************************************************
* Name: up_addrenv_page_wipe
*
* Description:
* Wipe a page of physical memory, first mapping it into kernel virtual
* memory.
*
* Input Parameters:
* page - The page physical address.
*
* Returned Value:
* None.
*
****************************************************************************/

void up_addrenv_page_wipe(uintptr_t page)
{
riscv_pgwipe(page);
}

#ifdef CONFIG_MM_KMAP

/****************************************************************************
Expand Down
21 changes: 20 additions & 1 deletion include/nuttx/arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -1318,14 +1318,33 @@ uintptr_t up_addrenv_page_vaddr(uintptr_t page);
* vaddr - The virtual address.
*
* Returned Value:
* True if it is; false if it's not
* True if it is; false if it's not.
*
****************************************************************************/

#ifdef CONFIG_ARCH_ADDRENV
bool up_addrenv_user_vaddr(uintptr_t vaddr);
#endif

/****************************************************************************
* Name: up_addrenv_page_wipe
*
* Description:
* Wipe a page of physical memory, first mapping it into kernel virtual
* memory.
*
* Input Parameters:
* page - The page physical address.
*
* Returned Value:
* None.
*
****************************************************************************/

#ifdef CONFIG_ARCH_ADDRENV
void up_addrenv_page_wipe(uintptr_t page);
#endif

/****************************************************************************
* Name: up_addrenv_kmap_init
*
Expand Down

0 comments on commit 6f98b11

Please sign in to comment.