iPXE
Defines | Functions
compiler.h File Reference

Global compiler definitions. More...

#include <bits/compiler.h>

Go to the source code of this file.

Defines

#define __attribute__(x)
#define _C1(x, y)   x ## y
 Concatenate non-expanded arguments.
#define _C2(x, y)   _C1 ( x, y )
 Concatenate expanded arguments.
#define _S1(x)   #x
 Stringify non-expanded argument.
#define _S2(x)   _S1 ( x )
 Stringify expanded argument.
#define PROGBITS_OPS   _S2 ( ASM_TCHAR_OPS ) "progbits"
#define PROGBITS   _S2 ( ASM_TCHAR ) "progbits"
#define NOBITS_OPS   _S2 ( ASM_TCHAR_OPS ) "nobits"
#define NOBITS   _S2 ( ASM_TCHAR ) "nobits"
#define PROVIDE_SYMBOL(symbol)
 Provide a symbol within this object file.
#define REQUEST_SYMBOL(symbol)   __asm__ ( ".equ __request_" #symbol ", " #symbol )
 Request a symbol.
#define REQUIRE_SYMBOL(symbol)
 Require a symbol.
#define REQUIRING_SYMBOL(symbol)   __asm__ ( ".equ __requiring_symbol__, " #symbol )
 Specify the file's requiring symbol.
#define PROVIDE_REQUIRING_SYMBOL()
 Provide a file's requiring symbol.
#define PREFIX_OBJECT(_prefix)   _C2 ( _prefix, OBJECT )
#define OBJECT_SYMBOL   PREFIX_OBJECT ( obj_ )
#define REQUEST_OBJECT(object)   REQUEST_SYMBOL ( obj_ ## object )
 Request an object.
#define REQUIRE_OBJECT(object)   REQUIRE_SYMBOL ( obj_ ## object )
 Require an object.
#define ERRFILE   PREFIX_OBJECT ( ERRFILE_ )
 Select file identifier for errno.h (if used)
#define __weak   __attribute__ (( weak, noinline ))
 Declare a function as weak (use *before* the definition)
#define __debug_disable(object)   _C2 ( __debug_disable_, object )
#define DBG_DISABLE_OBJECT(object, level)
#define DBG_ENABLE_OBJECT(object, level)
#define DBGLVL   0
#define DBG_DISABLE(level)   do { } while ( 0 )
#define DBG_ENABLE(level)   do { } while ( 0 )
#define DBGLVL_LOG   1
#define DBG_LOG   ( DBGLVL & DBGLVL_LOG )
#define DBGLVL_EXTRA   2
#define DBG_EXTRA   ( DBGLVL & DBGLVL_EXTRA )
#define DBGLVL_PROFILE   4
#define DBG_PROFILE   ( DBGLVL & DBGLVL_PROFILE )
#define DBGLVL_IO   8
#define DBG_IO   ( DBGLVL & DBGLVL_IO )
#define DBG_IF(level,...)
 Print debugging message if we are at a certain debug level.
#define DBG_HDA_IF(level, dispaddr, data, len)
 Print a hex dump if we are at a certain debug level.
#define DBG_HD_IF(level, data, len)
 Print a hex dump if we are at a certain debug level.
#define DBG_MD5A_IF(level, dispaddr, data, len)
 Print an MD5 checksum if we are at a certain debug level.
#define DBG_MD5_IF(level, data, len)
 Print an MD5 checksum if we are at a certain debug level.
#define DBG_PAUSE_IF(level,...)
 Prompt for key press if we are at a certain debug level.
#define DBG_MORE_IF(level,...)
 Prompt for more output data if we are at a certain debug level.
#define DBG_AC_IF(level, id)
 Select colour for debug messages if we are at a certain debug level.
#define DBG_DC_IF(level)
 Revert colour for debug messages if we are at a certain debug level.
