From 250353240c8bba89cc1991808f7c04c7f860a559 Mon Sep 17 00:00:00 2001 From: chenrun1 Date: Thu, 20 Jun 2024 20:11:33 +0800 Subject: [PATCH] rammap:Adjust the lower two bits to represent type Summary: In rammap: 1.0 - User 2.1 - Kernel 3.2 - XIP Therefore we need to use 2 bits to represent the type Signed-off-by: chenrun1 --- fs/mmap/fs_rammap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/mmap/fs_rammap.c b/fs/mmap/fs_rammap.c index fbcc7507df..7f31ba5b61 100644 --- a/fs/mmap/fs_rammap.c +++ b/fs/mmap/fs_rammap.c @@ -56,7 +56,7 @@ static int msync_rammap(FAR struct mm_map_entry_s *entry, FAR void *start, size_t length, int flags) { - FAR struct file *filep = (FAR void *)((uintptr_t)entry->priv.p & ~1); + FAR struct file *filep = (FAR void *)((uintptr_t)entry->priv.p & ~3); FAR uint8_t *wrbuffer = start; ssize_t nwrite = 0; off_t offset; @@ -123,8 +123,8 @@ static int unmap_rammap(FAR struct task_group_s *group, FAR void *start, size_t length) { - FAR struct file *filep = (FAR void *)((uintptr_t)entry->priv.p & ~1); - enum mm_map_type_e type = (uintptr_t)entry->priv.p & 1; + FAR struct file *filep = (FAR void *)((uintptr_t)entry->priv.p & ~3); + enum mm_map_type_e type = (uintptr_t)entry->priv.p & 3; FAR void *newaddr = NULL; off_t offset; int ret = OK;