Commit Graph

70 Commits

Author SHA1 Message Date
Xiang Xiao 14ecb8723a sched: Change tcb_s to task_tcb_s for nxtask_[un]init
since these functions can just work with task not thread

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-06-30 10:54:42 -06:00
chao.an b9ad4a000e binfmt/exec: allocate stack from internal
Implement of nxtask_init() support stack allocation from internal

Change-Id: I4885c5b901d90e57eb9d15d8bc1af32761584d19
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-30 08:26:38 +02:00
chao.an 2fc02ec4a4 sched/task_init: change the stack pointer type to (void *)
change the stack pointer type from (uint32_t *) to (void *)

Change-Id: I90bb7d6a9cb0184c133578a1a2ae9a19c233ad30
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-30 08:26:38 +02:00
Xiang Xiao a69678810d sched: Change the return type of nxtask_activate to void
to simplify the error handling logic

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I00fedd4d69620a7cc7b9f9e8bf4ba7f7989dc2b2
2020-06-04 22:20:45 +01:00
Gregory Nutt 82debdc213 Make task_init() and task_activate() internal OS functions.
-Move task_init() and task_activate() prototypes from include/sched.h to include/nuttx/sched.h.  These are internal OS functions and should not be exposed to the user.
-Remove references to task_init() and task_activate() from the User Manual.
-Rename task_init() to nxtask_init() since since it is an OS internal function
-Rename task_activate() to nxtask_activate since it is an OS internal function
2020-05-25 23:54:45 +01:00
Gregory Nutt a4218e2144 include/nuttx/sched.h: Make naming of all internal names consistent:
1. Add internal scheduler functions should begin with nxsched_, not sched_
2. Follow the consistent naming patter of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-09 14:19:08 -03:00
Xiang Xiao 5c748cea2a sched: Don't need call get_errno after task_activate
since task_activate don't save the error code into errno

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-03 12:15:54 -06:00
Xiang Xiao 3c84278aa7 sched: task_init as internal function shouldn't modify errno
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-03 12:15:54 -06:00
Gregory Nutt 44b8f3e467 include/nuttx/sched.h: Move prototype for sched_releasetcb()
Move the prototype for the internal OS from from sched/sched/sched.h to include/nuttx/sched.h.  This was done because binfmt/binfmt/excecmodule.c requires the prototype for sched_releasetcb() and was illegally including sched/sched/sched.h.  That is a blatant violation of the OS modular design and the person that did this should be hung up by their thumbs.  Oh... I did that back in a bad moment in 2014.  Now that is made right.
2020-03-26 14:12:34 -03:00
minabeoki 65ff48f7be fix typo berr messages in binfmt_execmodule.c 2020-01-26 07:03:30 -06:00
Gregory Nutt 9d5d60fee1 Run all .c and .h files in last PR49 through nxstyle. 2020-01-07 09:54:35 -06:00
Alin Jerpelea a8d63c0cec various fixes (#49)
* libs: libc: math: Fix tanh() math functions
* drivers: mtd: smart: Fix trivial debug message in smartfs
* binfmt: libelf: Fix fd not closed on error
* binfmt: Fix stack memory leak on error
* fs: romfs: Fix private data not free on error
* sched: group: Fix reference after free memory
* sched: clock: Fix clock sync

Fix clock sync when CONFIG_RTC_HIRES is enabled
2020-01-07 09:06:02 -06:00
Xiang Xiao 6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
Juha Niskanen e8b5dd4528 Fix use of undefined pp-token #errror, other typos. 2019-09-19 18:19:18 -06:00
Gregory Nutt bb623d1e04 This commit renames all internal OS functions defined under sched/task so that they begin with the prefix. For example, nxtask_exit() vs. task_exit().
Squashed commit of the following:

    Trivial, cosmetic
    sched/, arch/, and include:  Rename task_vforkstart() as nxtask_vforkstart()
    sched/, arch/, and include:  Rename task_vforkabort() as nxtask_vforkabort()
    sched/, arch/, and include:  Rename task_vforksetup() as nxtask_vfork_setup()
    sched/:  Rename notify_cancellation() as nxnotify_cancellation()
    sched/:  Rename task_recover() to nxtask_recover()
    sched/task, sched/pthread/, Documentation/:  Rename task_argsetup() and task_terminate() to nxtask_argsetup() and nxtask_terminate(), respectively.
    sched/task:  Rename task_schedsetup() to nxtask_schedsetup()
    sched/ (plus some binfmt/, include/, and arch/):  Rename task_start() and task_starthook() to nxtask_start() and nxtask_starthook().
    arch/ and sched/:  Rename task_exit() and task_exithook() to nxtask_exit() and nxtask_exithook(), respectively.
    sched/task:  Rename all internal, static, functions to begin with the nx prefix.
2019-02-04 13:42:51 -06:00
Gregory Nutt 78c8485b0d Fix some warnings found in build testing. 2019-01-27 17:23:01 -06:00
Xiang Xiao b7f958a02e binfmt/, binfmt/libelf: binfmt/elf: Call umm_initialize as soon as possible otherwise elf_loadctors/elf_loaddtors will fail to allocate memory. 2019-01-26 11:36:38 -06:00
Gregory Nutt 20a86dfc1b binfmt/ and sched/group: Re-architect the way that loadable ELF or NXFLAT modules are unloaded. Memory resources must be recovered when the task loaded into memory exits. The originmal implementatino used the death-of-child SIGCHLD signal to perform the unload. There are several problems with this: It is overly complex, it requires that the parent task stay resident while the loaded task runs, and it has fatal logic flaws in the protected and kernel model builds because the user signal handler attempts to run in the kernel address space. This commit corrects with using a mindlessly simply BINFMT callback when the task exits. 2018-08-05 08:09:54 -06:00
Gregory Nutt bc2cded397 Squashed commit of the following:
binfmt: Fix some compilation issues introduced in previous changes.  Verfied with the STM32F4-Discovery ELF configuration.

    binfmt:  schedule_unload() is an internal OS function and must not alter the errno variable.

    binfmt:  unload_module() is an internal OS function and must not alter the errno variable.

    binfmt:  load_module() is an internal OS function and must not alter the errno variable.

    binfmt:  exec_module() is an internal OS function and must not alter the errno variable.
2017-10-02 15:30:55 -06:00
Gregory Nutt 374f1bd46c binfmt: Don't schedule starthook if there are no constructors. 2017-10-02 14:04:50 -06:00
Gregory Nutt a1469a3e95 Add CONFIG_DEBUG_ERROR. Change names of *dbg() * *err() 2016-06-11 15:50:49 -06:00
Gregory Nutt 86b79b33cf Reserver the name 'err' for other purposes 2016-06-11 14:40:07 -06:00
Gregory Nutt 1cdc746726 Rename CONFIG_DEBUG to CONFIG_DEBUG_FEATURES 2016-06-11 14:14:08 -06:00
Gregory Nutt fc3540cffe Replace all occurrences of vdbg with vinfo 2016-06-11 11:59:51 -06:00
Gregory Nutt 4a7fb2cbc1 binfmt: Cosmetic -- rename binfmt_internal.h to binfmt.h. Move related argument copy logic into new file, binfmt_copyargv.c 2015-11-14 07:29:47 -06:00
Gregory Nutt 45eebacbb4 binfmt/: More spacing/alignment fixes 2015-10-08 19:20:17 -06:00
Gregory Nutt b33c2d9cef Move include/nuttx/mm.h to include/nuttx/mm/mm.h 2014-09-24 07:29:09 -06:00
Gregory Nutt 1863370672 Move include/nuttx/shm.h to include/nuttx/mm/shm.h 2014-09-24 07:05:02 -06:00
Gregory Nutt 2fa7431ee7 Move include/nuttx/gran.h to include/nuttx/mm/gran.h 2014-09-24 06:55:26 -06:00
Gregory Nutt 835c91b03a Add support for a per-process virtual page allocator. This is a new member of the task_group_s structure. The allocaor must be initialized when a new user process is started and uninitialize when the process group is finally destroyed. It is used by shmat() and shmdt() to pick the virtual address onto which to map the shared physical memory. 2014-09-23 16:04:39 -06:00
Gregory Nutt 398f7b594f execv() is a basic system interface. It should not be in libc/ but rather in sched/task. Its symboltable helper logic also belongs in the kernel but belings in binfmt/ with the other symbol table logic 2014-09-15 10:15:47 -06:00
Gregory Nutt 62880f60c4 In kernel mode, we have to duplicate the callers argv[] buffer when exec'ing new tasks. When the argv[] buffer is needed, the caller's address environment will not longer be in place 2014-09-14 14:10:23 -06:00
Gregory Nutt 2eb71d5a35 Fix an ordering problem in integration of kernel stack logic 2014-09-14 12:40:09 -06:00
Gregory Nutt 3649dab9bd Initial integration of kernel stack (does not work) 2014-09-14 11:19:34 -06:00
Gregory Nutt 0fc55d042f Misc fixes to repair some of the breakage to the SAMA5D4-EK elf configuration caused by changes for the knsh configuration 2014-09-11 10:31:12 -06:00
Gregory Nutt 205c23b9d6 Add logic to initialize the per-process user heap when each user process is started 2014-09-10 15:55:36 -06:00
Gregory Nutt df4682fd1f Add configuration to use the fixed DRAM mapping for the page pool (if available) instead of remapping dynamically to access L2 page tables and page data. Also, add logic in address environment creation to initialize the shared data at the beginning of the .bss/.data process memory region. 2014-09-10 08:41:01 -06:00
Gregory Nutt 76957599a2 When allocating a stack for a new process using the user-sapce allocator, need to select the address environment first 2014-09-09 17:32:32 -06:00
Gregory Nutt 23147c40a5 Remove final traces of the 8015 from the NuttX source tree 2014-09-01 13:21:15 -06:00
Gregory Nutt 205260d5e2 Reanem kzalloc to kmm_zalloc for consistency 2014-08-31 17:34:44 -06:00
Gregory Nutt 54fa3b0b59 Rename kfree to kmm_free for consistency with other naming conventions 2014-08-31 17:04:02 -06:00
Gregory Nutt 9aca0c1c84 Rename kumalloc to kumm_malloc and kuzalloc to kumm_zalloc for consistency with other naming 2014-08-31 16:24:24 -06:00
Gregory Nutt 9ad7dae4c1 Rename kufree to kumm_free for consistency with other naming 2014-08-31 16:15:11 -06:00
Gregory Nutt 89593969be nuttx/sched: Remove explicit references to errno. That is a problem from within the kernel for certain configurations 2014-08-28 17:00:43 -06:00
Gregory Nutt ad53cabf34 ADDRENV: Use a group flag to determine if there is an address environment (instead of the thread type) 2014-08-27 09:37:28 -06:00
Gregory Nutt b13d9b4161 Rename up_addrenv_assign() to up_addrenv_clone() and generalize its arguments so that can be used for other purposes 2014-08-26 12:16:05 -06:00
Gregory Nutt 241a7e17bd addrenv interface changes: up_addrenv_create() may need to create .text and .bss/.data separately because of differing access privileges (read/execute vs read/write). And, as a consequence, up_addrenv_vaddr() needs to be split into up_addrenv_vtext(0 and up_addrenv_vdata(). 2014-08-24 11:54:14 -06:00
Gregory Nutt 1624e2fbcf Change CONFIG_ADDRENV to CONFIG_ARCH_ADDRENV; change how it is selected -- the architecure must first declare support 2014-08-24 06:42:11 -06:00
Gregory Nutt e79d6e3c8b A few fixes for compilation errors due to recent address environment fixes 2014-08-22 15:55:00 -06:00
Gregory Nutt 1d586e6136 An address environment is the property of a task group, not of a thread 2014-08-22 12:32:34 -06:00