fix lunch params etc.
This commit is contained in:
@@ -7,8 +7,8 @@ if (${ARCH_NAME} STREQUAL "armv7_8m")
|
||||
add_subdirectory(mr)
|
||||
# add_subdirectory(at_device)
|
||||
elseif(${CONFIG_ARCH} STREQUAL "aarch64")
|
||||
add_subdirectory(mkrtos-musl)
|
||||
endif()
|
||||
add_subdirectory(mkrtos-musl)
|
||||
add_subdirectory(sys)
|
||||
add_subdirectory(sys_util)
|
||||
add_subdirectory(util)
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "u_sleep.h"
|
||||
static Shell shell;
|
||||
static ShellFs shellFs;
|
||||
static char shellBuffer[256];
|
||||
static char shellBuffer[512];
|
||||
// static char shellPathBuffer[128] = "/";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w -D_XOPEN_SOURCE=700 ")
|
||||
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -w -D_XOPEN_SOURCE=700 ")
|
||||
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -w -D_XOPEN_SOURCE=700 -Wa,-mimplicit-it=thumb ")
|
||||
|
||||
file(GLOB_RECURSE deps
|
||||
src/*.C
|
||||
|
||||
@@ -7,15 +7,15 @@ _longjmp:
|
||||
longjmp:
|
||||
mov ip,r0
|
||||
movs r0,r1
|
||||
it eq
|
||||
moveq r0,#1
|
||||
ldmia ip!, {v1,v2,v3,v4,v5,v6,sl,fp}
|
||||
ldmia ip!, {r2,lr}
|
||||
mov sp,r2
|
||||
|
||||
adr r1,1f
|
||||
ldr r2,1f
|
||||
ldr r1,[r1,r2]
|
||||
//adr r1,1f
|
||||
//ldr r2,1f
|
||||
//ldr r1,[r1,r2]
|
||||
mov r1, #0
|
||||
|
||||
#if __ARM_ARCH < 8
|
||||
tst r1,#0x260
|
||||
@@ -23,12 +23,12 @@ longjmp:
|
||||
// HWCAP_ARM_FPA
|
||||
tst r1,#0x20
|
||||
beq 2f
|
||||
// ldc p2, cr4, [ip], #48
|
||||
ldc p2, cr4, [ip], #48
|
||||
#endif
|
||||
2: tst r1,#0x40
|
||||
beq 2f
|
||||
// .fpu vfp
|
||||
// vldmia ip!, {d8-d15}
|
||||
.fpu vfp
|
||||
vldmia ip!, {d8-d15}
|
||||
.fpu softvfp
|
||||
.eabi_attribute 10, 0
|
||||
.eabi_attribute 27, 0
|
||||
@@ -36,12 +36,12 @@ longjmp:
|
||||
// HWCAP_ARM_IWMMXT
|
||||
2: tst r1,#0x200
|
||||
beq 3f
|
||||
// ldcl p1, cr10, [ip], #8
|
||||
// ldcl p1, cr11, [ip], #8
|
||||
// ldcl p1, cr12, [ip], #8
|
||||
// ldcl p1, cr13, [ip], #8
|
||||
// ldcl p1, cr14, [ip], #8
|
||||
// ldcl p1, cr15, [ip], #8
|
||||
ldcl p1, cr10, [ip], #8
|
||||
ldcl p1, cr11, [ip], #8
|
||||
ldcl p1, cr12, [ip], #8
|
||||
ldcl p1, cr13, [ip], #8
|
||||
ldcl p1, cr14, [ip], #8
|
||||
ldcl p1, cr15, [ip], #8
|
||||
#endif
|
||||
2:
|
||||
3: bx lr
|
||||
|
||||
@@ -14,9 +14,10 @@ setjmp:
|
||||
stmia ip!,{r2,lr}
|
||||
mov r0,#0
|
||||
|
||||
adr r1,1f
|
||||
ldr r2,1f
|
||||
ldr r1,[r1,r2]
|
||||
//adr r1,1f
|
||||
//ldr r2,1f
|
||||
//ldr r1,[r1,r2]
|
||||
mov r1, #0
|
||||
|
||||
#if __ARM_ARCH < 8
|
||||
tst r1,#0x260
|
||||
@@ -24,12 +25,12 @@ setjmp:
|
||||
// HWCAP_ARM_FPA
|
||||
tst r1,#0x20
|
||||
beq 2f
|
||||
// stc p2, cr4, [ip], #48
|
||||
stc p2, cr4, [ip], #48
|
||||
#endif
|
||||
2: tst r1,#0x40
|
||||
beq 2f
|
||||
// .fpu vfp
|
||||
// vstmia ip!, {d8-d15}
|
||||
.fpu vfp
|
||||
vstmia ip!, {d8-d15}
|
||||
.fpu softvfp
|
||||
.eabi_attribute 10, 0
|
||||
.eabi_attribute 27, 0
|
||||
@@ -37,12 +38,12 @@ setjmp:
|
||||
// HWCAP_ARM_IWMMXT
|
||||
2: tst r1,#0x200
|
||||
beq 3f
|
||||
// stcl p1, cr10, [ip], #8
|
||||
// stcl p1, cr11, [ip], #8
|
||||
// stcl p1, cr12, [ip], #8
|
||||
// stcl p1, cr13, [ip], #8
|
||||
// stcl p1, cr14, [ip], #8
|
||||
// stcl p1, cr15, [ip], #8
|
||||
stcl p1, cr10, [ip], #8
|
||||
stcl p1, cr11, [ip], #8
|
||||
stcl p1, cr12, [ip], #8
|
||||
stcl p1, cr13, [ip], #8
|
||||
stcl p1, cr14, [ip], #8
|
||||
stcl p1, cr15, [ip], #8
|
||||
#endif
|
||||
2:
|
||||
3: bx lr
|
||||
|
||||
@@ -24,7 +24,11 @@ sd_t fs_open(const char *path, int flags, int mode)
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
ret = ns_query(path, &hd, 0x0);
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
rpc_ref_file_array_t rpc_path = {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "cpiofs.h"
|
||||
#include "u_env.h"
|
||||
#include "u_sys.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <elf.h>
|
||||
@@ -125,6 +126,10 @@ int app_load(const char *name, uenv_t *cur_env, pid_t *pid,
|
||||
{
|
||||
return -ENOENT;
|
||||
}
|
||||
// for (int i = 0; i < arg_cn; i++)
|
||||
// {
|
||||
// printf("argv[%d]:%s\n", i, argv[i]);
|
||||
// }
|
||||
int type;
|
||||
umword_t addr;
|
||||
int ret = cpio_find_file((umword_t)sys_info.bootfs_start_addr, (umword_t)(-1), name, NULL, &type, &addr);
|
||||
@@ -254,28 +259,26 @@ int app_load(const char *name, uenv_t *cur_env, pid_t *pid,
|
||||
.rev2 = HANDLER_INVALID,
|
||||
};
|
||||
umword_t *app_env;
|
||||
char *cp_args;
|
||||
char *cp_envp;
|
||||
char *cp_args[8/*FIXME:*/];
|
||||
char *cp_envp[8];
|
||||
size_t params_envp_len = 0;
|
||||
|
||||
app_env = app_stack_push_array(hd_task, &usp_top, (uint8_t *)(&uenv), sizeof(uenv));
|
||||
for (int i = 0; i < arg_cn; i++)
|
||||
{
|
||||
cp_args = app_stack_push_str(hd_task, &usp_top, argv[i]);
|
||||
if ((ALIGN(strlen(argv[i]) + 1, sizeof(void *)) / sizeof(void *)) % 2)
|
||||
{
|
||||
app_stack_push_umword(hd_task, &usp_top, 0);
|
||||
}
|
||||
printf("app_load 1 cp_args:%p\n", cp_args);
|
||||
cp_args[i] = app_stack_push_str(hd_task, &usp_top, argv[i]);
|
||||
params_envp_len += ALIGN(strlen(argv[i]) + 1, sizeof(void *));
|
||||
printf("app_load 1 cp_args:%p\n", cp_args[i]);
|
||||
}
|
||||
for (int i = 0; i < envp_cn; i++)
|
||||
{
|
||||
cp_envp = app_stack_push_str(hd_task, &usp_top, envp[i]);
|
||||
if ((ALIGN(strlen(argv[i]) + 1, sizeof(void *)) / sizeof(void *)) % 2)
|
||||
{
|
||||
app_stack_push_umword(hd_task, &usp_top, 0);
|
||||
}
|
||||
cp_envp[i] = app_stack_push_str(hd_task, &usp_top, envp[i]);
|
||||
params_envp_len += ALIGN(strlen(argv[i]) + 1, sizeof(void *));
|
||||
}
|
||||
if ((umword_t)usp_top & 0x7UL)
|
||||
{
|
||||
usp_top = (umword_t *)((umword_t)usp_top & ~0x7UL);
|
||||
}
|
||||
|
||||
app_stack_push_umword(hd_task, &usp_top, 0);
|
||||
if ((arg_cn + envp_cn) & 0x1) // 参数是奇数是,多添加一个
|
||||
{
|
||||
@@ -289,31 +292,15 @@ int app_load(const char *name, uenv_t *cur_env, pid_t *pid,
|
||||
app_stack_push_umword(hd_task, &usp_top, (umword_t)AT_PAGESZ);
|
||||
|
||||
app_stack_push_umword(hd_task, &usp_top, 0);
|
||||
for (int i = 0; i < envp_cn; i++)
|
||||
for (int i = envp_cn - 1; i >= 0; i--)
|
||||
{
|
||||
app_stack_push_umword(hd_task, &usp_top, (umword_t)cp_envp);
|
||||
cp_envp += ALIGN(strlen(envp[i]), sizeof(void *));
|
||||
if ((ALIGN(strlen(envp[i]) + 1, sizeof(void *)) / sizeof(void *)) % 2)
|
||||
{
|
||||
cp_envp += sizeof(void *);
|
||||
}
|
||||
app_stack_push_umword(hd_task, &usp_top, (umword_t)cp_envp[i]);
|
||||
}
|
||||
if (arg_cn)
|
||||
app_stack_push_umword(hd_task, &usp_top, 0);
|
||||
for (int i = arg_cn - 1; i >= 0; i--)
|
||||
{
|
||||
app_stack_push_umword(hd_task, &usp_top, 0);
|
||||
for (int i = 0; i < arg_cn; i++)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
if ((ALIGN(strlen(argv[i]) + 1, sizeof(void *)) / sizeof(void *)) % 2)
|
||||
{
|
||||
cp_args += sizeof(void *);
|
||||
}
|
||||
}
|
||||
printf("app_load 2 cp_args:%p\n", cp_args);
|
||||
app_stack_push_umword(hd_task, &usp_top, (umword_t)cp_args);
|
||||
cp_args += ALIGN(strlen(argv[i]) + 1, sizeof(void *));
|
||||
}
|
||||
printf("app_load 2 cp_args:%p\n", cp_args[i]);
|
||||
app_stack_push_umword(hd_task, &usp_top, (umword_t)cp_args[i]);
|
||||
}
|
||||
app_stack_push_umword(hd_task, &usp_top, arg_cn);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user