#define DBGC_IF(level, id,...)
#define DBGC_HDA_IF(level, id,...)
#define DBGC_HD_IF(level, id,...)
#define DBGC_MD5A_IF(level, id,...)
#define DBGC_MD5_IF(level, id,...)
#define DBGC_PAUSE_IF(level, id)
#define DBGC_MORE_IF(level, id)
#define DBG(...)   DBG_IF ( LOG, ##__VA_ARGS__ )
 Print a debugging message.
#define DBG_HDA(...)   DBG_HDA_IF ( LOG, ##__VA_ARGS__ )
#define DBG_HD(...)   DBG_HD_IF ( LOG, ##__VA_ARGS__ )
#define DBG_MD5A(...)   DBG_MD5A_IF ( LOG, ##__VA_ARGS__ )
#define DBG_MD5(...)   DBG_MD5_IF ( LOG, ##__VA_ARGS__ )
#define DBG_PAUSE(...)   DBG_PAUSE_IF ( LOG, ##__VA_ARGS__ )
#define DBG_MORE(...)   DBG_MORE_IF ( LOG, ##__VA_ARGS__ )
#define DBGC(...)   DBGC_IF ( LOG, ##__VA_ARGS__ )
#define DBGC_HDA(...)   DBGC_HDA_IF ( LOG, ##__VA_ARGS__ )
#define DBGC_HD(...)   DBGC_HD_IF ( LOG, ##__VA_ARGS__ )
#define DBGC_MD5A(...)   DBGC_MD5A_IF ( LOG, ##__VA_ARGS__ )
#define DBGC_MD5(...)   DBGC_MD5_IF ( LOG, ##__VA_ARGS__ )
#define DBGC_PAUSE(...)   DBGC_PAUSE_IF ( LOG, ##__VA_ARGS__ )
#define DBGC_MORE(...)   DBGC_MORE_IF ( LOG, ##__VA_ARGS__ )
#define DBG2(...)   DBG_IF ( EXTRA, ##__VA_ARGS__ )
#define DBG2_HDA(...)   DBG_HDA_IF ( EXTRA, ##__VA_ARGS__ )
#define DBG2_HD(...)   DBG_HD_IF ( EXTRA, ##__VA_ARGS__ )
#define DBG2_MD5A(...)   DBG_MD5A_IF ( EXTRA, ##__VA_ARGS__ )
#define DBG2_MD5(...)   DBG_MD5_IF ( EXTRA, ##__VA_ARGS__ )
#define DBG2_PAUSE(...)   DBG_PAUSE_IF ( EXTRA, ##__VA_ARGS__ )
#define DBG2_MORE(...)   DBG_MORE_IF ( EXTRA, ##__VA_ARGS__ )
#define DBGC2(...)   DBGC_IF ( EXTRA, ##__VA_ARGS__ )
#define DBGC2_HDA(...)   DBGC_HDA_IF ( EXTRA, ##__VA_ARGS__ )
#define DBGC2_HD(...)   DBGC_HD_IF ( EXTRA, ##__VA_ARGS__ )
#define DBGC2_MD5A(...)   DBGC_MD5A_IF ( EXTRA, ##__VA_ARGS__ )
#define DBGC2_MD5(...)   DBGC_MD5_IF ( EXTRA, ##__VA_ARGS__ )
#define DBGC2_PAUSE(...)   DBGC_PAUSE_IF ( EXTRA, ##__VA_ARGS__ )
#define DBGC2_MORE(...)   DBGC_MORE_IF ( EXTRA, ##__VA_ARGS__ )
#define DBGP(...)   DBG_IF ( PROFILE, ##__VA_ARGS__ )
#define DBGP_HDA(...)   DBG_HDA_IF ( PROFILE, ##__VA_ARGS__ )
#define DBGP_HD(...)   DBG_HD_IF ( PROFILE, ##__VA_ARGS__ )
#define DBGP_MD5A(...)   DBG_MD5A_IF ( PROFILE, ##__VA_ARGS__ )
#define DBGP_MD5(...)   DBG_MD5_IF ( PROFILE, ##__VA_ARGS__ )
#define DBGP_PAUSE(...)   DBG_PAUSE_IF ( PROFILE, ##__VA_ARGS__ )
#define DBGP_MORE(...)   DBG_MORE_IF ( PROFILE, ##__VA_ARGS__ )
#define DBGCP(...)   DBGC_IF ( PROFILE, ##__VA_ARGS__ )
#define DBGCP_HDA(...)   DBGC_HDA_IF ( PROFILE, ##__VA_ARGS__ )
#define DBGCP_HD(...)   DBGC_HD_IF ( PROFILE, ##__VA_ARGS__ )
#define DBGCP_MD5A(...)   DBGC_MD5A_IF ( PROFILE, ##__VA_ARGS__ )
#define DBGCP_MD5(...)   DBGC_MD5_IF ( PROFILE, ##__VA_ARGS__ )
#define DBGCP_PAUSE(...)   DBGC_PAUSE_IF ( PROFILE, ##__VA_ARGS__ )
#define DBGCP_MORE(...)   DBGC_MORE_IF ( PROFILE, ##__VA_ARGS__ )
#define DBGIO(...)   DBG_IF ( IO, ##__VA_ARGS__ )
#define DBGIO_HDA(...)   DBG_HDA_IF ( IO, ##__VA_ARGS__ )
#define DBGIO_HD(...)   DBG_HD_IF ( IO, ##__VA_ARGS__ )
#define DBGIO_MD5A(...)   DBG_MD5A_IF ( IO, ##__VA_ARGS__ )
#define DBGIO_MD5(...)   DBG_MD5_IF ( IO, ##__VA_ARGS__ )
#define DBGIO_PAUSE(...)   DBG_PAUSE_IF ( IO, ##__VA_ARGS__ )
#define DBGIO_MORE(...)   DBG_MORE_IF ( IO, ##__VA_ARGS__ )
#define DBGCIO(...)   DBGC_IF ( IO, ##__VA_ARGS__ )
#define DBGCIO_HDA(...)   DBGC_HDA_IF ( IO, ##__VA_ARGS__ )
#define DBGCIO_HD(...)   DBGC_HD_IF ( IO, ##__VA_ARGS__ )
#define DBGCIO_MD5A(...)   DBGC_MD5A_IF ( IO, ##__VA_ARGS__ )
#define DBGCIO_MD5(...)   DBGC_MD5_IF ( IO, ##__VA_ARGS__ )
#define DBGCIO_PAUSE(...)   DBGC_PAUSE_IF ( IO, ##__VA_ARGS__ )
#define DBGCIO_MORE(...)   DBGC_MORE_IF ( IO, ##__VA_ARGS__ )
#define __unused   __attribute__ (( unused ))
 Declare a variable or data structure as unused.
