mirror of
https://github.com/apache/nuttx.git
synced 2026-08-14 08:53:15 +00:00
arch/x86_64/src/intel64: use legacy method to map memory <4GB
the new mapping method may not work when we have to map memory at the early boot stage Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
This commit is contained in:
parent
51d6e8f49e
commit
76bfb994a7
1 changed files with 23 additions and 7 deletions
|
|
@ -33,19 +33,19 @@
|
|||
#include "pgalloc.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_map_region
|
||||
* Name: up_map_region_higmem
|
||||
*
|
||||
* Description:
|
||||
* Map a memory region as 1:1 by MMU
|
||||
* Map a memory region as 1:1 by MMU for high memory region (>4Gb)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_MM_PGALLOC
|
||||
int up_map_region(void *base, size_t size, int flags)
|
||||
static int up_map_region_highmem(void *base, size_t size, int flags)
|
||||
{
|
||||
uintptr_t bb;
|
||||
int ptlevel;
|
||||
|
|
@ -113,7 +113,20 @@ int up_map_region(void *base, size_t size, int flags)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_map_region
|
||||
*
|
||||
* Description:
|
||||
* Map a memory region as 1:1 by MMU
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_map_region(void *base, size_t size, int flags)
|
||||
{
|
||||
uint64_t bb;
|
||||
|
|
@ -133,9 +146,13 @@ int up_map_region(void *base, size_t size, int flags)
|
|||
|
||||
if (bb > 0xffffffff)
|
||||
{
|
||||
/* More than 4GB can't be mapped with this implementtion */
|
||||
#ifdef CONFIG_MM_PGALLOC
|
||||
return up_map_region_highmem(base, size, flags);
|
||||
#else
|
||||
/* More than 4GB can't be mapped without CONFIG_MM_PGALLOC */
|
||||
|
||||
PANIC();
|
||||
#endif
|
||||
}
|
||||
|
||||
curr = bb;
|
||||
|
|
@ -149,4 +166,3 @@ int up_map_region(void *base, size_t size, int flags)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue