From 03e4d1e931cdd6582ccc92b3a4dc883b446b5647 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 29 Jun 2022 14:37:47 +0200 Subject: score: Add _CPU_Use_thread_local_storage() At some point during system initialization, the idle threads are created. Afterwards, the boot processor basically executes within the context of an idle thread with thread dispatching disabled. On some architectures, the thread-local storage area of the associated thread must be set in dedicated processor registers. Add the new CPU port function to do this: void _CPU_Use_thread_local_storage( const Context_Control *context ) Close #4672. --- testsuites/sptests/sptls01/init.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'testsuites/sptests') diff --git a/testsuites/sptests/sptls01/init.c b/testsuites/sptests/sptls01/init.c index 5b5d274d3c..efd0fb4c6c 100644 --- a/testsuites/sptests/sptls01/init.c +++ b/testsuites/sptests/sptls01/init.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-2-Clause */ /* - * Copyright (c) 2014 embedded brains GmbH. All rights reserved. + * Copyright (C) 2014, 2022 embedded brains GmbH * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,7 +29,8 @@ #include "config.h" #endif -#include +#include +#include #include "tmacros.h" @@ -45,7 +46,7 @@ static const volatile uint32_t read_only_small = 0x601dc0feUL; static void check_tls_item(uint32_t expected) { - printf("TLS item = %i\n", tls_item); + printk("TLS item = %i\n", tls_item); rtems_test_assert(tls_item == expected); } @@ -97,10 +98,15 @@ static void test(void) check_tls_item(5); } -static void Init(rtems_task_argument arg) +static void test_idle_during_system_init(void) { TEST_BEGIN(); + check_tls_item(123); +} + +static void Init(rtems_task_argument arg) +{ test(); TEST_END(); @@ -108,6 +114,12 @@ static void Init(rtems_task_argument arg) rtems_test_exit(0); } +RTEMS_SYSINIT_ITEM( + test_idle_during_system_init, + RTEMS_SYSINIT_IDLE_THREADS, + RTEMS_SYSINIT_ORDER_LAST +); + #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -- cgit v1.2.3