[PATCH] sptests/spfatal26: Use an illegal instruction

Joel Sherrill joel at rtems.org
Thu Jul 19 15:03:00 UTC 2018


On Thu, Jul 19, 2018 at 8:49 AM, Gedare Bloom <gedare at rtems.org> wrote:

> For now we don't need to generalize this approach or make any kind of
> facility like this available outside of testing.
>
> (FYI: 0 is a "nop" on some architectures)
>
> Gedare
>
> On Thu, Jul 19, 2018 at 9:37 AM, Sebastian Huber
> <sebastian.huber at embedded-brains.de> wrote:
> > I thought about adding a _CPU_Illegal_instruction() function to
> > <rtems/score/cpu.h>. But, do you want such a toxic function in a header
> file
> > or librtemscpu.a? Now it is isolated in the test and can do no harm.
>

I have wondered if there enough architectural oddities like this in
the tests where a central place to address them would be helpful
when porting.

Where all do you have to check now when porting?


> >
> > On 19/07/18 15:35, Joel Sherrill wrote:
> >>
> >> This looks like a good approach. If 0 is a valid instruction on
> >> some architecture, we can add a conditional.
> >>
> >> On Thu, Jul 19, 2018 at 5:55 AM, Sebastian Huber
> >> <sebastian.huber at embedded-brains.de
> >> <mailto:sebastian.huber at embedded-brains.de>> wrote:
> >>
> >>     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 | 10 +++++++++-
> >>      1 file changed, 9 insertions(+), 1 deletion(-)
> >>
> >>     diff --git a/testsuites/sptests/spfatal26/init.c
> >>     b/testsuites/sptests/spfatal26/init.c
> >>     index 1848659d6a..7d635f3b84 100644
> >>     --- a/testsuites/sptests/spfatal26/init.c
> >>     +++ b/testsuites/sptests/spfatal26/init.c
> >>     @@ -1,5 +1,5 @@
> >>      /*
> >>     - * 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
> >>     @@ -24,6 +24,13 @@
> >>
> >>      const char rtems_test_name[] = "SPFATAL 26";
> >>
> >>     +static void provoke_illegal_instruction_exception( void )
> >>     +{
> >>     +#ifdef __riscv
> >>     +  __asm__ volatile (".word 0");
> >>     +#endif
> >>     +}
> >>     +
> >>      static void provoke_aligment_or_data_access_exception( void )
> >>      {
> >>        uintptr_t one = 1;
> >>     @@ -53,6 +60,7 @@ static void Init( rtems_task_argument arg )
> >>      {
> >>        TEST_BEGIN();
> >>
> >>     +  provoke_illegal_instruction_exception();
> >>        provoke_aligment_or_data_access_exception();
> >>
> >>        rtems_test_assert( 0 );
> >>     --     2.13.7
> >>
> >>     _______________________________________________
> >>     devel mailing list
> >>     devel at rtems.org <mailto:devel at rtems.org>
> >>     http://lists.rtems.org/mailman/listinfo/devel
> >>     <http://lists.rtems.org/mailman/listinfo/devel>
> >>
> >>
> >
> > --
> > Sebastian Huber, embedded brains GmbH
> >
> > Address : Dornierstr. 4, D-82178 Puchheim, Germany
> > Phone   : +49 89 189 47 41-16
> > Fax     : +49 89 189 47 41-09
> > E-Mail  : sebastian.huber at embedded-brains.de
> > PGP     : Public key available on request.
> >
> > Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
> >
> >
> > _______________________________________________
> > devel mailing list
> > devel at rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20180719/ff38b961/attachment-0002.html>


More information about the devel mailing list