L4Re Operating System Framework – Interface and Usage Documentation
Loading...
Searching...
No Matches
Basic Macros

L4 standard macros for header files, function definitions, and public APIs etc. More...

+ Collaboration diagram for Basic Macros:

Macros

#define L4_INLINE
 L4 Inline function attribute.
 
#define L4_ALWAYS_INLINE
 Always inline a function.
 
#define __BEGIN_DECLS
 Start section with C types and functions.
 
#define __END_DECLS
 End section with C types and functions.
 
#define EXTERN_C_BEGIN
 Start section with C types and functions.
 
#define EXTERN_C_END
 End section with C types and functions.
 
#define EXTERN_C
 Mark C types and functions.
 
#define L4_NOTHROW
 Mark a function declaration and definition as never throwing an exception.
 
#define L4_EXPORT
 Attribute to mark functions, variables, and data types as being exported from a library.
 
#define L4_HIDDEN
 Attribute to mark functions, variables, and data types as being explicitly hidden from users of a library.
 
#define L4_NORETURN
 Noreturn function attribute.
 
#define L4_NOINSTRUMENT
 No instrumentation function attribute.
 
#define L4_LIKELY(x)
 Expression is likely to execute.
 
#define L4_UNLIKELY(x)
 Expression is unlikely to execute.
 
#define L4_STICKY(x)
 Mark symbol sticky (even not there)
 
#define L4_DEPRECATED(s)
 Mark symbol deprecated.
 
#define L4_stringify_helper(x)
 stringify helper.
 
#define L4_stringify(x)
 stringify.
 
#define L4_CV
 Define calling convention.
 
#define L4_CV
 Define calling convention.
 
#define L4_CV
 Define calling convention.
 

Functions

unsigned long l4_align_stack_for_direct_fncall (unsigned long stack)
 Specify the desired alignment of the stack pointer.
 
void l4_barrier (void)
 Memory barrier.
 
void l4_mb (void)
 Memory barrier.
 
void l4_wmb (void)
 Write memory barrier.
 
L4_NORETURN void l4_infinite_loop (void)
 Infinite loop.
 

Detailed Description

L4 standard macros for header files, function definitions, and public APIs etc.

Include File
#include <l4/sys/compiler.h>
L4 compiler related defines.

Macro Definition Documentation

◆ L4_EXPORT

#define L4_EXPORT

Attribute to mark functions, variables, and data types as being exported from a library.

All data types, functions, and global variables that shall be exported from a library shall be marked with this attribute. The default may become to hide everything that is not marked as L4_EXPORT from the users of a library and provide the possibility for aggressive optimization of all those internal functionality of a library.

Usage:

class L4_EXPORT My_class
{
...
};
int L4_EXPORT function(void);
int L4_EXPORT global_data; // global data is not recommended
#define L4_EXPORT
Attribute to mark functions, variables, and data types as being exported from a library.
Definition compiler.h:221

Definition at line 221 of file compiler.h.

◆ L4_HIDDEN

#define L4_HIDDEN

Attribute to mark functions, variables, and data types as being explicitly hidden from users of a library.

This attribute is intended for functions, data, and data types that shall never be visible outside of a library. In particular, for shared libraries this may result in much faster code within the library and short linking times.

class L4_HIDDEN My_class
{
...
};
int L4_HIDDEN function(void);
int L4_HIDDEN global_data; // global data is not recommended
#define L4_HIDDEN
Attribute to mark functions, variables, and data types as being explicitly hidden from users of a lib...
Definition compiler.h:218

Definition at line 218 of file compiler.h.

◆ L4_NOTHROW

#define L4_NOTHROW

Mark a function declaration and definition as never throwing an exception.

(Also for C code).

This macro shall be used to mark C and C++ functions that never throw any exception. Note that also C functions may throw exceptions according to the compilers ABI and shall be marked with L4_NOTHROW if they never do. In C++ this is equivalent to throw().

int foo() L4_NOTHROW;
...
int foo() L4_NOTHROW
{
...
return result;
}
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:188

Definition at line 188 of file compiler.h.

Function Documentation

◆ l4_align_stack_for_direct_fncall()

unsigned long l4_align_stack_for_direct_fncall ( unsigned long  stack)
inline

Specify the desired alignment of the stack pointer.

BIGGEST_ALIGNMENT provides the largest alignment ever used for any data type on the target machine. This is normally identical to desired stack alignment. Align stack pointer for directly invoked functions.

The stack needs to be aligned to L4_STACK_ALIGN for being able to access certain data on the stack. On x86/AMD64, a function call is performed using the 'call' instruction decrementing the stack pointer and writing the return address onto the stack. The called function considers this when adapting the stack pointer after function entry. If the called function was not invoked by a 'call' instruction, the stack pointer is actually off by a machine word leading to stack alignment issues when executing SSE instructions.

This function fixes the stack pointer for directly invoked functions. For architectures not automatically pushing the stack pointer during a function call, just enforce the L4_STACK_ALIGN alignment.

Definition at line 274 of file compiler.h.

◆ l4_infinite_loop()

L4_NORETURN void l4_infinite_loop ( void  )
inline

Infinite loop.

Will never return. Use l4_sleep_forever() if at all possible.

Definition at line 342 of file compiler.h.

References l4_barrier().

+ Here is the call graph for this function: