From f3ba158c1ebfcef6c85759056d0a3d5f421ea870 Mon Sep 17 00:00:00 2001 From: asterix Date: Thu, 20 Mar 2008 14:11:50 +0000 Subject: [PATCH] Rename CPU_MEMORY_BARRIER to MEMORY_BARRIER and move it in compiler header. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1200 38d2e660-2303-0410-9eaa-f027e97ec537 --- cfg/compiler.h | 18 ++++++++++++++---- cpu/attr.h | 4 ---- kern/proc.c | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/cfg/compiler.h b/cfg/compiler.h index 96745521..a303dc77 100644 --- a/cfg/compiler.h +++ b/cfg/compiler.h @@ -37,8 +37,8 @@ * \author Bernardo Innocenti */ -#ifndef DEVLIB_COMPILER_H -#define DEVLIB_COMPILER_H +#ifndef BERTOS_COMPILER_H +#define BERTOS_COMPILER_H #include @@ -181,6 +181,11 @@ #define RESTRICT __restrict__ #define MUST_CHECK __attribute__((warn_unused_result)) #define PACKED __attribute__((packed)) + /** + * Force compiler to realod context variable. + */ + #define MEMORY_BARRIER asm volatile ("" : : : "memory") + #if GNUC_PREREQ(3,1) #define DEPRECATED __attribute__((__deprecated__)) #endif @@ -211,6 +216,8 @@ #pragma GCC poison cin cout cerr clog #endif + + #elif defined(__MWERKS__) /* Compiler features */ @@ -313,6 +320,10 @@ #ifndef PACKED #define PACKED /* nothing */ #endif +#ifndef MEMORY_BARRIER +#define MEMORY_BARRIER /* nothing */ +#warning No memory barrier defined for select compiler. If you use the kernel check it. +#endif /* Misc definitions */ @@ -323,7 +334,6 @@ #define EOF (-1) #endif - /* Support for hybrid C/C++ applications. */ #ifdef __cplusplus #define EXTERN_C extern "C" @@ -515,4 +525,4 @@ typedef unsigned char page_t; /**< Type for banked memory pages. */ do { (void)(&(var) == (type *)0); } while(0) #endif -#endif /* DEVLIB_COMPILER_H */ +#endif /* BERTOS_COMPILER_H */ diff --git a/cpu/attr.h b/cpu/attr.h index 5082a2f5..ce6e4ae3 100644 --- a/cpu/attr.h +++ b/cpu/attr.h @@ -104,10 +104,6 @@ #define CPU_STACK_GROWS_UPWARD 0 #define CPU_SP_ON_EMPTY_SLOT 0 #define CPU_HARVARD 0 - /* - * Force compiler to realod context variable. - */ - #define CPU_MEMORY_BARRIER asm volatile ("" : : : "memory") #ifdef __IAR_SYSTEMS_ICC__ #warning Check CPU_BYTE_ORDER diff --git a/kern/proc.c b/kern/proc.c index 5290c2c5..a9e95624 100644 --- a/kern/proc.c +++ b/kern/proc.c @@ -275,7 +275,7 @@ void proc_schedule(void) */ IRQ_ENABLE; CPU_IDLE; - CPU_MEMORY_BARRIER; + MEMORY_BARRIER; IRQ_DISABLE; } IRQ_RESTORE(flags); -- 2.25.1