kernel: delete separate logic for priv stacks
This never needed to be put in a separate gperf table. Privilege mode stacks can be generated by the main gen_kobject_list.py logic, which we do here. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
ae8acffaa6
commit
28be793cb6
21 changed files with 124 additions and 474 deletions
|
@ -156,7 +156,6 @@ SECTIONS
|
|||
{
|
||||
_image_text_start = .;
|
||||
|
||||
#include <linker/priv_stacks-text.ld>
|
||||
#include <linker/kobject-text.ld>
|
||||
|
||||
*(.text)
|
||||
|
@ -221,7 +220,6 @@ SECTIONS
|
|||
#include <custom-rodata.ld>
|
||||
#endif
|
||||
|
||||
#include <linker/priv_stacks-rom.ld>
|
||||
#include <linker/kobject-rom.ld>
|
||||
|
||||
/*
|
||||
|
@ -373,10 +371,8 @@ SECTIONS
|
|||
__data_rom_start = LOADADDR(_DATA_SECTION_NAME);
|
||||
|
||||
#include <linker/common-ram.ld>
|
||||
#include <linker/priv_stacks.ld>
|
||||
#include <linker/kobject.ld>
|
||||
|
||||
#include <linker/priv_stacks-noinit.ld>
|
||||
#include <linker/cplusplus-ram.ld>
|
||||
|
||||
__data_ram_end = .;
|
||||
|
|
|
@ -143,7 +143,6 @@ SECTIONS
|
|||
*/
|
||||
*(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
|
||||
|
||||
#include <linker/priv_stacks-text.ld>
|
||||
#include <linker/kobject-text.ld>
|
||||
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
@ -198,7 +197,6 @@ SECTIONS
|
|||
#include <custom-rodata.ld>
|
||||
#endif
|
||||
|
||||
#include <linker/priv_stacks-rom.ld>
|
||||
#include <linker/kobject-rom.ld>
|
||||
|
||||
/*
|
||||
|
@ -333,11 +331,7 @@ SECTIONS
|
|||
__data_rom_start = LOADADDR(_DATA_SECTION_NAME);
|
||||
|
||||
#include <linker/common-ram.ld>
|
||||
#include <linker/priv_stacks.ld>
|
||||
#include <linker/kobject.ld>
|
||||
|
||||
#include <linker/priv_stacks-noinit.ld>
|
||||
|
||||
#include <linker/cplusplus-ram.ld>
|
||||
|
||||
__data_ram_end = .;
|
||||
|
|
|
@ -132,7 +132,6 @@ SECTIONS
|
|||
*/
|
||||
*(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
|
||||
|
||||
#include <linker/priv_stacks-text.ld>
|
||||
#include <linker/kobject-text.ld>
|
||||
|
||||
MMU_ALIGN;
|
||||
|
@ -194,7 +193,6 @@ SECTIONS
|
|||
#include <custom-rodata.ld>
|
||||
#endif
|
||||
|
||||
#include <linker/priv_stacks-rom.ld>
|
||||
#include <linker/kobject-rom.ld>
|
||||
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
@ -319,11 +317,7 @@ SECTIONS
|
|||
__data_rom_start = LOADADDR(_DATA_SECTION_NAME);
|
||||
|
||||
#include <linker/common-ram.ld>
|
||||
#include <linker/priv_stacks.ld>
|
||||
#include <linker/kobject.ld>
|
||||
|
||||
#include <linker/priv_stacks-noinit.ld>
|
||||
|
||||
#include <linker/cplusplus-ram.ld>
|
||||
|
||||
__data_ram_end = .;
|
||||
|
|
|
@ -166,6 +166,17 @@ enum k_objects {
|
|||
*/
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
#ifdef CONFIG_GEN_PRIV_STACKS
|
||||
/* Metadata struct for K_OBJ_THREAD_STACK_ELEMENT */
|
||||
struct z_stack_data {
|
||||
/* Size of the entire stack object, including reserved areas */
|
||||
size_t size;
|
||||
|
||||
/* Stack buffer for privilege mode elevations */
|
||||
u8_t *priv;
|
||||
};
|
||||
#endif /* CONFIG_GEN_PRIV_STACKS */
|
||||
|
||||
/* Object extra data. Only some objects use this, determined by object type */
|
||||
union z_object_data {
|
||||
/* Backing mutex for K_OBJ_SYS_MUTEX */
|
||||
|
@ -174,8 +185,13 @@ union z_object_data {
|
|||
/* Numerical thread ID for K_OBJ_THREAD */
|
||||
unsigned int thread_id;
|
||||
|
||||
#ifdef CONFIG_GEN_PRIV_STACKS
|
||||
/* Metadata for K_OBJ_THREAD_STACK_ELEMENT */
|
||||
struct z_stack_data *stack_data;
|
||||
#else
|
||||
/* Stack buffer size for K_OBJ_THREAD_STACK_ELEMENT */
|
||||
size_t stack_size;
|
||||
#endif /* CONFIG_GEN_PRIV_STACKS */
|
||||
|
||||
/* Futex wait queue and spinlock for K_OBJ_FUTEX */
|
||||
struct z_futex_data *futex_data;
|
||||
|
|
|
@ -39,5 +39,13 @@
|
|||
*(".kobject_data.rodata*")
|
||||
#endif
|
||||
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
#ifdef CONFIG_GEN_PRIV_STACKS
|
||||
SECTION_DATA_PROLOGUE(priv_stacks_noinit,,)
|
||||
{
|
||||
z_priv_stacks_ram_start = .;
|
||||
*(".priv_stacks.noinit")
|
||||
z_priv_stacks_ram_end = .;
|
||||
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
|
||||
#endif /* CONFIG_GEN_PRIV_STACKS */
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017 Linaro Limited.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
SECTION_DATA_PROLOGUE(priv_stacks_noinit,,)
|
||||
{
|
||||
z_priv_stacks_ram_start = .;
|
||||
*(".priv_stacks.noinit")
|
||||
z_priv_stacks_ram_end = .;
|
||||
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017 Linaro Limited.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
/* Kept in RAM on non-XIP */
|
||||
#ifdef CONFIG_XIP
|
||||
*(".priv_stacks.rodata*")
|
||||
#endif
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017 Linaro Limited.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#ifdef CONFIG_USERSPACE
|
||||
/* We need to reserve room for the gperf generated hash functions.
|
||||
* Fortunately, unlike the data tables, the size of the code is
|
||||
* reasonably predictable.
|
||||
*/
|
||||
_priv_stacks_text_area_start = .;
|
||||
*(".priv_stacks.text*")
|
||||
_priv_stacks_text_area_end = .;
|
||||
|
||||
_priv_stacks_text_area_used = _priv_stacks_text_area_end - _priv_stacks_text_area_start;
|
||||
|
||||
#ifndef LINKER_PASS2
|
||||
PROVIDE(z_priv_stack_find = .);
|
||||
#endif
|
||||
|
||||
/* In a valid build the MAX function will always evaluate to the
|
||||
second argument below, but to give the user a good error message
|
||||
when the area overflows we need to temporarily corrupt the
|
||||
location counter, and then detect the overflow with an assertion
|
||||
later on. */
|
||||
|
||||
. = MAX(., _priv_stacks_text_area_start + CONFIG_PRIVILEGED_STACK_TEXT_AREA);
|
||||
|
||||
ASSERT(
|
||||
CONFIG_PRIVILEGED_STACK_TEXT_AREA >= _priv_stacks_text_area_used,
|
||||
"The configuration system has incorrectly set
|
||||
'CONFIG_PRIVILEGED_STACK_TEXT_AREA' to
|
||||
CONFIG_PRIVILEGED_STACK_TEXT_AREA, which is not big enough. You must
|
||||
through Kconfig either disable 'CONFIG_USERSPACE', or set
|
||||
'CONFIG_PRIVILEGED_STACK_TEXT_AREA' to a value larger than
|
||||
CONFIG_PRIVILEGED_STACK_TEXT_AREA."
|
||||
);
|
||||
#endif /* CONFIG_USERSPACE */
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017 Linaro Limited
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
/* Constraints:
|
||||
*
|
||||
* - changes to the size of this section between build phases
|
||||
* *must not* shift the memory address of any kernel objects,
|
||||
* since it contains a hashtable of the memory addresses of those
|
||||
* kernel objects
|
||||
*
|
||||
* - It is OK if this section itself is shifted in between builds; for
|
||||
* example some arches may precede this section with generated MMU
|
||||
* page tables which are also unpredictable in size.
|
||||
*
|
||||
* The size of the
|
||||
* gperf tables is both a function of the number of kernel objects,
|
||||
* *and* the specific memory addresses being hashed. It is not something
|
||||
* that can be predicted without actually building and compiling it.
|
||||
*/
|
||||
SECTION_DATA_PROLOGUE(priv_stacks,,)
|
||||
{
|
||||
*(".priv_stacks.data*")
|
||||
|
||||
/* This is also unpredictable in size, and has the same constraints.
|
||||
* On XIP systems this will get put at the very end of ROM.
|
||||
*/
|
||||
#ifndef CONFIG_XIP
|
||||
*(".priv_stacks.rodata*")
|
||||
#endif
|
||||
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue