修复内核申请内存未清零导致死机的bug
This commit is contained in:
@@ -137,7 +137,7 @@ int app_load(const char *name, uenv_t *cur_env)
|
||||
{
|
||||
goto end_del_obj;
|
||||
}
|
||||
tag = task_map(hd_task, cur_env->ns_hd, cur_env->ns_hd, 0);
|
||||
tag = task_map(hd_task, cur_env->ns_hd, cur_env->ns_hd, KOBJ_DELETE_RIGHT);
|
||||
if (msg_tag_get_prot(tag) < 0)
|
||||
{
|
||||
goto end_del_obj;
|
||||
|
||||
@@ -21,11 +21,6 @@ typedef struct file_desc
|
||||
#define FILE_DESC_NR 8
|
||||
static file_desc_t files[FILE_DESC_NR];
|
||||
|
||||
void *file_temp_buf_get(void)
|
||||
{
|
||||
return (void *)(&files[0]);
|
||||
}
|
||||
|
||||
static file_desc_t *alloc_file(int *fd)
|
||||
{
|
||||
for (int i = 0; i < FILE_DESC_NR; i++)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <ff.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
static FATFS fs;
|
||||
static MKFS_PARM defopt = {FM_ANY, 0, 0, 0};
|
||||
|
||||
@@ -24,13 +25,12 @@ int main(int args, char *argv[])
|
||||
|
||||
if (res != FR_OK)
|
||||
{
|
||||
assert(sizeof(FIL) >= FF_MAX_SS);
|
||||
res = f_mkfs("0:", &defopt, file_temp_buf_get(), FF_MAX_SS); // 第三个参数可以设置成NULL,默认使用heap memory
|
||||
assert(sizeof(fs.win) >= FF_MAX_SS);
|
||||
res = f_mkfs("0:", &defopt, (void *)(fs.win), FF_MAX_SS); // 第三个参数可以设置成NULL,默认使用heap memory
|
||||
if (res != FR_OK)
|
||||
{
|
||||
ulog_write_str(u_get_global_env()->log_hd, "f_mkfs err.\n");
|
||||
while (1)
|
||||
;
|
||||
exit(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -38,15 +38,12 @@ int main(int args, char *argv[])
|
||||
if (res != FR_OK)
|
||||
{
|
||||
ulog_write_str(u_get_global_env()->log_hd, "f_mount err.\n");
|
||||
while (1)
|
||||
;
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
ulog_write_str(u_get_global_env()->log_hd, "mount success\n");
|
||||
|
||||
fs_svr_loop();
|
||||
while (1)
|
||||
;
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -44,11 +44,16 @@ int main(int argc, char *args[])
|
||||
env.ns_hd = ipc_hd;
|
||||
namespace_init(ipc_hd);
|
||||
u_sleep_init();
|
||||
ret = app_load("app", &env);
|
||||
// ret = app_load("app", &env);
|
||||
// if (ret < 0)
|
||||
// {
|
||||
// printf("app load fail, 0x%x\n", ret);
|
||||
// // ulog_write_str(LOG_PROT, "app load fail.\n");
|
||||
// }
|
||||
ret = app_load("hello", &env);
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("app load fail, 0x%x\n", ret);
|
||||
// ulog_write_str(LOG_PROT, "app load fail.\n");
|
||||
}
|
||||
ret = app_load("fatfs", &env);
|
||||
if (ret < 0)
|
||||
@@ -57,11 +62,7 @@ int main(int argc, char *args[])
|
||||
}
|
||||
// u_sleep_ms(500);
|
||||
// u_sleep_ms(500);
|
||||
ret = app_load("hello", &env);
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("app load fail, 0x%x\n", ret);
|
||||
}
|
||||
|
||||
namespace_pre_alloc_map_fd();
|
||||
namespace_loop();
|
||||
// task_unmap(TASK_THIS, vpage_create_raw3(KOBJ_DELETE_RIGHT, 0, TASK_THIS)); // 删除当前task,以及申请得所有对象
|
||||
|
||||
Reference in New Issue
Block a user