29#ifndef __L4_COMPILER_H__
30#define __L4_COMPILER_H__
32#if !defined(__ASSEMBLY__) && !defined(__ASSEMBLER__)
48# define L4_INLINE_STATIC static __inline__
49# define L4_INLINE_EXTERN extern __inline__
50# ifdef __GNUC_STDC_INLINE__
51# define L4_INLINE L4_INLINE_STATIC
53# define L4_INLINE L4_INLINE_EXTERN
56# define L4_INLINE static
59# define L4_INLINE inline
62# define L4_INLINE inline
69#define L4_ALWAYS_INLINE L4_INLINE __attribute__((__always_inline__))
72#define L4_DECLARE_CONSTRUCTOR(func, prio) \
73 static inline __attribute__((constructor(prio))) void func ## _ctor_func(void) { func(); }
174# define L4_NOTHROW__A __attribute__((nothrow))
176# define EXTERN_C_BEGIN
179# ifndef __BEGIN_DECLS
180# define __BEGIN_DECLS
185# define L4_DEFAULT_PARAM(x)
187# if __cplusplus >= 201103L
188# define L4_NOTHROW noexcept
190# define L4_NOTHROW throw()
192# define EXTERN_C_BEGIN extern "C" {
193# define EXTERN_C_END }
194# define EXTERN_C extern "C"
195# if !defined __BEGIN_DECLS || defined DOXYGEN
196# define __BEGIN_DECLS extern "C" {
198# if !defined __END_DECLS || defined DOXYGEN
199# define __END_DECLS }
201# define L4_DEFAULT_PARAM(x) = x
208#define L4_NORETURN __attribute__((noreturn))
210#define L4_PURE __attribute__((pure))
216#define L4_NOINSTRUMENT __attribute__((no_instrument_function))
218# define L4_HIDDEN __attribute__((visibility("hidden")))
220#if !defined L4_EXPORT || defined DOXYGEN
221# define L4_EXPORT __attribute__((visibility("default")))
223#ifndef L4_EXPORT_TYPE
225# define L4_EXPORT_TYPE __attribute__((visibility("default")))
227# define L4_EXPORT_TYPE
230#define L4_STRONG_ALIAS(name, aliasname) L4__STRONG_ALIAS(name, aliasname)
231#define L4__STRONG_ALIAS(name, aliasname) \
232 extern __typeof (name) aliasname __attribute__ ((alias (#name)));
241#if defined(ARCH_x86) || defined(ARCH_amd64) || \
242 defined(ARCH_arm) || defined(ARCH_arm64) || \
243 defined(ARCH_mips) || defined(ARCH_ppc32) || defined(ARCH_sparc)
244# define L4_STACK_ALIGN __BIGGEST_ALIGNMENT__
246# error Define L4_STACK_ALIGN for this target!
266#if defined(ARCH_x86) || defined(ARCH_amd64)
269 if ((stack & (L4_STACK_ALIGN - 1)) == (L4_STACK_ALIGN -
sizeof(
unsigned long)))
271 return (stack & ~(L4_STACK_ALIGN)) -
sizeof(
unsigned long);
276 return stack & ~(L4_STACK_ALIGN);
282#include <l4/sys/linkage.h>
284#define L4_LIKELY(x) __builtin_expect((x),1)
285#define L4_UNLIKELY(x) __builtin_expect((x),0)
289#define L4_STICKY(x) __attribute__((used)) x
290#define L4_DEPRECATED(s) __attribute__((deprecated(s)))
293# if !defined(__cplusplus)
294# define static_assert(x, y) _Static_assert(x, y)
295# elif __cplusplus < 201103L
296# define static_assert(x, y) \
297 extern int l4_static_assert[-(!(x))] __attribute__((unused))
301#define L4_stringify_helper(x) #x
302#define L4_stringify(x) L4_stringify_helper(x)
329 __asm__ __volatile__ (
"" : : :
"memory");
334 __asm__ __volatile__ (
"" : : :
"memory");
339 __asm__ __volatile__ (
"" : : :
"memory");
void l4_wmb(void)
Write memory barrier.
#define L4_INLINE
L4 Inline function attribute.
void l4_barrier(void)
Memory barrier.
void l4_mb(void)
Memory barrier.
unsigned long l4_align_stack_for_direct_fncall(unsigned long stack)
Specify the desired alignment of the stack pointer.
L4_NORETURN void l4_infinite_loop(void)
Infinite loop.
#define L4_NORETURN
Noreturn function attribute.