This commit is contained in:
zhangzheng
2024-01-04 00:05:52 +08:00
parent 6f31d27cf6
commit 9e12267f9d
4 changed files with 13 additions and 4 deletions

View File

@@ -95,7 +95,7 @@ void mem_free(mem_t *_this, void *mem)
mem_merge(_this, m_mem);
spinlock_set(&_this->lock, status);
// #if MEM_TRACE
// mem_trace(_this);
mem_trace(_this);
// #endif
}
/**
@@ -128,6 +128,8 @@ void *mem_split(mem_t *_this, void *mem, uint32_t size)
t_mem->used = 1;
t_mem->size = size - MEM_HEAP_STRUCT_SIZE;
spinlock_set(&_this->lock, status);
mem_trace(_this);
return (void *)((ptr_t)r_mem + MEM_HEAP_STRUCT_SIZE);
}
/**
@@ -188,6 +190,7 @@ void mem_free_align(mem_t *_this, void *f_mem)
{
struct mem_heap *mem;
void *real_mem;
int find = 0;
umword_t status = spinlock_lock(&_this->lock);
for (mem = _this->heap_start; mem != _this->heap_end; mem = mem->next)
@@ -195,6 +198,7 @@ void mem_free_align(mem_t *_this, void *f_mem)
assert(mem->magic == MAGIC_NUM);
if ((ptr_t)mem == (ptr_t)f_mem - MEM_HEAP_STRUCT_SIZE)
{
find = 1;
break;
}
}
@@ -245,14 +249,14 @@ void *mem_alloc(mem_t *_this, uint32_t size)
mem->next->prev = mem_temp;
mem->next = mem_temp;
spinlock_set(&_this->lock, status);
mem_trace(_this);
return (void *)((ptr_t)mem + MEM_HEAP_STRUCT_SIZE);
}
else
{
mem->used = 1;
spinlock_set(&_this->lock, status);
mem_trace(_this);
return (void *)((ptr_t)mem + MEM_HEAP_STRUCT_SIZE);
}
}

View File

@@ -495,6 +495,10 @@ static int thread_ipc_recv(msg_tag_t *ret_msg, ipc_timeout_t timeout,
}
thread_suspend(cur_th); //!< 挂起
preemption(); //!< 进行调度
if (slist_in_list(&wait.node))
{
slist_del(&wait.node);
}
if (cur_th->ipc_status == THREAD_IPC_ABORT)
{
cur_th->ipc_status = THREAD_NONE;

View File

@@ -107,6 +107,7 @@ static void knl_init_2(void)
{
mm_trace();
init_thread = thread_create(&root_factory_get()->limit);
assert(init_thread);
init_task = task_create(&root_factory_get()->limit, FALSE);

View File

@@ -267,7 +267,7 @@ int rpc_mtd_loop(void)
continue;
}
tag = thread_ipc_wait(ipc_timeout_create2(0, 0), &obj, ipc_hd);
tag = thread_ipc_wait(ipc_timeout_create2(1000, 1000), &obj, ipc_hd);
if (msg_tag_get_val(tag) < 0)
{
handler_free_umap(ipc_hd);