summaryrefslogtreecommitdiff
path: root/components/lwp/lwp_shm.c
diff options
context:
space:
mode:
authorMan, Jianting (Meco) <[email protected]>2023-02-25 13:52:37 -0500
committerGitHub <[email protected]>2023-02-25 13:52:37 -0500
commit1acef4277b02e5084310ecd7028656ae535178f5 (patch)
tree03b6b6f0b3df75a1cef301e1e7b2b3d234213390 /components/lwp/lwp_shm.c
parent759192f5f5af23ae360818483d35974ef5b91c78 (diff)
parente63e33a3c64327aef3556fa811df0a8ec1e0e7ee (diff)
Merge pull request #6981 from RT-Thread/masterserialX-dev
sync from master
Diffstat (limited to 'components/lwp/lwp_shm.c')
-rw-r--r--components/lwp/lwp_shm.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/components/lwp/lwp_shm.c b/components/lwp/lwp_shm.c
index 8c765fc8c9..51964dd2b8 100644
--- a/components/lwp/lwp_shm.c
+++ b/components/lwp/lwp_shm.c
@@ -101,7 +101,7 @@ static int _lwp_shmget(size_t key, size_t size, int create)
int id = -1;
struct lwp_avl_struct *node_key = 0;
struct lwp_avl_struct *node_pa = 0;
- void *page_addr = 0, *page_addr_p = RT_NULL;
+ void *page_addr = 0;
uint32_t bit = 0;
/* try to locate the item with the key in the binary tree */
@@ -134,11 +134,10 @@ static int _lwp_shmget(size_t key, size_t size, int create)
{
goto err;
}
- page_addr_p = (void *)((char *)page_addr + PV_OFFSET); /* physical address */
/* initialize the shared memory structure */
p = _shm_ary + id;
- p->addr = (size_t)page_addr_p;
+ p->addr = (size_t)page_addr;
p->size = (1UL << (bit + ARCH_PAGE_SHIFT));
p->ref = 0;
p->key = key;
@@ -236,7 +235,7 @@ static int _lwp_shmrm(int id)
return 0;
}
bit = rt_page_bits(p->size);
- rt_pages_free((void *)((char *)p->addr - PV_OFFSET), bit);
+ rt_pages_free((void *)p->addr, bit);
lwp_avl_remove(node_key, &shm_tree_key);
node_pa = node_key + 1;
lwp_avl_remove(node_pa, &shm_tree_pa);