From 7e02305018cc7dff2a9039c2bd9b35badd0c79f9 Mon Sep 17 00:00:00 2001 From: WeiY Date: Sat, 26 Jan 2013 00:01:17 +0800 Subject: tests: atomic support for RTEMS. SMP tests for atomic operations. --- testsuites/smptests/smpatomic01/Makefile.am | 22 +++++ testsuites/smptests/smpatomic01/init.c | 72 ++++++++++++++++ testsuites/smptests/smpatomic01/smpatomic01.doc | 23 ++++++ testsuites/smptests/smpatomic01/smpatomic01.scn | 28 +++++++ testsuites/smptests/smpatomic01/system.h | 50 ++++++++++++ testsuites/smptests/smpatomic01/tasks.c | 80 ++++++++++++++++++ testsuites/smptests/smpatomic02/Makefile.am | 22 +++++ testsuites/smptests/smpatomic02/init.c | 72 ++++++++++++++++ testsuites/smptests/smpatomic02/smpatomic02.doc | 23 ++++++ testsuites/smptests/smpatomic02/smpatomic02.scn | 28 +++++++ testsuites/smptests/smpatomic02/system.h | 50 ++++++++++++ testsuites/smptests/smpatomic02/tasks.c | 80 ++++++++++++++++++ testsuites/smptests/smpatomic03/Makefile.am | 22 +++++ testsuites/smptests/smpatomic03/init.c | 72 ++++++++++++++++ testsuites/smptests/smpatomic03/smpatomic03.doc | 23 ++++++ testsuites/smptests/smpatomic03/smpatomic03.scn | 29 +++++++ testsuites/smptests/smpatomic03/system.h | 50 ++++++++++++ testsuites/smptests/smpatomic03/tasks.c | 89 ++++++++++++++++++++ testsuites/smptests/smpatomic04/Makefile.am | 22 +++++ testsuites/smptests/smpatomic04/init.c | 72 ++++++++++++++++ testsuites/smptests/smpatomic04/smpatomic04.doc | 23 ++++++ testsuites/smptests/smpatomic04/smpatomic04.scn | 29 +++++++ testsuites/smptests/smpatomic04/system.h | 50 ++++++++++++ testsuites/smptests/smpatomic04/tasks.c | 89 ++++++++++++++++++++ testsuites/smptests/smpatomic05/Makefile.am | 22 +++++ testsuites/smptests/smpatomic05/init.c | 72 ++++++++++++++++ testsuites/smptests/smpatomic05/smpatomic05.doc | 23 ++++++ testsuites/smptests/smpatomic05/smpatomic05.scn | 29 +++++++ testsuites/smptests/smpatomic05/system.h | 50 ++++++++++++ testsuites/smptests/smpatomic05/tasks.c | 89 ++++++++++++++++++++ testsuites/smptests/smpatomic06/Makefile.am | 22 +++++ testsuites/smptests/smpatomic06/init.c | 72 ++++++++++++++++ testsuites/smptests/smpatomic06/smpatomic06.doc | 23 ++++++ testsuites/smptests/smpatomic06/smpatomic06.scn | 29 +++++++ testsuites/smptests/smpatomic06/system.h | 50 ++++++++++++ testsuites/smptests/smpatomic06/tasks.c | 89 ++++++++++++++++++++ testsuites/smptests/smpatomic07/Makefile.am | 22 +++++ testsuites/smptests/smpatomic07/init.c | 72 ++++++++++++++++ testsuites/smptests/smpatomic07/smpatomic07.doc | 24 ++++++ testsuites/smptests/smpatomic07/smpatomic07.scn | 29 +++++++ testsuites/smptests/smpatomic07/system.h | 50 ++++++++++++ testsuites/smptests/smpatomic07/tasks.c | 104 ++++++++++++++++++++++++ 42 files changed, 1991 insertions(+) create mode 100644 testsuites/smptests/smpatomic01/Makefile.am create mode 100644 testsuites/smptests/smpatomic01/init.c create mode 100644 testsuites/smptests/smpatomic01/smpatomic01.doc create mode 100644 testsuites/smptests/smpatomic01/smpatomic01.scn create mode 100644 testsuites/smptests/smpatomic01/system.h create mode 100644 testsuites/smptests/smpatomic01/tasks.c create mode 100644 testsuites/smptests/smpatomic02/Makefile.am create mode 100644 testsuites/smptests/smpatomic02/init.c create mode 100644 testsuites/smptests/smpatomic02/smpatomic02.doc create mode 100644 testsuites/smptests/smpatomic02/smpatomic02.scn create mode 100644 testsuites/smptests/smpatomic02/system.h create mode 100644 testsuites/smptests/smpatomic02/tasks.c create mode 100644 testsuites/smptests/smpatomic03/Makefile.am create mode 100644 testsuites/smptests/smpatomic03/init.c create mode 100644 testsuites/smptests/smpatomic03/smpatomic03.doc create mode 100644 testsuites/smptests/smpatomic03/smpatomic03.scn create mode 100644 testsuites/smptests/smpatomic03/system.h create mode 100644 testsuites/smptests/smpatomic03/tasks.c create mode 100644 testsuites/smptests/smpatomic04/Makefile.am create mode 100644 testsuites/smptests/smpatomic04/init.c create mode 100644 testsuites/smptests/smpatomic04/smpatomic04.doc create mode 100644 testsuites/smptests/smpatomic04/smpatomic04.scn create mode 100644 testsuites/smptests/smpatomic04/system.h create mode 100644 testsuites/smptests/smpatomic04/tasks.c create mode 100644 testsuites/smptests/smpatomic05/Makefile.am create mode 100644 testsuites/smptests/smpatomic05/init.c create mode 100644 testsuites/smptests/smpatomic05/smpatomic05.doc create mode 100644 testsuites/smptests/smpatomic05/smpatomic05.scn create mode 100644 testsuites/smptests/smpatomic05/system.h create mode 100644 testsuites/smptests/smpatomic05/tasks.c create mode 100644 testsuites/smptests/smpatomic06/Makefile.am create mode 100644 testsuites/smptests/smpatomic06/init.c create mode 100644 testsuites/smptests/smpatomic06/smpatomic06.doc create mode 100644 testsuites/smptests/smpatomic06/smpatomic06.scn create mode 100644 testsuites/smptests/smpatomic06/system.h create mode 100644 testsuites/smptests/smpatomic06/tasks.c create mode 100644 testsuites/smptests/smpatomic07/Makefile.am create mode 100644 testsuites/smptests/smpatomic07/init.c create mode 100644 testsuites/smptests/smpatomic07/smpatomic07.doc create mode 100644 testsuites/smptests/smpatomic07/smpatomic07.scn create mode 100644 testsuites/smptests/smpatomic07/system.h create mode 100644 testsuites/smptests/smpatomic07/tasks.c diff --git a/testsuites/smptests/smpatomic01/Makefile.am b/testsuites/smptests/smpatomic01/Makefile.am new file mode 100644 index 0000000000..c7af886f73 --- /dev/null +++ b/testsuites/smptests/smpatomic01/Makefile.am @@ -0,0 +1,22 @@ + +rtems_tests_PROGRAMS = smpatomic01 +smpatomic01_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c + +dist_rtems_tests_DATA = smpatomic01.scn +dist_rtems_tests_DATA += smpatomic01.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(smpatomic01_OBJECTS) +LINK_LIBS = $(smpatomic01_LDLIBS) + +smpatomic01$(EXEEXT): $(smpatomic01_OBJECTS) $(smpatomic01_DEPENDENCIES) + @rm -f smpatomic01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpatomic01/init.c b/testsuites/smptests/smpatomic01/init.c new file mode 100644 index 0000000000..7d7086066f --- /dev/null +++ b/testsuites/smptests/smpatomic01/init.c @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2012 Deng Hengyi. + * + * This test case is to test atomic load operation. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define CONFIGURE_INIT +#include "system.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + int i; + char ch; + rtems_id id; + rtems_status_code status; + bool allDone; + + /* XXX - Delay a bit to allow debug messages from + * startup to print. This may need to go away when + * debug messages go away. + */ + locked_print_initialize(); + + /* Put start of test message */ + locked_printf( "\n\n*** SMPatomic01 TEST ***\n" ); + + /* Initialize the TaskRan array */ + for ( i=0; i + +/* global variables */ + +/* + * Keep the names and IDs in global variables so another task can use them. + */ + +TEST_EXTERN volatile bool TaskRan[ CONFIGURE_SMP_MAXIMUM_PROCESSORS ]; + +/* + * Handy macros and static inline functions + */ + +/* end of include file */ diff --git a/testsuites/smptests/smpatomic01/tasks.c b/testsuites/smptests/smpatomic01/tasks.c new file mode 100644 index 0000000000..36bb431dca --- /dev/null +++ b/testsuites/smptests/smpatomic01/tasks.c @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2012 Deng Hengyi. + * + * This test case is to test atomic load operation. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "system.h" + +#include +#include + +#define TEST_REPEAT 200000 + +#define ATOMIC_LOAD_NO_BARRIER(NAME, TYPE, cpuid, mem_bar) \ +{ \ + Atomic_##TYPE t = (Atomic_##TYPE)-1, a = 0; \ + unsigned int i; \ + a = _Atomic_Load_##NAME(&t, mem_bar); \ + rtems_test_assert(a == t); \ + for (i = 0; i < TEST_REPEAT; i++){ \ + t = (Atomic_##TYPE)rand(); \ + a = _Atomic_Load_##NAME(&t, mem_bar); \ + rtems_test_assert(a == t); \ + } \ + locked_printf("\nCPU%d _Atomic_Load_" #NAME ": SUCCESS\n", cpuid); \ +} + +rtems_task Test_task( + rtems_task_argument argument + ) +{ + int cpu_num; + char name[5]; + char *p; + + /* Get the task name */ + p = rtems_object_get_name( RTEMS_SELF, 5, name ); + rtems_test_assert( p != NULL ); + + /* Get the CPU Number */ + cpu_num = bsp_smp_processor_id(); + + /* Print that the task is up and running. */ + /* test relaxed barrier */ + ATOMIC_LOAD_NO_BARRIER(int, Int, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_LOAD_NO_BARRIER(long, Long, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_LOAD_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_LOAD_NO_BARRIER(32, Int32, cpu_num, ATOMIC_RELAXED_BARRIER); + + /* test acquire barrier */ + ATOMIC_LOAD_NO_BARRIER(int, Int, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_LOAD_NO_BARRIER(long, Long, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_LOAD_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_LOAD_NO_BARRIER(32, Int32, cpu_num, ATOMIC_ACQUIRE_BARRIER); + +// ATOMIC_LOAD_NO_BARRIER(64, cpu_num); + + /* Set the flag that the task is up and running */ + TaskRan[cpu_num] = true; + + /* Drop into a loop which will keep this task on + * running on the cpu. + */ + while(1); +} diff --git a/testsuites/smptests/smpatomic02/Makefile.am b/testsuites/smptests/smpatomic02/Makefile.am new file mode 100644 index 0000000000..a7d9cbf073 --- /dev/null +++ b/testsuites/smptests/smpatomic02/Makefile.am @@ -0,0 +1,22 @@ + +rtems_tests_PROGRAMS = smpatomic02 +smpatomic02_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c + +dist_rtems_tests_DATA = smpatomic02.scn +dist_rtems_tests_DATA += smpatomic02.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(smpatomic02_OBJECTS) +LINK_LIBS = $(smpatomic02_LDLIBS) + +smpatomic02$(EXEEXT): $(smpatomic02_OBJECTS) $(smpatomic02_DEPENDENCIES) + @rm -f smpatomic01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpatomic02/init.c b/testsuites/smptests/smpatomic02/init.c new file mode 100644 index 0000000000..75d0ea00f9 --- /dev/null +++ b/testsuites/smptests/smpatomic02/init.c @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2012 Deng Hengyi. + * + * This test case is to test atomic store operation. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define CONFIGURE_INIT +#include "system.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + int i; + char ch; + rtems_id id; + rtems_status_code status; + bool allDone; + + /* XXX - Delay a bit to allow debug messages from + * startup to print. This may need to go away when + * debug messages go away. + */ + locked_print_initialize(); + + /* Put start of test message */ + locked_printf( "\n\n*** SMPatomic02 TEST ***\n" ); + + /* Initialize the TaskRan array */ + for ( i=0; i + +/* global variables */ + +/* + * Keep the names and IDs in global variables so another task can use them. + */ + +TEST_EXTERN volatile bool TaskRan[ CONFIGURE_SMP_MAXIMUM_PROCESSORS ]; + +/* + * Handy macros and static inline functions + */ + +/* end of include file */ diff --git a/testsuites/smptests/smpatomic02/tasks.c b/testsuites/smptests/smpatomic02/tasks.c new file mode 100644 index 0000000000..a85f58cd1e --- /dev/null +++ b/testsuites/smptests/smpatomic02/tasks.c @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2012 Deng Hengyi. + * + * This test case is to test atomic store operation. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "system.h" + +#include +#include + +#define TEST_REPEAT 200000 + +#define ATOMIC_STORE_NO_BARRIER(NAME, TYPE, cpuid, mem_bar) \ +{ \ + Atomic_##TYPE t = (Atomic_##TYPE)-1, a = 0; \ + unsigned int i; \ + _Atomic_Store_##NAME(&a, t, mem_bar); \ + rtems_test_assert(a == t); \ + for (i = 0; i < TEST_REPEAT; i++){ \ + t = (Atomic_##TYPE)rand(); \ + _Atomic_Store_##NAME(&a, t, mem_bar); \ + rtems_test_assert(a == t); \ + } \ + locked_printf("\nCPU%d _Atomic_Store_" #NAME ": SUCCESS\n", cpuid); \ +} + +rtems_task Test_task( + rtems_task_argument argument + ) +{ + int cpu_num; + char name[5]; + char *p; + + /* Get the task name */ + p = rtems_object_get_name( RTEMS_SELF, 5, name ); + rtems_test_assert( p != NULL ); + + /* Get the CPU Number */ + cpu_num = bsp_smp_processor_id(); + + /* Print that the task is up and running. */ + /* test relaxed barrier */ + ATOMIC_STORE_NO_BARRIER(int, Int, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_STORE_NO_BARRIER(long, Long, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_STORE_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_STORE_NO_BARRIER(32, Int32, cpu_num, ATOMIC_RELAXED_BARRIER); + + /* test release barrier */ + ATOMIC_STORE_NO_BARRIER(int, Int, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_STORE_NO_BARRIER(long, Long, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_STORE_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_STORE_NO_BARRIER(32, Int32, cpu_num, ATOMIC_RELEASE_BARRIER); + +// ATOMIC_STORE_NO_BARRIER(64, cpu_num); + + /* Set the flag that the task is up and running */ + TaskRan[cpu_num] = true; + + /* Drop into a loop which will keep this task on + * running on the cpu. + */ + while(1); +} diff --git a/testsuites/smptests/smpatomic03/Makefile.am b/testsuites/smptests/smpatomic03/Makefile.am new file mode 100644 index 0000000000..20fdf26232 --- /dev/null +++ b/testsuites/smptests/smpatomic03/Makefile.am @@ -0,0 +1,22 @@ + +rtems_tests_PROGRAMS = smpatomic03 +smpatomic03_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c + +dist_rtems_tests_DATA = smpatomic03.scn +dist_rtems_tests_DATA += smpatomic03.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(smpatomic03_OBJECTS) +LINK_LIBS = $(smpatomic03_LDLIBS) + +smpatomic03$(EXEEXT): $(smpatomic03_OBJECTS) $(smpatomic03_DEPENDENCIES) + @rm -f smpatomic03$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpatomic03/init.c b/testsuites/smptests/smpatomic03/init.c new file mode 100644 index 0000000000..5fe16f11e6 --- /dev/null +++ b/testsuites/smptests/smpatomic03/init.c @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2012 Deng Hengyi. + * + * This test case is to test atomic add operation. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define CONFIGURE_INIT +#include "system.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + int i; + char ch; + rtems_id id; + rtems_status_code status; + bool allDone; + + /* XXX - Delay a bit to allow debug messages from + * startup to print. This may need to go away when + * debug messages go away. + */ + locked_print_initialize(); + + /* Put start of test message */ + locked_printf( "\n\n*** SMPatomic03 TEST ***\n" ); + + /* Initialize the TaskRan array */ + for ( i=0; i + +/* global variables */ + +/* + * Keep the names and IDs in global variables so another task can use them. + */ + +TEST_EXTERN volatile bool TaskRan[ CONFIGURE_SMP_MAXIMUM_PROCESSORS ]; + +/* + * Handy macros and static inline functions + */ + +/* end of include file */ diff --git a/testsuites/smptests/smpatomic03/tasks.c b/testsuites/smptests/smpatomic03/tasks.c new file mode 100644 index 0000000000..fdf81ab1fc --- /dev/null +++ b/testsuites/smptests/smpatomic03/tasks.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2012 Deng Hengyi. + * + * This test case is to test atomic add operation. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "system.h" + +#include +#include + +#define TEST_REPEAT 200000 + +#define ATOMIC_FETCH_ADD_NO_BARRIER(NAME, TYPE, cpuid, mem_bar)\ +{ \ + Atomic_##TYPE t = 0, a = 0, b = 0; \ + unsigned int i; \ + for (i = 0; i < TEST_REPEAT; i++){ \ + a = (Atomic_##TYPE)(rand() % ((Atomic_##TYPE)-1 / 2)); \ + b = (Atomic_##TYPE)(rand() % ((Atomic_##TYPE)-1 / 2)); \ + t = a; \ + _Atomic_Fetch_add_##NAME(&t, b, mem_bar); \ + rtems_test_assert(t == (Atomic_##TYPE)(a + b)); \ + } \ + locked_printf("\nCPU%d _Atomic_Fetch_add_" #NAME ": SUCCESS\n", cpuid); \ +} + +rtems_task Test_task( + rtems_task_argument argument + ) +{ + int cpu_num; + char name[5]; + char *p; + + /* Get the task name */ + p = rtems_object_get_name( RTEMS_SELF, 5, name ); + rtems_test_assert( p != NULL ); + + /* Get the CPU Number */ + cpu_num = bsp_smp_processor_id(); + + /* Print that the task is up and running. */ + /* test relaxed barrier */ + ATOMIC_FETCH_ADD_NO_BARRIER(int, Int, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_FETCH_ADD_NO_BARRIER(long, Long, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_FETCH_ADD_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_FETCH_ADD_NO_BARRIER(32, Int32, cpu_num, ATOMIC_RELAXED_BARRIER); + + /* test acquire barrier */ + ATOMIC_FETCH_ADD_NO_BARRIER(int, Int, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_FETCH_ADD_NO_BARRIER(long, Long, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_FETCH_ADD_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_FETCH_ADD_NO_BARRIER(32, Int32, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + /* test release barrier */ + ATOMIC_FETCH_ADD_NO_BARRIER(int, Int, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_FETCH_ADD_NO_BARRIER(long, Long, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_FETCH_ADD_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_FETCH_ADD_NO_BARRIER(32, Int32, cpu_num, ATOMIC_RELEASE_BARRIER); + +// ATOMIC_FETCH_ADD_NO_BARRIER(64, cpu_num); + + /* Set the flag that the task is up and running */ + TaskRan[cpu_num] = true; + + /* Drop into a loop which will keep this task on + * running on the cpu. + */ + while(1); +} diff --git a/testsuites/smptests/smpatomic04/Makefile.am b/testsuites/smptests/smpatomic04/Makefile.am new file mode 100644 index 0000000000..288644d134 --- /dev/null +++ b/testsuites/smptests/smpatomic04/Makefile.am @@ -0,0 +1,22 @@ + +rtems_tests_PROGRAMS = smpatomic04 +smpatomic04_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c + +dist_rtems_tests_DATA = smpatomic04.scn +dist_rtems_tests_DATA += smpatomic04.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(smpatomic04_OBJECTS) +LINK_LIBS = $(smpatomic04_LDLIBS) + +smpatomic04$(EXEEXT): $(smpatomic04_OBJECTS) $(smpatomic04_DEPENDENCIES) + @rm -f smpatomic04$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpatomic04/init.c b/testsuites/smptests/smpatomic04/init.c new file mode 100644 index 0000000000..630e9a2e9e --- /dev/null +++ b/testsuites/smptests/smpatomic04/init.c @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2012 Deng Hengyi. + * + * This test case is to test atomic sub operation. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define CONFIGURE_INIT +#include "system.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + int i; + char ch; + rtems_id id; + rtems_status_code status; + bool allDone; + + /* XXX - Delay a bit to allow debug messages from + * startup to print. This may need to go away when + * debug messages go away. + */ + locked_print_initialize(); + + /* Put start of test message */ + locked_printf( "\n\n*** SMPatomic04 TEST ***\n" ); + + /* Initialize the TaskRan array */ + for ( i=0; i + +/* global variables */ + +/* + * Keep the names and IDs in global variables so another task can use them. + */ + +TEST_EXTERN volatile bool TaskRan[ CONFIGURE_SMP_MAXIMUM_PROCESSORS ]; + +/* + * Handy macros and static inline functions + */ + +/* end of include file */ diff --git a/testsuites/smptests/smpatomic04/tasks.c b/testsuites/smptests/smpatomic04/tasks.c new file mode 100644 index 0000000000..006c80e34a --- /dev/null +++ b/testsuites/smptests/smpatomic04/tasks.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2012 Deng Hengyi. + * + * This test case is to test atomic sub operation. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "system.h" + +#include +#include + +#define TEST_REPEAT 200000 + +#define ATOMIC_FETCH_SUB_NO_BARRIER(NAME, TYPE, cpuid, mem_bar)\ +{ \ + Atomic_##TYPE t = 0, a = 0, b = 0; \ + unsigned int i; \ + for (i = 0; i < TEST_REPEAT; i++){ \ + a = (Atomic_##TYPE)(rand() % ((Atomic_##TYPE)-1 / 2)); \ + b = (Atomic_##TYPE)(rand() % ((Atomic_##TYPE)-1 / 2)); \ + t = a; \ + _Atomic_Fetch_sub_##NAME(&t, b, mem_bar); \ + rtems_test_assert(t == (Atomic_##TYPE)(a - b)); \ + } \ + locked_printf("\nCPU%d _Atomic_Fetch_sub_" #NAME ": SUCCESS\n", cpuid); \ +} + +rtems_task Test_task( + rtems_task_argument argument + ) +{ + int cpu_num; + char name[5]; + char *p; + + /* Get the task name */ + p = rtems_object_get_name( RTEMS_SELF, 5, name ); + rtems_test_assert( p != NULL ); + + /* Get the CPU Number */ + cpu_num = bsp_smp_processor_id(); + + /* Print that the task is up and running. */ + /* test relaxed barrier */ + ATOMIC_FETCH_SUB_NO_BARRIER(int, Int, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_FETCH_SUB_NO_BARRIER(long, Long, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_FETCH_SUB_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_FETCH_SUB_NO_BARRIER(32, Int32, cpu_num, ATOMIC_RELAXED_BARRIER); + + /* test acquire barrier */ + ATOMIC_FETCH_SUB_NO_BARRIER(int, Int, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_FETCH_SUB_NO_BARRIER(long, Long, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_FETCH_SUB_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_FETCH_SUB_NO_BARRIER(32, Int32, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + /* test release barrier */ + ATOMIC_FETCH_SUB_NO_BARRIER(int, Int, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_FETCH_SUB_NO_BARRIER(long, Long, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_FETCH_SUB_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_FETCH_SUB_NO_BARRIER(32, Int32, cpu_num, ATOMIC_RELEASE_BARRIER); + +// ATOMIC_FETCH_SUB_NO_BARRIER(64, cpu_num); + + /* Set the flag that the task is up and running */ + TaskRan[cpu_num] = true; + + /* Drop into a loop which will keep this task on + * running on the cpu. + */ + while(1); +} diff --git a/testsuites/smptests/smpatomic05/Makefile.am b/testsuites/smptests/smpatomic05/Makefile.am new file mode 100644 index 0000000000..b9c4f7f325 --- /dev/null +++ b/testsuites/smptests/smpatomic05/Makefile.am @@ -0,0 +1,22 @@ + +rtems_tests_PROGRAMS = smpatomic05 +smpatomic05_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c + +dist_rtems_tests_DATA = smpatomic05.scn +dist_rtems_tests_DATA += smpatomic05.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(smpatomic05_OBJECTS) +LINK_LIBS = $(smpatomic05_LDLIBS) + +smpatomic05$(EXEEXT): $(smpatomic05_OBJECTS) $(smpatomic05_DEPENDENCIES) + @rm -f smpatomic05$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpatomic05/init.c b/testsuites/smptests/smpatomic05/init.c new file mode 100644 index 0000000000..42515d84ed --- /dev/null +++ b/testsuites/smptests/smpatomic05/init.c @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2012 Deng Hengyi. + * + * This test case is to test atomic and operation. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define CONFIGURE_INIT +#include "system.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + int i; + char ch; + rtems_id id; + rtems_status_code status; + bool allDone; + + /* XXX - Delay a bit to allow debug messages from + * startup to print. This may need to go away when + * debug messages go away. + */ + locked_print_initialize(); + + /* Put start of test message */ + locked_printf( "\n\n*** SMPatomic05 TEST ***\n" ); + + /* Initialize the TaskRan array */ + for ( i=0; i + +/* global variables */ + +/* + * Keep the names and IDs in global variables so another task can use them. + */ + +TEST_EXTERN volatile bool TaskRan[ CONFIGURE_SMP_MAXIMUM_PROCESSORS ]; + +/* + * Handy macros and static inline functions + */ + +/* end of include file */ diff --git a/testsuites/smptests/smpatomic05/tasks.c b/testsuites/smptests/smpatomic05/tasks.c new file mode 100644 index 0000000000..0061c82252 --- /dev/null +++ b/testsuites/smptests/smpatomic05/tasks.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2012 Deng Hengyi. + * + * This test case is to test atomic and operation. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "system.h" + +#include +#include + +#define TEST_REPEAT 200000 + +#define ATOMIC_FETCH_AND_NO_BARRIER(NAME, TYPE, cpuid, mem_bar)\ +{ \ + Atomic_##TYPE t = 0, a = 0, b = 0; \ + unsigned int i; \ + for (i = 0; i < TEST_REPEAT; i++){ \ + a = (Atomic_##TYPE)(rand() % ((Atomic_##TYPE)-1 / 2)); \ + b = (Atomic_##TYPE)(rand() % ((Atomic_##TYPE)-1 / 2)); \ + t = a; \ + _Atomic_Fetch_and_##NAME(&t, b, mem_bar); \ + rtems_test_assert(t == (Atomic_##TYPE)(a & b)); \ + } \ + locked_printf("\nCPU%d _Atomic_Fetch_and_" #NAME ": SUCCESS\n", cpuid); \ +} + +rtems_task Test_task( + rtems_task_argument argument + ) +{ + int cpu_num; + char name[5]; + char *p; + + /* Get the task name */ + p = rtems_object_get_name( RTEMS_SELF, 5, name ); + rtems_test_assert( p != NULL ); + + /* Get the CPU Number */ + cpu_num = bsp_smp_processor_id(); + + /* Print that the task is up and running. */ + /* test relaxed barrier */ + ATOMIC_FETCH_AND_NO_BARRIER(int, Int, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_FETCH_AND_NO_BARRIER(long, Long, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_FETCH_AND_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_FETCH_AND_NO_BARRIER(32, Int32, cpu_num, ATOMIC_RELAXED_BARRIER); + + /* test acquire barrier */ + ATOMIC_FETCH_AND_NO_BARRIER(int, Int, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_FETCH_AND_NO_BARRIER(long, Long, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_FETCH_AND_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_FETCH_AND_NO_BARRIER(32, Int32, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + /* test release barrier */ + ATOMIC_FETCH_AND_NO_BARRIER(int, Int, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_FETCH_AND_NO_BARRIER(long, Long, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_FETCH_AND_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_FETCH_AND_NO_BARRIER(32, Int32, cpu_num, ATOMIC_RELEASE_BARRIER); + +// ATOMIC_FETCH_AND_NO_BARRIER(64, cpu_num); + + /* Set the flag that the task is up and running */ + TaskRan[cpu_num] = true; + + /* Drop into a loop which will keep this task on + * running on the cpu. + */ + while(1); +} diff --git a/testsuites/smptests/smpatomic06/Makefile.am b/testsuites/smptests/smpatomic06/Makefile.am new file mode 100644 index 0000000000..30c23f7828 --- /dev/null +++ b/testsuites/smptests/smpatomic06/Makefile.am @@ -0,0 +1,22 @@ + +rtems_tests_PROGRAMS = smpatomic06 +smpatomic06_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c + +dist_rtems_tests_DATA = smpatomic06.scn +dist_rtems_tests_DATA += smpatomic06.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(smpatomic06_OBJECTS) +LINK_LIBS = $(smpatomic06_LDLIBS) + +smpatomic06$(EXEEXT): $(smpatomic06_OBJECTS) $(smpatomic06_DEPENDENCIES) + @rm -f smpatomic06$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpatomic06/init.c b/testsuites/smptests/smpatomic06/init.c new file mode 100644 index 0000000000..c75c629296 --- /dev/null +++ b/testsuites/smptests/smpatomic06/init.c @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2012 Deng Hengyi. + * + * This test case is to test atomic or operation. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define CONFIGURE_INIT +#include "system.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + int i; + char ch; + rtems_id id; + rtems_status_code status; + bool allDone; + + /* XXX - Delay a bit to allow debug messages from + * startup to print. This may need to go away when + * debug messages go away. + */ + locked_print_initialize(); + + /* Put start of test message */ + locked_printf( "\n\n*** SMPatomic06 TEST ***\n" ); + + /* Initialize the TaskRan array */ + for ( i=0; i + +/* global variables */ + +/* + * Keep the names and IDs in global variables so another task can use them. + */ + +TEST_EXTERN volatile bool TaskRan[ CONFIGURE_SMP_MAXIMUM_PROCESSORS ]; + +/* + * Handy macros and static inline functions + */ + +/* end of include file */ diff --git a/testsuites/smptests/smpatomic06/tasks.c b/testsuites/smptests/smpatomic06/tasks.c new file mode 100644 index 0000000000..ec29b28ac2 --- /dev/null +++ b/testsuites/smptests/smpatomic06/tasks.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2012 Deng Hengyi. + * + * This test case is to test atomic or operation. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "system.h" + +#include +#include + +#define TEST_REPEAT 200000 + +#define ATOMIC_FETCH_OR_NO_BARRIER(NAME, TYPE, cpuid, mem_bar) \ +{ \ + Atomic_##TYPE t = 0, a = 0, b = 0; \ + unsigned int i; \ + for (i = 0; i < TEST_REPEAT; i++){ \ + a = (Atomic_##TYPE)(rand() % ((Atomic_##TYPE)-1 / 2)); \ + b = (Atomic_##TYPE)(rand() % ((Atomic_##TYPE)-1 / 2)); \ + t = a; \ + _Atomic_Fetch_or_##NAME(&t, b, mem_bar); \ + rtems_test_assert(t == (Atomic_##TYPE)(a | b)); \ + } \ + locked_printf("\nCPU%d _Atomic_Fetch_or_" #NAME ": SUCCESS\n", cpuid); \ +} + +rtems_task Test_task( + rtems_task_argument argument + ) +{ + int cpu_num; + char name[5]; + char *p; + + /* Get the task name */ + p = rtems_object_get_name( RTEMS_SELF, 5, name ); + rtems_test_assert( p != NULL ); + + /* Get the CPU Number */ + cpu_num = bsp_smp_processor_id(); + + /* Print that the task is up and running. */ + /* test relaxed barrier */ + ATOMIC_FETCH_OR_NO_BARRIER(int, Int, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_FETCH_OR_NO_BARRIER(long, Long, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_FETCH_OR_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_FETCH_OR_NO_BARRIER(32, Int32, cpu_num, ATOMIC_RELAXED_BARRIER); + + /* test acquire barrier */ + ATOMIC_FETCH_OR_NO_BARRIER(int, Int, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_FETCH_OR_NO_BARRIER(long, Long, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_FETCH_OR_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_FETCH_OR_NO_BARRIER(32, Int32, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + /* test release barrier */ + ATOMIC_FETCH_OR_NO_BARRIER(int, Int, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_FETCH_OR_NO_BARRIER(long, Long, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_FETCH_OR_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_FETCH_OR_NO_BARRIER(32, Int32, cpu_num, ATOMIC_RELEASE_BARRIER); + +// ATOMIC_FETCH_OR_NO_BARRIER(64, cpu_num); + + /* Set the flag that the task is up and running */ + TaskRan[cpu_num] = true; + + /* Drop into a loop which will keep this task on + * running on the cpu. + */ + while(1); +} diff --git a/testsuites/smptests/smpatomic07/Makefile.am b/testsuites/smptests/smpatomic07/Makefile.am new file mode 100644 index 0000000000..5e3ebd2b07 --- /dev/null +++ b/testsuites/smptests/smpatomic07/Makefile.am @@ -0,0 +1,22 @@ + +rtems_tests_PROGRAMS = smpatomic07 +smpatomic07_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c + +dist_rtems_tests_DATA = smpatomic07.scn +dist_rtems_tests_DATA += smpatomic07.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(smpatomic07_OBJECTS) +LINK_LIBS = $(smpatomic07_LDLIBS) + +smpatomic07$(EXEEXT): $(smpatomic07_OBJECTS) $(smpatomic07_DEPENDENCIES) + @rm -f smpatomic07$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpatomic07/init.c b/testsuites/smptests/smpatomic07/init.c new file mode 100644 index 0000000000..570a1a8e25 --- /dev/null +++ b/testsuites/smptests/smpatomic07/init.c @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2012 Deng Hengyi. + * + * This test case is to test atomic compare and exchange operation. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define CONFIGURE_INIT +#include "system.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + int i; + char ch; + rtems_id id; + rtems_status_code status; + bool allDone; + + /* XXX - Delay a bit to allow debug messages from + * startup to print. This may need to go away when + * debug messages go away. + */ + locked_print_initialize(); + + /* Put start of test message */ + locked_printf( "\n\n*** SMPatomic07 TEST ***\n" ); + + /* Initialize the TaskRan array */ + for ( i=0; i + +/* global variables */ + +/* + * Keep the names and IDs in global variables so another task can use them. + */ + +TEST_EXTERN volatile bool TaskRan[ CONFIGURE_SMP_MAXIMUM_PROCESSORS ]; + +/* + * Handy macros and static inline functions + */ + +/* end of include file */ diff --git a/testsuites/smptests/smpatomic07/tasks.c b/testsuites/smptests/smpatomic07/tasks.c new file mode 100644 index 0000000000..88c69be6fb --- /dev/null +++ b/testsuites/smptests/smpatomic07/tasks.c @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2012 Deng Hengyi. + * + * This test case is to test atomic compare and exchange operation. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "system.h" + +#include +#include + +#define TEST_REPEAT 200000 + +#define ATOMIC_CAS_NO_BARRIER(NAME, TYPE, cpuid, mem_bar) \ +{ \ + Atomic_##TYPE a = 0, b = 0; \ + unsigned int i; \ + int r; \ + for (i = 0; i < TEST_REPEAT; i++){ \ + a = rand() % (Atomic_##TYPE)-1; \ + b = a; \ + r = _Atomic_Compare_exchange_##NAME(&b, a + 1, a - 1, mem_bar); \ + if(r != 0){ \ + locked_printf("\nCPU%d _Atomic_Compare_exchange_" #NAME ": FAILED\n", cpuid); \ + rtems_test_exit( 0 ); \ + } \ + b = a; \ + r = _Atomic_Compare_exchange_##NAME(&b, a, a - 1, mem_bar); \ + if((r == 0) ||((r != 0) && ((a - 1) != b))){ \ + locked_printf("\nCPU%d _Atomic_Compare_exchange_" #NAME ": FAILED\n", cpuid); \ + rtems_test_exit( 0 ); \ + } \ + b = a; \ + r = _Atomic_Compare_exchange_##NAME(&b, a + 1, a, mem_bar); \ + if(r != 0){ \ + locked_printf("\nCPU%d _Atomic_Compare_exchange_" #NAME ": FAILED\n", cpuid); \ + rtems_test_exit( 0 ); \ + } \ + } \ + locked_printf("\nCPU%d _Atomic_Compare_exchange_" #NAME ": SUCCESS\n", cpuid); \ +} + +rtems_task Test_task( + rtems_task_argument argument + ) +{ + int cpu_num; + char name[5]; + char *p; + + /* Get the task name */ + p = rtems_object_get_name( RTEMS_SELF, 5, name ); + rtems_test_assert( p != NULL ); + + /* Get the CPU Number */ + cpu_num = bsp_smp_processor_id(); + + /* Print that the task is up and running. */ + /* test relaxed barrier */ + ATOMIC_CAS_NO_BARRIER(int, Int, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_CAS_NO_BARRIER(long, Long, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_CAS_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_RELAXED_BARRIER); + + ATOMIC_CAS_NO_BARRIER(32, Int32, cpu_num, ATOMIC_RELAXED_BARRIER); + + /* test acquire barrier */ + ATOMIC_CAS_NO_BARRIER(int, Int, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_CAS_NO_BARRIER(long, Long, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_CAS_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + ATOMIC_CAS_NO_BARRIER(32, Int32, cpu_num, ATOMIC_ACQUIRE_BARRIER); + + /* test release barrier */ + ATOMIC_CAS_NO_BARRIER(int, Int, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_CAS_NO_BARRIER(long, Long, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_CAS_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_RELEASE_BARRIER); + + ATOMIC_CAS_NO_BARRIER(32, Int32, cpu_num, ATOMIC_RELEASE_BARRIER); + +// ATOMIC_CAS_NO_BARRIER(64, cpu_num); + + /* Set the flag that the task is up and running */ + TaskRan[cpu_num] = true; + + /* Drop into a loop which will keep this task on + * running on the cpu. + */ + while(1); +} -- cgit v1.2.3