#define __pure   __attribute__ (( pure ))
 Declare a function as pure - i.e.
#define __const   __attribute__ (( const ))
 Declare a function as const - i.e.
#define __nonnull   __attribute__ (( nonnull ))
 Declare a function's pointer parameters as non-null - i.e.
#define __malloc   __attribute__ (( malloc ))
 Declare a pointer returned by a function as a unique memory address as returned by malloc-type functions.
#define __used   __attribute__ (( used ))
 Declare a function as used.
#define __aligned   __attribute__ (( aligned ( 16 ) ))
 Declare a data structure to be aligned with 16-byte alignment.
#define __always_inline   __attribute__ (( always_inline ))
 Declare a function to be always inline.
#define inline   inline __attribute__ (( no_instrument_function ))
#define __shared   __asm__ ( "_shared_bss" ) __aligned
 Shared data.
#define barrier()   __asm__ __volatile__ ( "" : : : "memory" )
 Optimisation barrier.
#define ARRAY_SIZE(array)   ( sizeof (array) / sizeof ( (array)[0] ) )
 Array size.
#define FILE_LICENCE_PUBLIC_DOMAIN   PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__public_domain__ ) )
 Declare a file as being in the public domain.
#define FILE_LICENCE_GPL2_OR_LATER   PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__gpl2_or_later__ ) )
 Declare a file as being under version 2 (or later) of the GNU GPL.
