提交 cc0f5ca1 编写于 作者: armink_ztl's avatar armink_ztl

[kernel][mem] Improve some ISR check range.

上级 94422074
...@@ -261,11 +261,11 @@ void *rt_malloc(rt_size_t size) ...@@ -261,11 +261,11 @@ void *rt_malloc(rt_size_t size)
rt_size_t ptr, ptr2; rt_size_t ptr, ptr2;
struct heap_mem *mem, *mem2; struct heap_mem *mem, *mem2;
RT_DEBUG_NOT_IN_INTERRUPT;
if (size == 0) if (size == 0)
return RT_NULL; return RT_NULL;
RT_DEBUG_NOT_IN_INTERRUPT;
if (size != RT_ALIGN(size, RT_ALIGN_SIZE)) if (size != RT_ALIGN(size, RT_ALIGN_SIZE))
RT_DEBUG_LOG(RT_DEBUG_MEM, ("malloc size %d, but align to %d\n", RT_DEBUG_LOG(RT_DEBUG_MEM, ("malloc size %d, but align to %d\n",
size, RT_ALIGN(size, RT_ALIGN_SIZE))); size, RT_ALIGN(size, RT_ALIGN_SIZE)));
...@@ -513,8 +513,6 @@ void *rt_calloc(rt_size_t count, rt_size_t size) ...@@ -513,8 +513,6 @@ void *rt_calloc(rt_size_t count, rt_size_t size)
{ {
void *p; void *p;
RT_DEBUG_NOT_IN_INTERRUPT;
/* allocate 'count' objects of size 'size' */ /* allocate 'count' objects of size 'size' */
p = rt_malloc(count * size); p = rt_malloc(count * size);
...@@ -536,10 +534,11 @@ void rt_free(void *rmem) ...@@ -536,10 +534,11 @@ void rt_free(void *rmem)
{ {
struct heap_mem *mem; struct heap_mem *mem;
RT_DEBUG_NOT_IN_INTERRUPT;
if (rmem == RT_NULL) if (rmem == RT_NULL)
return; return;
RT_DEBUG_NOT_IN_INTERRUPT;
RT_ASSERT((((rt_uint32_t)rmem) & (RT_ALIGN_SIZE - 1)) == 0); RT_ASSERT((((rt_uint32_t)rmem) & (RT_ALIGN_SIZE - 1)) == 0);
RT_ASSERT((rt_uint8_t *)rmem >= (rt_uint8_t *)heap_ptr && RT_ASSERT((rt_uint8_t *)rmem >= (rt_uint8_t *)heap_ptr &&
(rt_uint8_t *)rmem < (rt_uint8_t *)heap_end); (rt_uint8_t *)rmem < (rt_uint8_t *)heap_end);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册