Xiang Xiao
8543df7e4c
sched/init: Initialize the idle thread local storage by tls_init_info
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-06-08 19:07:33 +09:00
Ville Juven
4c1b66246d
env_dup: Fix copying of env between address environments
...
If address environments are in use, it is not possible to simply
memcpy from from one process to another. The current implementation
of env_dup does precisely this and thus, it fails at once when it is
attempted between two user processes.
The solution is to use the kernel's heap as an intermediate buffer.
This is a simple, effective and common way to do a fork().
Obviously this is not needed for kernel processes.
2022-04-21 18:38:37 +08:00
chao.an
a594a5d7a8
sched/init: drivers_initialize() should be late than up_initialize()
...
up_initialize
|
->up_serialinit
|
->uart_register /* ("/dev/console", &CONSOLE_DEV); */
drivers_initialize
|
->syslog_console_init
|
->register_driver /* ("/dev/console", &g_consoleops, 0666, NULL); */
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-12 07:51:34 +09:00
Ville Juven
75afe491ad
RISC-V: Prepare for CONFIG_BUILD_KERNEL
...
- Thread context prior to system call needs to be preserved
- Allocate a kernel heap
2022-03-18 18:20:12 +08:00
Ville Juven
50578dc501
Fix the initial idle tasks environment
...
- User mode allocator was used for setting up the environment. This
works in flat mode and probably in protected mode as well, as there
is always a a single user allocator present
- This does not work in kernel mode, where each user task has its own
heap allocator. Also, when the idle tasks environment is being set,
no allocator is ready and the system crashes at once.
Fix this by using the group allocators instead:
- Idle task is a kernel task, so its group is privileged
- Add group_realloc
- Use the group_malloc/realloc functions instead of kumm_malloc
2022-03-16 20:21:19 +08:00
Xiang Xiao
c96c96a399
drivers: Merge the common driver initialization into one place
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-13 11:24:48 -03:00
Xiang Xiao
4cc28882f9
sched/init: Don't call sq_init/dq_init on global link list
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 15:06:39 -03:00
Xiang Xiao
ab872b0199
sched/init: Move binfmt_initialize before hardware initialization
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 15:06:39 -03:00
Xiang Xiao
b0786606fc
sched/wdog: Remove wd_initialize which isn't really used anymore
...
since g_wdactivelist is already set to zero by the boot code
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 15:06:39 -03:00
Xiang Xiao
cf2538c277
mm/shm: Initialize shm_info_s at the definition place
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 15:06:39 -03:00
Xiang Xiao
8fa26944f7
sched/init: Fix the compiler warning
...
/github/workspace/sources/nuttx/include/nuttx/init.h: In function 'nx_start':
Error: init/nx_start.c:439:7: error: 'strncpy' output truncated copying 8 bytes from a string of length 9 [-Werror=stringop-truncation]
439 | strncpy(g_idletcb[i].cmn.name, g_idlename, CONFIG_TASK_NAME_SIZE);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-10 19:46:01 +02:00
Xiang Xiao
a50d87d5b7
sched/group: Simplify the allocation and deallocation logic
...
1.Move tg_membe allocation to group_alloc
2.Merge group_deallocate to group_release
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-03-04 12:11:24 +09:00
ligd
fe6aa4a874
sim: add loop thread to handle dev loops
...
For some dev loops will call sem_wait/sem_trywait
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-02 20:29:52 +09:00
ligd
61a0453e6e
os init_state: add new state OSINIT_IDLELOOP
...
This is for distinguish we are in init idle or idle loop.
Use for assertion for sem_trywait & sem_wait
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-02-23 22:05:37 +09:00
Masayuki Ishikawa
fccdcf7011
Revert "os init_state: add new state OSINIT_IDLELOOP"
...
This reverts commit 051bb32010
.
2022-02-22 10:56:14 +01:00
ligd
051bb32010
os init_state: add new state OSINIT_IDLELOOP
...
This is for distinguish we are in init idle or idle loop.
Use for assertion for sem_trywait & sem_wait
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-02-22 07:58:55 +01:00
ligd
d8c2610157
idle: remove heap & stack check in idle thread
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-01-29 00:53:47 +08:00
Xiang Xiao
77792a1598
sched: Define CONFIG_SMP_NCPUS to 1 in no SMP case
...
to simplify the SMP related code logic
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-20 23:21:21 +08:00
Petro Karashchenko
08043fb5bc
net: unify FAR keyword usage for all net buffer memory mapped buffers
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-20 01:42:56 +08:00
ligd
0bb32f27c0
init: use exec_spawn instead of exec
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-24 08:23:30 -06:00
ligd
10ccba6671
init: move USERMAIN_XX out of INIT_ENTRYPOINT
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-24 08:23:30 -06:00
raiden00pl
e2c9f612c9
sched/init/nx_start.c: fix compile break when CONIFG_TASK_NAME_SIZE=0
2021-12-17 10:29:00 +01:00
Xiang Xiao
1af8cd4de8
sched: Move argv from tcb_s to task_info_s
...
argv is allocated from stack and then belong to userspace,
so task_info_s is a best location to hold this information.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-11 10:08:53 -06:00
Huang Qi
58e0781e2e
arch/arm: Implement TLS support
...
Signed-off-by: Huang Qi <no1wudi@qq.com>
2021-12-07 23:31:41 -06:00
Xiang Xiao
aec01e96fa
libc: Remove the empty lib_initialize
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-01 11:03:02 -03:00
Xiang Xiao
8b67944c75
sched: Remove pidhash_s and move ticks to tcb_s
...
simplify the code logic and reduce memory a little bit
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-10-16 06:19:17 -03:00
Xiang Xiao
5025fbef8d
Rename LIB_ to LIBC_ for all libc Kconfig
...
follow other libc component naming convention
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-05 19:45:24 +02:00
Xiang Xiao
a5ac4463c2
sched/init: initialize all idle thread's tl_task
...
since this patch forget to initialize the idle tls info:
commit 50c08bf45b
Author: Huang Qi <huangqi3@xiaomi.com>
Date: Tue Jun 29 16:01:02 2021 +0800
libc: Move pthread_key_destructor to task_info_s
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: If7d0c0118323fa3dcf44081d675cd57b14eba75a
2021-07-16 08:37:53 +09:00
Xiang Xiao
bd74dc2b88
sched/init: Remove the unnessary CONFIG_SMP check
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I2afaf310b411993e37140b3d7977968a7fda5c3b
2021-07-16 08:37:53 +09:00
Jiuzhu Dong
9b1f554429
sched: Dynamically extend the pid hash table
...
Change-Id: I3a719bc575cd408cd530a39efa203f507b44fa9c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-11 19:42:30 -07:00
Jiuzhu Dong
bb867a38fc
nx_start: Simplify and unify the partial initialization process
...
for both SMP and non-SMP
Change-Id: I0fea8b4f59fc27d253a2ef9b7503acbb7410cc14
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-11 19:42:30 -07:00
ligd
8d2615f78d
sched: add STACK_USAGE_SAFE_PERCENT for stack overflow check
...
Change-Id: Ia70e243b36401e28c31fcd7e1b480b79374c27ef
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-03 12:56:40 -05:00
ligd
940c80f7b3
sched: fix stack check crash in idle thread
...
Change-Id: Iea7c096ffcab181f318edcc1bfe1717785831b7a
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-03 12:56:40 -05:00
ligd
68d66148ad
mm: idle check heap use mm_trysemaphore
...
Change-Id: I92e1df572fa6cd801b10e5b06e7b04d450b3e3fb
Signed-off-by: ligd <liguiding1@xiaomi.com>
(cherry picked from commit bc9a5d1ca9656f6effd3a419cc2488586dfb1489)
2021-07-03 12:56:40 -05:00
ligd
646b229f74
sched/init/nx_start.c: enter_critical_section when check heap & stack in idle
...
Change-Id: I2ef95ee8e1dc1ba3e74c1d6c8c6af20f53be85c7
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-03 12:56:40 -05:00
Jiuzhu Dong
198b85d233
sched/idle: disable sched when idle call nx_bringup
...
Because idle task will call mm_malloc to create some task
and will take sem of mm. But if smp enable, the sem of mm may be
taken by other cpu, so idle may be block because take this sem and crash.
Change-Id: I22f0233ef6c59a1b81607d4389e68f8646c89395
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-02 04:51:15 -05:00
Abdelatif Guettouche
0a4982a80e
Introduce ARCH_HAVE_EXTRA_HEAPS, this config is going to be used for
...
chips that have multiple separate heaps.
For now it's used to enable APIs to initialize the different heaps
during the start sequence but can be extended for other purposes that
manage those heaps.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-06-26 09:52:43 -05:00
Abdelatif Guettouche
af5e0c620f
Rename MODULE_TEXT to TEXT_HEAP as the latter is more generic.
...
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-06-18 07:14:17 -05:00
chao.an
6e6eecaa73
arch: adjust idle stack offset to reserve space of stack info
...
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-09 13:30:13 -05:00
Xiang Xiao
2e54df0f35
Don't include assert.h from public header file
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-03 08:36:03 -07:00
Masayuki Ishikawa
1a9e7efde5
smp: Remove CONFIG_SMP_IDLETHREAD_STACKSIZE
...
Summary:
- The CONFIG_SMP_IDLETHREAD_STACKSIZE was introduced to optimize
the idle stack size for other than CPU0
- However, there are no big differences between the idle stacks.
- This commit removes the config to simplify the kernel code
Impact:
- All SMP configurations
Testing:
- Tested with ostest with the following configs
- spresense:smp, spresense:rndis_smp
- esp32-devkitc:smp (QEMU), maix-bit:smp (QEMU)
- sabre-6quad:smp (QEMU), sabre-6quad:netnsh_smp (QEMU)
- raspberrypi-pico:smp, sim:smp (x86_64)
Signed-off-by: Masayuki Ishikawa <asayuki.Ishikawa@jp.sony.com>
2021-04-19 21:46:39 -05:00
Xiang Xiao
e14c458747
mm/heap: Move semaphore related declaration to private header
...
since other subsystem doesn't need call these function anymore
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idfb217c412db62d9f17f427310b75bb78785dc50
2021-03-22 15:35:32 +01:00
ligd
1d66d5c297
debug tools: add heap & stack check in idle thread
...
N/A
Change-Id: Iba6f5cdffb1336697096c71fca86c9ece584225f
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-03-04 18:38:05 -08:00
Xiang Xiao
8d0fd4038b
Remove the empty xxx_initialize functions
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I63cb6b37f78e910663724659e11f53e3335d419f
2021-03-03 08:21:04 +00:00
Xiang Xiao
9473434587
Ensure the kernel component don't call userspace API
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-03-01 09:23:09 +09:00
Alin Jerpelea
8935ac4cc3
sched: Author Gregory Nutt: update licenses to Apache
...
Gregory Nutt has submitted the SGA and we can mograte the licenses
to Apache.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-09 01:21:53 -08:00
chao.an
f6cd23e9d2
sched/init: init the default home directory to environment
...
Change-Id: Ib08a7702ce2256d48b210a70fa181591bbe8abe8
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 23:42:46 -08:00
Yoshinori Sugino
c13f869432
Modify SIGSTP to SIGTSTP
...
Follow the POSIX description.
SIGTSTP should be sent when the Ctrl-Z characters is encountered, not SIGSTP.
Testing:
Built with hifive1-revb:nsh (CONFIG_SERIAL_TERMIOS=y, CONFIG_SIG_DEFAULT=y and CONFIG_TTY_SIGTSTP=y)
2020-10-29 01:12:43 -07:00
Xiang Xiao
18c19c1198
init: Move file system initialization before clock/irq
...
since these subsystem may register the driver under /dev
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-17 15:51:03 +09:00
Xiang Xiao
d43bf7717e
sched: Support config the argument passed to init
...
it is useful to pass the nonempty argument to change the init task behaviour
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I684e9c76b9eac54404d0e4e63ab78e51e039c9a8
2020-08-17 12:52:28 -06:00