arch: add Kconfig for stack growth direction

This was previously just a #define in one header file, but we need
this expressed in Kconfig space in case some feature only works
properly with downward-growing stacks.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2018-03-06 13:17:57 -08:00 committed by Andrew Boie
commit a967915e52
2 changed files with 8 additions and 1 deletions

View file

@ -88,6 +88,13 @@ config PRIVILEGED_STACK_SIZE
this region will be inaccessible from user mode. During system calls, this region will be inaccessible from user mode. During system calls,
this region will be utilized by the system call. this region will be utilized by the system call.
config STACK_GROWS_UP
bool "Stack grows towards higher memory addresses"
default n
help
Select this option if the architecture has upward growing thread
stacks. This is not common.
config MAX_THREAD_BYTES config MAX_THREAD_BYTES
int "Bytes to use when tracking object thread permissions" int "Bytes to use when tracking object thread permissions"
default 2 default 2

View file

@ -33,7 +33,7 @@ static inline size_t stack_unused_space_get(const char *stack, size_t size)
* (or configurable direction) is added this check should be confirmed * (or configurable direction) is added this check should be confirmed
* that correct Kconfig option is used. * that correct Kconfig option is used.
*/ */
#if defined(STACK_GROWS_UP) #if defined(CONFIG_STACK_GROWS_UP)
for (i = size - 1; i >= 0; i--) { for (i = size - 1; i >= 0; i--) {
if ((unsigned char)stack[i] == 0xaa) { if ((unsigned char)stack[i] == 0xaa) {
unused++; unused++;