From 3a646426aa421ab3e229ec483d8b29f2f56c29ac Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 19 Jul 2018 12:53:34 +0200 Subject: score: Add _CPU_Instruction_illegal() On some architectures/simulators it is difficult to provoke an exception with misaligned or illegal data loads. Use an illegal instruction instead. Update #3433. --- testsuites/sptests/spfatal26/init.c | 40 ++++++------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) (limited to 'testsuites') diff --git a/testsuites/sptests/spfatal26/init.c b/testsuites/sptests/spfatal26/init.c index 1848659d6a..a77c62a841 100644 --- a/testsuites/sptests/spfatal26/init.c +++ b/testsuites/sptests/spfatal26/init.c @@ -1,8 +1,8 @@ /* - * Copyright (c) 2012 embedded brains GmbH. All rights reserved. + * Copyright (c) 2012, 2018 embedded brains GmbH. All rights reserved. * * embedded brains GmbH - * Obere Lagerstr. 30 + * Dornierstr. 4 * 82178 Puchheim * Germany * @@ -16,45 +16,17 @@ #include "config.h" #endif -#include "tmacros.h" - -#include - #include +#include -const char rtems_test_name[] = "SPFATAL 26"; - -static void provoke_aligment_or_data_access_exception( void ) -{ - uintptr_t one = 1; - int i = sizeof(void *) * CHAR_BIT; - uintptr_t n = 1; - uintptr_t base = 0; - uintptr_t inc; - - *(volatile uint64_t *) base; - - do { - int j; +#include - --i; - base = one << i; - inc = base << 1; - - for (j = 0; j < n; ++j, base += inc) { - *(volatile uint64_t *) base; - } - - n <<= 1; - } while (i > 0); -} +const char rtems_test_name[] = "SPFATAL 26"; static void Init( rtems_task_argument arg ) { TEST_BEGIN(); - - provoke_aligment_or_data_access_exception(); - + _CPU_Instruction_illegal(); rtems_test_assert( 0 ); } -- cgit v1.2.3