sched/spawn: Support task_spawnattr_[set|get]stackaddr

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2022-10-20 03:27:21 +08:00
committed by Masayuki Ishikawa
parent b9b032af72
commit 64e7833cbc
14 changed files with 68 additions and 25 deletions
+3
View File
@@ -70,6 +70,9 @@ int binfmt_dumpmodule(FAR const struct binary_s *bin)
binfo(" addrenv: %p\n", bin->addrenv);
#endif
binfo(" stacksize: %zd\n", bin->stacksize);
#ifndef CONFIG_BUILD_KERNEL
binfo(" stackaddr: %p\n", bin->stackaddr);
#endif
binfo(" unload: %p\n", bin->unload);
}
+7
View File
@@ -110,6 +110,13 @@ int exec_spawn(FAR const char *filename, FAR char * const *argv,
{
bin->stacksize = attr->stacksize;
}
#ifndef CONFIG_BUILD_KERNEL
if (attr->stackaddr != NULL)
{
bin->stackaddr = attr->stackaddr;
}
#endif
}
/* Disable pre-emption so that the executed module does
+7 -2
View File
@@ -120,6 +120,7 @@ int exec_module(FAR const struct binary_s *binp,
save_addrenv_t oldenv;
FAR void *vheap;
#endif
FAR void *stackaddr = NULL;
pid_t pid;
int ret;
@@ -189,14 +190,18 @@ int exec_module(FAR const struct binary_s *binp,
/* Initialize the task */
#ifndef CONFIG_BUILD_KERNEL
stackaddr = binp->stackaddr;
#endif
if (argv && argv[0])
{
ret = nxtask_init(tcb, argv[0], binp->priority, NULL,
ret = nxtask_init(tcb, argv[0], binp->priority, stackaddr,
binp->stacksize, binp->entrypt, &argv[1], envp);
}
else
{
ret = nxtask_init(tcb, filename, binp->priority, NULL,
ret = nxtask_init(tcb, filename, binp->priority, stackaddr,
binp->stacksize, binp->entrypt, argv, envp);
}