Changeset 3a646426 in rtems for testsuites


Ignore:
Timestamp:
07/19/18 10:53:34 (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
61c51db
Parents:
b74353e
git-author:
Sebastian Huber <sebastian.huber@…> (07/19/18 10:53:34)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/23/18 12:14:04)
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/spfatal26/init.c

    rb74353e r3a646426  
    11/*
    2  * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
     2 * Copyright (c) 2012, 2018 embedded brains GmbH.  All rights reserved.
    33 *
    44 *  embedded brains GmbH
    5  *  Obere Lagerstr. 30
     5 *  Dornierstr. 4
    66 *  82178 Puchheim
    77 *  Germany
     
    1717#endif
    1818
    19 #include "tmacros.h"
     19#include <rtems.h>
     20#include <rtems/score/cpuimpl.h>
    2021
    21 #include <limits.h>
    22 
    23 #include <rtems.h>
     22#include <tmacros.h>
    2423
    2524const char rtems_test_name[] = "SPFATAL 26";
    26 
    27 static void provoke_aligment_or_data_access_exception( void )
    28 {
    29   uintptr_t one = 1;
    30   int i = sizeof(void *) * CHAR_BIT;
    31   uintptr_t n = 1;
    32   uintptr_t base = 0;
    33   uintptr_t inc;
    34 
    35   *(volatile uint64_t *) base;
    36 
    37   do {
    38     int j;
    39 
    40     --i;
    41     base = one << i;
    42     inc = base << 1;
    43 
    44     for (j = 0; j < n; ++j, base += inc) {
    45       *(volatile uint64_t *) base;
    46     }
    47 
    48     n <<= 1;
    49   } while (i > 0);
    50 }
    5125
    5226static void Init( rtems_task_argument arg )
    5327{
    5428  TEST_BEGIN();
    55 
    56   provoke_aligment_or_data_access_exception();
    57 
     29  _CPU_Instruction_illegal();
    5830  rtems_test_assert( 0 );
    5931}
Note: See TracChangeset for help on using the changeset viewer.