mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 07:12:54 +08:00
sched/spawn: Support task_spawnattr_[set|get]stackaddr
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Masayuki Ishikawa
parent
b9b032af72
commit
64e7833cbc
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user