Skip to content

Commit 660d147

Browse files
dcpleunggalak
authored andcommitted
kernel: init.c: tag source for boot/pinned sections
This adds the tags for functions and variables so they can be put into boot/pinned sections. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
1 parent 735fad2 commit 660d147

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

kernel/init.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,12 @@ K_THREAD_STACK_DEFINE(z_main_stack, CONFIG_MAIN_STACK_SIZE);
4545
struct k_thread z_main_thread;
4646

4747
#ifdef CONFIG_MULTITHREADING
48+
__pinned_bss
4849
struct k_thread z_idle_threads[CONFIG_MP_NUM_CPUS];
49-
static K_KERNEL_STACK_ARRAY_DEFINE(z_idle_stacks, CONFIG_MP_NUM_CPUS,
50-
CONFIG_IDLE_STACK_SIZE);
50+
51+
static K_KERNEL_PINNED_STACK_ARRAY_DEFINE(z_idle_stacks,
52+
CONFIG_MP_NUM_CPUS,
53+
CONFIG_IDLE_STACK_SIZE);
5154
#endif /* CONFIG_MULTITHREADING */
5255

5356
/*
@@ -58,8 +61,9 @@ static K_KERNEL_STACK_ARRAY_DEFINE(z_idle_stacks, CONFIG_MP_NUM_CPUS,
5861
* of this area is safe since interrupts are disabled until the kernel context
5962
* switches to the init thread.
6063
*/
61-
K_KERNEL_STACK_ARRAY_DEFINE(z_interrupt_stacks, CONFIG_MP_NUM_CPUS,
62-
CONFIG_ISR_STACK_SIZE);
64+
K_KERNEL_PINNED_STACK_ARRAY_DEFINE(z_interrupt_stacks,
65+
CONFIG_MP_NUM_CPUS,
66+
CONFIG_ISR_STACK_SIZE);
6367

6468
#ifdef CONFIG_SYS_CLOCK_EXISTS
6569
#define initialize_timeouts() do { \
@@ -87,6 +91,7 @@ extern void idle(void *unused1, void *unused2, void *unused3);
8791
*
8892
* @return N/A
8993
*/
94+
__boot_func
9095
void z_bss_zero(void)
9196
{
9297
(void)memset(__bss_start, 0, __bss_end - __bss_start);
@@ -155,7 +160,9 @@ extern volatile uintptr_t __stack_chk_guard;
155160

156161
/* LCOV_EXCL_STOP */
157162

163+
__pinned_bss
158164
bool z_sys_post_kernel;
165+
159166
extern void boot_banner(void);
160167

161168
/**
@@ -167,6 +174,7 @@ extern void boot_banner(void);
167174
*
168175
* @return N/A
169176
*/
177+
__boot_func
170178
static void bg_thread_main(void *unused1, void *unused2, void *unused3)
171179
{
172180
ARG_UNUSED(unused1);
@@ -235,6 +243,7 @@ void __weak main(void)
235243
/* LCOV_EXCL_STOP */
236244

237245
#if defined(CONFIG_MULTITHREADING)
246+
__boot_func
238247
static void init_idle_thread(int i)
239248
{
240249
struct k_thread *thread = &z_idle_threads[i];
@@ -271,6 +280,7 @@ static void init_idle_thread(int i)
271280
*
272281
* @return initial stack pointer for the main thread
273282
*/
283+
__boot_func
274284
static char *prepare_multithreading(void)
275285
{
276286
char *stack_ptr;
@@ -312,6 +322,7 @@ static char *prepare_multithreading(void)
312322
return stack_ptr;
313323
}
314324

325+
__boot_func
315326
static FUNC_NORETURN void switch_to_main_thread(char *stack_ptr)
316327
{
317328
#ifdef CONFIG_ARCH_HAS_CUSTOM_SWAP_TO_MAIN
@@ -330,6 +341,7 @@ static FUNC_NORETURN void switch_to_main_thread(char *stack_ptr)
330341
#endif /* CONFIG_MULTITHREADING */
331342

332343
#if defined(CONFIG_ENTROPY_HAS_DRIVER) || defined(CONFIG_TEST_RANDOM_GENERATOR)
344+
__boot_func
333345
void z_early_boot_rand_get(uint8_t *buf, size_t length)
334346
{
335347
int n = sizeof(uint32_t);
@@ -398,6 +410,7 @@ void z_early_boot_rand_get(uint8_t *buf, size_t length)
398410
*
399411
* @return Does not return
400412
*/
413+
__boot_func
401414
FUNC_NORETURN void z_cstart(void)
402415
{
403416
/* gcov hook needed to get the coverage report.*/

0 commit comments

Comments
 (0)