linker: add bits for pinned regions

This adds the necessary bits for linker scripts and source code
to specify which symbols need to be pinned in memory. This is
needed for demand paging as some functions and data must reside
in memory all the time and cannot be paged out (e.g. paging,
scheduler, and interrupt routines for functionality).

This is up to the arch/SoC/board to define the sections in
their linker scripts as the pinned section may need special
alignment which cannot be done in common script snippets.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2021-02-23 13:33:38 -08:00 committed by Kumar Gala
commit 1310ad6b0e
8 changed files with 164 additions and 0 deletions

View file

@ -75,6 +75,14 @@
#define BOOT_NOINIT_SECTION_NAME boot_noinit
#endif
#if defined(CONFIG_LINKER_USE_PINNED_SECTION)
#define PINNED_TEXT_SECTION_NAME pinned_text
#define PINNED_BSS_SECTION_NAME pinned_bss
#define PINNED_RODATA_SECTION_NAME pinned_rodata
#define PINNED_DATA_SECTION_NAME pinned_data
#define PINNED_NOINIT_SECTION_NAME pinned_noinit
#endif
/* Short section references for use in ASM files */
#if defined(_ASMLANGUAGE)
/* Various text section names */
@ -100,6 +108,20 @@
#define BOOT_NOINIT NOINIT
#endif /* CONFIG_LINKER_USE_BOOT_SECTION */
#if defined(CONFIG_LINKER_USE_PINNED_SECTION)
#define PINNED_TEXT PINNED_TEXT_SECTION_NAME
#define PINNED_BSS PINNED_BSS_SECTION_NAME
#define PINNED_RODATA PINNED_RODATA_SECTION_NAME
#define PINNED_DATA PINNED_DATA_SECTION_NAME
#define PINNED_NOINIT PINNED_NOINIT_SECTION_NAME
#else
#define PINNED_TEXT TEXT
#define PINNED_BSS BSS
#define PINNED_RODATA RODATA
#define PINNED_DATA DATA
#define PINNED_NOINIT NOINIT
#endif /* CONFIG_LINKER_USE_PINNED_SECTION */
#endif /* _ASMLANGUAGE */
#include <linker/section_tags.h>