#define FILE_LICENCE_GPL2_ONLY   PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__gpl2_only__ ) )
 Declare a file as being under version 2 of the GNU GPL.
#define FILE_LICENCE_GPL_ANY   PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__gpl_any__ ) )
 Declare a file as being under any version of the GNU GPL.
#define FILE_LICENCE_BSD3   PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__bsd3__ ) )
 Declare a file as being under the three-clause BSD licence.
#define FILE_LICENCE_BSD2   PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__bsd2__ ) )
 Declare a file as being under the two-clause BSD licence.
#define FILE_LICENCE_MIT   PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__mit__ ) )
 Declare a file as being under the one-clause MIT-style licence.
#define FILE_LICENCE_GPL2_OR_LATER_OR_UBDL   PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__gpl2_or_later_or_ubdl__ ) )
 Declare a file as being under GPLv2+ or UBDL.
#define FILE_LICENCE(_licence)   FILE_LICENCE_ ## _licence
 Declare a particular licence as applying to a file.

Functions

 PROVIDE_SYMBOL (OBJECT_SYMBOL)
 Always provide the symbol for the current object (defined by -DOBJECT)
void dbg_printf (const char *fmt,...)
 printf() for debugging
void dbg_autocolourise (unsigned long id)
 Select automatic colour for debug messages.
void dbg_decolourise (void)
 Revert to normal colour.
void dbg_hex_dump_da (unsigned long dispaddr, const void *data, unsigned long len)
 Print hex dump with specified display address.
void dbg_md5_da (unsigned long dispaddr, const void *data, unsigned long len)
 Print an MD5 checksum with specified display address.
void dbg_pause (void)
 Pause until a key is pressed.
void dbg_more (void)
 Indicate more data to follow and pause until a key is pressed.
char __debug_disable (OBJECT)
 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)

Detailed Description

Global compiler definitions.

This file is implicitly included by every .c file in Etherboot. It defines global macros such as DBG().

We arrange for each object to export the symbol obj_OBJECT (where OBJECT is the object name, e.g. rtl8139) as a global symbol, so that the linker can drag in selected object files from the library using -u obj_OBJECT .

Definition in file compiler.h.


Define Documentation

#define __attribute__ (   x)
#define _C1 (   x,
 
)    x ## y

Concatenate non-expanded arguments.

Definition at line 46 of file compiler.h.

#define _C2 (   x,
 
)    _C1 ( x, y )

Concatenate expanded arguments.

Definition at line 48 of file compiler.h.

#define _S1 (   x)    #x

Stringify non-expanded argument.

Definition at line 51 of file compiler.h.

#define _S2 (   x)    _S1 ( x )

Stringify expanded argument.

Definition at line 53 of file compiler.h.

Referenced by buildarch_fetch(), platform_fetch(), and xsigo_xds_complete().

#define PROGBITS_OPS   _S2 ( ASM_TCHAR_OPS ) "progbits"

Definition at line 60 of file compiler.h.

#define PROGBITS   _S2 ( ASM_TCHAR ) "progbits"

Definition at line 61 of file compiler.h.

#define NOBITS_OPS   _S2 ( ASM_TCHAR_OPS ) "nobits"

Definition at line 62 of file compiler.h.

#define NOBITS   _S2 ( ASM_TCHAR ) "nobits"

Definition at line 63 of file compiler.h.

#define ERRFILE   PREFIX_OBJECT ( ERRFILE_ )

Select file identifier for errno.h (if used)

Definition at line 207 of file compiler.h.

#define __weak   __attribute__ (( weak, noinline ))

Declare a function as weak (use *before* the definition)

Due to a bug in at least GCC 4.4.4 and earlier, weak symbols may be inlined if they have hidden visibility (see above for why hidden visibility is used). This results in the non-weak symbol never being used, so explicitly mark the function as noinline to prevent inlining.

Definition at line 219 of file compiler.h.

#define barrier ( )    __asm__ __volatile__ ( "" : : : "memory" )
#define ARRAY_SIZE (   array)    ( sizeof (array) / sizeof ( (array)[0] ) )

Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )