diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-07-19 12:53:34 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-07-23 14:14:04 +0200 |
commit | 3a646426aa421ab3e229ec483d8b29f2f56c29ac (patch) | |
tree | dcd723d79a9c5670ef553d01d7e572f93c4e616f /testsuites | |
parent | score: Add _CPU_Instruction_no_operation() (diff) | |
download | rtems-3a646426aa421ab3e229ec483d8b29f2f56c29ac.tar.bz2 |
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.
Diffstat (limited to '')
-rw-r--r-- | testsuites/sptests/spfatal26/init.c | 40 |
1 files changed, 6 insertions, 34 deletions
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 * <rtems@embedded-brains.de> @@ -16,45 +16,17 @@ #include "config.h" #endif -#include "tmacros.h" - -#include <limits.h> - #include <rtems.h> +#include <rtems/score/cpuimpl.h> -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 <tmacros.h> - --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 ); } |