1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

100 Commits

Author SHA1 Message Date
Keith Packard
0ceb0804b0 core/thread: Fix up stack and TLS alignments
Make sure both the stack and TLS blocks are correctly aligned by
adjusting the TLS base address to the most strict alignment of the TLS
block and the stack.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-03-04 01:18:36 -08:00
2ba85c1bc8 core: add support for test_utils_print_stack_usage
- activate THREAD_CREATE_STACKTEST also if test_utils_print_stack_usage
  is used

- make thread_measure_stack_free() available unconditionally

- if DEVELHELP is active, call test_utils_print_stack_usage() on any
  thread exit

- if DEVELHELP is active, call test_utils_print_stack_usage() after main
  for the idle thread, if that is used
2022-03-29 21:49:35 +02:00
Marian Buschsieweke
9535447e6f
core/kernel_defines.h: drop ALIGN_OF()
Since we moved to C11 now for all platforms, using `alignof()` provided
by `<stdalign.h>` has become the better option.
2021-11-25 09:20:22 +01:00
Martine Lenders
f08989a3c8
core: make SCHED_TEST_STACK boolean and default to 1 with DEVELHELP 2021-11-05 09:27:00 +01:00
Karl Fessel
1dde0f42d4 core/sched: keep scheduler clist internal to sched
adds sched_runq_advance(prio)
used it in core/thread and
test malloc_thread_safety
2021-04-14 09:53:04 +02:00
Martine Lenders
9b40bb63c2
core: apply uncrustify patches 2021-02-02 22:21:14 +01:00
5321bcde89 core: thread: move thread_state_to_string() from ps.c 2020-11-25 14:35:00 +01:00
Bas Stottelaar
ff53307599 core/*: reorder ENABLE_DEBUG after last include 2020-10-23 00:41:18 +02:00
Marian Buschsieweke
e028f6bbe6
core/thread: thread_measure_stack_free() const arg
Add `const` to stack pointer passed to thread_measure_stack_free()
2020-09-25 14:30:33 +02:00
Marian Buschsieweke
59321065db
core/thread.c: Silence -Wcast-align flase positives
Verified that each warning generated by -Wcast-align is indeed a false positive
and used an (intermediate) cast to `uintptr_t` to silence the warnings.
2020-09-22 15:15:28 +02:00
Jim O'Brien
bd149e7db9 thread: Add THREAD_NAMES make flag
Separate thread names from DEVELHELP so thread names can be
enabled in non-development/debug builds when required/desired.
THREAD_NAMES will be enabled by default then DEVELHELP is set to 1.
2020-09-10 10:08:27 +02:00
Keith Packard
531050ada2 picolibc: Enable TLS support [v4]
Allocate and initialize a thread-local block for each thread at the
top of the stack.

Set the tls base when switching to a new thread.

Add tdata/tbss linker instructions to cortex_m and risc-v scripts.

Signed-off-by: Keith Packard <keithp@keithp.com>

---

v2:
	Squash fixes

v3:
	Replace tabs with spaces

v4:
	Add tbss to fe310 linker script
2020-08-24 08:26:16 -07:00
Marian Buschsieweke
57264c5059
core: Access internal vars via helper funcs
Replace accesses to `sched_active_thread`, `sched_active_pid`, and
`sched_threads` with `thread_get_active()`, `thread_get_active_pid()`, and
`thread_get_unchecked()` where sensible.
2020-08-06 16:47:33 +02:00
Marian Buschsieweke
315cdcdb5f
core/thread: Make thread_get inlineable 2020-08-05 10:51:16 +02:00
8efe5960aa core: uncrustify 2020-03-30 17:02:08 +02:00
JulianHolzwarth
ebe1bf1889 core/thread.c:thread_zombify always enables interrupts before yield 2020-02-05 18:00:13 +01:00
JulianHolzwarth
2655c97fd5 core/thread.c: new function for zombie state 2019-12-11 16:48:31 +01:00
JulianHolzwarth
fbf6a665e1 core/thread.c: change thread_getstatus return type
thread_status_t instead of int
2019-10-15 15:55:05 +02:00
JulianHolzwarth
1d16b3d5dc core/thread.c: thread_create fix priority type
Bugfix: changing type of priority to uint8_t to be consistent with struct _thread
2019-09-11 17:42:48 +02:00
87c72a8fe1 core/thread: unify thread_t variable naming
thread_t variables were named t, other_thread, cb. For consistency sake,
change all occurences to just "thread".
2019-05-11 11:39:32 +02:00
Marian Buschsieweke
4c3e92f183
core: Made thread state an enum
- Introduced enum type `thread_state_t` to replace preprocessor macros
- Moved thread states to `sched.h` for two reasons:
  a) Because of the interdependencies of `sched.h` and `thread.h` keeping it in
     `thread.h` would result in ugly code.
  b) Theses thread states are defined from the schedulers point of view, so it
     actually makes senses to have it defined there
2019-02-13 13:31:52 +01:00
e6a9a760a7 core/thread: add thread_getname() dummy available without DEVELHELP 2018-01-15 14:37:04 +01:00
Ian Martin
28a7ddc9a8 core: save the stack_start in the thread context for mpu_stack_guard 2016-10-24 12:36:15 -04:00
d86c141842 core, tests: adapt to changed clist function names 2016-07-18 16:20:40 +02:00
dc8f55df7e core: msg: use new list instead of priority_queue 2016-04-10 00:16:48 +02:00
58a12e5034 core: make messaging optional 2016-03-30 23:27:09 +02:00
f9f6adb48d core: clist: make singly linked 2016-03-30 00:27:49 +02:00
7c39134d5d core: introduce intrusive singly linked list 2016-03-29 21:50:17 +02:00
DipSwitch
0bb4748a94 core: Fix/refactor function naming in core/incude/irq.h 2016-03-20 16:47:34 +01:00
IldarValiev
4f5bea7d99 core: thread: Added stack size validation 2016-03-07 18:56:51 +05:00
IldarValiev
bad2b5c187 core: thread: Added validation of pid 2016-03-07 18:56:47 +05:00
2b010b5337 core: rename tcb_t -> thread_t, move into thread.h 2016-03-05 18:20:17 +01:00
9082273746 core: header cleanup 2016-02-28 22:46:28 +01:00
Hauke Petersen
cf53aeddd8 Merge pull request #4382 from haukepetersen/rm_core_flagsh
core: move thread flags from flags.h to thread.h
2015-12-08 11:36:43 +01:00
Hauke Petersen
22428f6cfb core: adapted to renamed THREAD_FLAGS 2015-12-07 22:09:46 +01:00
Oleg Hahm
a82835a72b core: mute compiler warning 2015-12-07 20:28:52 +01:00
Ian Martin
2579e64e9f core: fix stack test when SCHED_TEST_STACK=1 but DEVELHELP=0 2015-09-22 11:59:21 -04:00
085383bfae core: remove hwtimer, switch schedstatistics to xtimer 2015-09-16 10:58:51 +02:00
ximus
5f422a9d07 Fix write of thread stack end marker
Only the lower half of the stack end marker is being writtem
to the stack buffer end.
2015-06-12 16:02:40 -07:00
Joakim Gebart
13832d8e62 everything: Remove filename from @file Doxygen command 2015-05-22 07:34:41 +02:00
Ludwig Ortmann
0adba81d2e core/thread: use disableIRQ/restoreIRQ 2014-12-03 20:45:00 +01:00
feb550f17a Merge pull request #1885 from OlegHahm/thread_yield_higher_cleanup
core: thread_yield_higher cleanup
2014-10-30 23:22:27 +01:00
Oleg Hahm
9a61d8cf1c core: move optional tcb members to DEVELHELP 2014-10-30 16:37:10 +01:00
Oleg Hahm
93ac114bc3 core: move thread_yield*() to thread.[ch]
Although it might conceptionally rather belong to the scheduler, the
yield functions are prefixed with thread_ and thus, belong there.
2014-10-28 00:56:37 +01:00
Ludwig Ortmann
eceb656c49 core,sys: fix storage types for irq API usage
* should not have any effect as long as `unsigned` and `int` are compatible
* also fix two cosmetic `unsigned int` -> `unsigned` for consistency
2014-10-27 16:25:23 +01:00
Oleg Hahm
9b819c4dd6 Merge pull request #1836 from Kijewski/yield-less
core: introduce sched_yield(), yield less
2014-10-24 10:05:37 +02:00
René Kijewski
677d690e2b core: introduce thread_yield_higher(), yield less
Fixes #1708.

Currently involuntary preemption causes the current thread not only to
yield for a higher prioritized thread, but all other threads of its own
priority class, too.

This PR adds the function `thread_yield_higher()`, which will yield the
current thread in favor of higher prioritized functions, but not for
threads of its own priority class.

Boards now need to implement `thread_yield_higher()` instead of
`thread_yield()`, but `COREIF_NG` boards are not affected in any way.

`thread_yield()` retains its old meaning: yield for every thread that
has the same or a higher priority.

This PR does not touch the occurrences of `thread_yield()` in the periph
drivers, because the author of this PR did not look into the logic of
the various driver implementations.
2014-10-24 00:09:56 +02:00
Oleg Hahm
db8f3d2650 cpu: use typed function pointer for thread_arch_init 2014-10-23 18:26:21 +02:00
René Kijewski
862000b715 core: align stack on a 32bit boundary
Fixes #1267.
2014-10-17 18:22:37 +02:00
Ludwig Ortmann
2fe2a39602 core: refactor check for valid pid
move into header and remove redundant condition
2014-10-13 19:44:35 +02:00