Changeset 3a646426 in rtems


Ignore:
Timestamp:
Jul 19, 2018, 10:53:34 AM (12 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
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.

Files:
20 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/cpu/arm/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    107107void _CPU_Context_validate( uintptr_t pattern );
    108108
     109RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     110{
     111  __asm__ volatile ( "udf" );
     112}
     113
    109114RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    110115{
  • cpukit/score/cpu/bfin/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    3838}
    3939
     40RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     41{
     42  __asm__ volatile ( ".word 0" );
     43}
     44
    4045RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    4146{
  • cpukit/score/cpu/epiphany/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    3838}
    3939
     40RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     41{
     42  __asm__ volatile ( ".word 0" );
     43}
     44
    4045RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    4146{
  • cpukit/score/cpu/i386/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    3838}
    3939
     40RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     41{
     42  __asm__ volatile ( ".word 0" );
     43}
     44
    4045RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    4146{
  • cpukit/score/cpu/lm32/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    3838}
    3939
     40RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     41{
     42  __asm__ volatile ( ".word 0" );
     43}
     44
    4045RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    4146{
  • cpukit/score/cpu/m32c/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    3838}
    3939
     40RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     41{
     42  __asm__ volatile ( ".word 0" );
     43}
     44
    4045RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    4146{
  • cpukit/score/cpu/m68k/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    3838}
    3939
     40RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     41{
     42  __asm__ volatile ( "illegal" );
     43}
     44
    4045RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    4146{
  • cpukit/score/cpu/mips/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    3838}
    3939
     40RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     41{
     42  __asm__ volatile ( ".word -1" );
     43}
     44
    4045RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    4146{
  • cpukit/score/cpu/moxie/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    3838}
    3939
     40RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     41{
     42  __asm__ volatile ( ".word 0" );
     43}
     44
    4045RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    4146{
  • cpukit/score/cpu/nios2/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    3030void _CPU_Context_validate( uintptr_t pattern );
    3131
     32RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     33{
     34  __asm__ volatile ( ".word 0" );
     35}
     36
    3237RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    3338{
  • cpukit/score/cpu/no_cpu/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    106106
    107107/**
     108 * @brief Emits an illegal instruction.
     109 *
     110 * This function is used only in test sptests/spfatal26.
     111 */
     112RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     113{
     114  __asm__ volatile ( ".word 0" );
     115}
     116
     117/**
    108118 * @brief Emits a no operation instruction (nop).
    109119 *
  • cpukit/score/cpu/or1k/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    3030void _CPU_Context_validate( uintptr_t pattern );
    3131
     32RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     33{
     34  __asm__ volatile ( ".word 0" );
     35}
     36
    3237RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    3338{
  • cpukit/score/cpu/powerpc/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    243243void _CPU_Context_validate( uintptr_t pattern );
    244244
     245RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     246{
     247  __asm__ volatile ( ".word 0" );
     248}
     249
    245250RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    246251{
  • cpukit/score/cpu/riscv/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    326326void _CPU_Context_validate( uintptr_t pattern );
    327327
     328RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     329{
     330  __asm__ volatile ( "unimp" );
     331}
     332
    328333RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    329334{
  • cpukit/score/cpu/sh/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    3838}
    3939
     40RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     41{
     42  __asm__ volatile ( ".word 0" );
     43}
     44
    4045RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    4146{
  • cpukit/score/cpu/sparc/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    151151void _CPU_Context_validate( uintptr_t pattern );
    152152
     153RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     154{
     155  __asm__ volatile ( "unimp" );
     156}
     157
    153158RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    154159{
  • cpukit/score/cpu/sparc64/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    3838}
    3939
     40RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     41{
     42  __asm__ volatile ( "unimp" );
     43}
     44
    4045RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    4146{
  • cpukit/score/cpu/v850/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    3838}
    3939
     40RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     41{
     42  __asm__ volatile ( ".word 0" );
     43}
     44
    4045RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
    4146{
  • cpukit/score/cpu/x86_64/include/rtems/score/cpuimpl.h

    rb74353e r3a646426  
    4848}
    4949
     50RTEMS_INLINE_ROUTINE void _CPU_Instruction_illegal( void )
     51{
     52  __asm__ volatile ( ".word 0" );
     53}
     54
    5055RTEMS_INLINE_ROUTINE void _CPU_Context_validate( uintptr_t pattern )
    5156{
  • 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.