2017-01-14 07:50:29 +08:00
|
|
|
/* GCC specific test inline assembler functions and macros */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2015, Wind River Systems, Inc.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _TEST_ASM_INLINE_GCC_H
|
|
|
|
#define _TEST_ASM_INLINE_GCC_H
|
|
|
|
|
|
|
|
#if !defined(__GNUC__)
|
|
|
|
#error test_asm_inline_gcc.h goes only with GCC
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(CONFIG_X86)
|
|
|
|
static inline void timestamp_serialize(void)
|
|
|
|
{
|
|
|
|
__asm__ __volatile__ (/* serialize */
|
|
|
|
"xorl %%eax,%%eax;\n\t"
|
|
|
|
"cpuid;\n\t"
|
|
|
|
:
|
|
|
|
:
|
|
|
|
: "%eax", "%ebx", "%ecx", "%edx");
|
|
|
|
}
|
|
|
|
#elif defined(CONFIG_CPU_CORTEX_M)
|
2019-11-10 01:49:36 +08:00
|
|
|
#include <arch/arm/aarch32/cortex_m/cmsis.h>
|
2017-01-14 07:50:29 +08:00
|
|
|
static inline void timestamp_serialize(void)
|
|
|
|
{
|
2019-06-19 02:45:40 +08:00
|
|
|
/* isb is available in all Cortex-M */
|
2017-01-14 07:50:29 +08:00
|
|
|
__ISB();
|
|
|
|
}
|
2018-06-25 21:15:14 +08:00
|
|
|
#elif defined(CONFIG_CPU_CORTEX_R)
|
2020-03-22 22:19:22 +08:00
|
|
|
#include <arch/arm/aarch32/cortex_a_r/cpu.h>
|
2018-06-25 21:15:14 +08:00
|
|
|
static inline void timestamp_serialize(void)
|
|
|
|
{
|
|
|
|
__ISB();
|
|
|
|
}
|
2019-11-11 20:17:20 +08:00
|
|
|
#elif defined(CONFIG_CPU_CORTEX_A)
|
|
|
|
#include <arch/arm/aarch64/cpu.h>
|
|
|
|
static inline void timestamp_serialize(void)
|
|
|
|
{
|
|
|
|
__ISB();
|
|
|
|
}
|
2017-01-14 07:50:29 +08:00
|
|
|
#elif defined(CONFIG_CPU_ARCV2)
|
|
|
|
#define timestamp_serialize()
|
2017-11-24 18:14:14 +08:00
|
|
|
#elif defined(CONFIG_ARCH_POSIX)
|
|
|
|
#define timestamp_serialize()
|
2018-07-23 16:32:45 +08:00
|
|
|
#elif defined(CONFIG_XTENSA)
|
|
|
|
#define timestamp_serialize()
|
|
|
|
#elif defined(CONFIG_NIOS2)
|
|
|
|
#define timestamp_serialize()
|
2019-07-18 01:17:05 +08:00
|
|
|
#elif defined(CONFIG_RISCV)
|
2018-07-23 16:32:45 +08:00
|
|
|
#define timestamp_serialize()
|
2017-01-14 07:50:29 +08:00
|
|
|
#else
|
|
|
|
#error implementation of timestamp_serialize() not provided for your CPU target
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _TEST_ASM_INLINE_GCC_H */
|