zephyr/subsys
Andrew Boie 507852a4ad kernel: introduce opaque data type for stacks
Historically, stacks were just character buffers and could be treated
as such if the user wanted to look inside the stack data, and also
declared as an array of the desired stack size.

This is no longer the case. Certain architectures will create a memory
region much larger to account for MPU/MMU guard pages. Unfortunately,
the kernel interfaces treat both the declared stack, and the valid
stack buffer within it as the same char * data type, even though these
absolutely cannot be used interchangeably.

We introduce an opaque k_thread_stack_t which gets instantiated by
K_THREAD_STACK_DECLARE(), this is no longer treated by the compiler
as a character pointer, even though it really is.

To access the real stack buffer within, the result of
K_THREAD_STACK_BUFFER() can be used, which will return a char * type.

This should catch a bunch of programming mistakes at build time:

- Declaring a character array outside of K_THREAD_STACK_DECLARE() and
  passing it to K_THREAD_CREATE
- Directly examining the stack created by K_THREAD_STACK_DECLARE()
  which is not actually the memory desired and may trigger a CPU
  exception

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-01 16:43:15 -07:00
..
bluetooth Bluetooth: hci_ecc: Convert to new uECC API 2017-08-01 10:35:06 -04:00
console subsys: console: Fix signed vs unsigned char issues. 2017-05-22 08:43:31 -05:00
cpp subsystem: cleanup misc and make cpp a subsystem 2017-07-06 09:13:46 -05:00
debug kernel: remove gdb_server 2017-06-19 14:29:40 -04:00
disk license: add missing licenses and copyright 2017-06-08 10:41:56 -04:00
fs subsys: convert to using newly introduced integer sized types 2017-04-21 09:36:22 -05:00
logging kernel: event_logger: convert to using newly introduced integer sized types 2017-04-25 22:09:12 +00:00
net kernel: introduce opaque data type for stacks 2017-08-01 16:43:15 -07:00
shell shell: Adjust arguments when executing a command of different module 2017-06-09 18:54:27 -04:00
usb misc: use K_THREAD_STACK_DEFINE macros 2017-06-09 18:53:28 -04:00
Kconfig subsystem: cleanup misc and make cpp a subsystem 2017-07-06 09:13:46 -05:00
Makefile subsystem: cleanup misc and make cpp a subsystem 2017-07-06 09:13:46 -05:00