arch/risc-v/src/mpfs/mpfs_userspace.c: Map MTIME into userspace reserved IO area in protected build

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
Jukka Laitinen 2023-02-09 20:53:42 +04:00 committed by Alan C. Assis
parent d62e500940
commit 85f6f4bca2
2 changed files with 12 additions and 0 deletions

View file

@ -23,6 +23,12 @@
#ifndef __ARCH_RISCV_SRC_MPFS_HARDWARE_MPFS_CLINT_H
#define __ARCH_RISCV_SRC_MPFS_HARDWARE_MPFS_CLINT_H
/****************************************************************************
* Included Files
****************************************************************************/
#include "mpfs_memorymap.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

View file

@ -33,6 +33,7 @@
#include <nuttx/userspace.h>
#include <arch/board/board_memorymap.h>
#include "hardware/mpfs_clint.h"
#include "mpfs_userspace.h"
#include "riscv_internal.h"
@ -250,6 +251,11 @@ static void configure_mmu(void)
map_region(UFLASH_START, UFLASH_START, UFLASH_SIZE, MMU_UTEXT_FLAGS);
map_region(USRAM_START, USRAM_START, USRAM_SIZE, MMU_UDATA_FLAGS);
/* Map the MTIME counter to the start of USR IO region */
map_region(MPFS_CLINT_MTIME & (~RV_MMU_PAGE_MASK), USRIO_START,
RV_MMU_PAGE_SIZE, PTE_R | PTE_U | PTE_G);
/* Connect the L1 and L2 page tables */
mmu_ln_setentry(1, PGT_L1_VBASE, PGT_L2_PBASE, UFLASH_START, PTE_G);