Loading...
Searching...
No Matches
Basic Macros
Base API

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

Collaboration diagram for Basic Macros:

## Files

file | linkage.h
| Linkage.
file | linkage.h
| Linkage.
file | linkage.h
| Linkage.

## Macros

#define | L4_INLINE
| L4 Inline function attribute.
#define | L4_ALWAYS_INLINE
| Always inline a function.
#define | L4_BEGIN_DECLS
| Start section with C types and functions.
#define | L4_END_DECLS
| End section with 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_CONSTEXPR
| Constexpr function attribute.
#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.
#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>
  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
L4_EXPORT
#define L4_EXPORT
Attribute to mark functions, variables, and data types as being exported from a library.
Definition compiler.h:214

Definition at line 214 of file compiler.h.

Referenced by l4io_iterate_devices(), l4io_lookup_device(), l4io_lookup_resource(), l4io_release_iomem(), l4io_release_ioport(), l4io_request_all_ioports(), l4io_request_icu(), l4io_request_iomem(), l4io_request_iomem_region(), l4io_request_ioport(), l4io_request_resource_iomem(), l4re_inhibitor_acquire(), and l4re_inhibitor_release().

## 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
L4_HIDDEN
#define L4_HIDDEN
Attribute to mark functions, variables, and data types as being explicitly hidden from users of a lib...
Definition compiler.h:211

Definition at line 211 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;
}
L4_NOTHROW
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:161

Definition at line 161 of file compiler.h.

Referenced by __kdebug_3_text(), __kdebug_op(), __kdebug_op_1(), __kdebug_text(), enter_kdebug(), l4_msgtag_t::flags(), l4_msgtag_t::has_error(), l4_msgtag_t::is_exception(), l4_msgtag_t::is_io_page_fault(), l4_msgtag_t::is_page_fault(), l4_msgtag_t::is_sigma0(), l4_msgtag_t::items(), l4_arm_smccc_call(), l4_bytes_to_mwords(), l4_cache_clean_data(), l4_cache_coherent(), l4_cache_dma_coherent(), l4_cache_dma_coherent_full(), l4_cache_flush_data(), l4_cache_inv_data(), l4_capability_equal(), l4_capability_next(), l4_debugger_add_image_info(), l4_debugger_get_object_name(), l4_debugger_global_id(), l4_debugger_kobj_to_id(), l4_debugger_query_log_name(), l4_debugger_query_log_typeid(), l4_debugger_query_obj_infos(), l4_debugger_set_object_name(), l4_debugger_switch_log(), l4_error(), l4_factory_create(), l4_factory_create_factory(), l4_factory_create_gate(), l4_factory_create_irq(), l4_factory_create_task(), l4_factory_create_thread(), l4_factory_create_thread_group(), l4_factory_create_vcpu_context(), l4_factory_create_vm(), l4_fpage(), l4_fpage_all(), l4_fpage_contains(), l4_fpage_invalid(), l4_fpage_ioport(), l4_fpage_memaddr(), l4_fpage_obj(), l4_fpage_page(), l4_fpage_rights(), l4_fpage_set_rights(), l4_fpage_size(), l4_fpage_type(), l4_icu_bind(), l4_icu_bind_u(), l4_icu_info(), l4_icu_info_u(), l4_icu_mask(), l4_icu_mask_u(), l4_icu_msi_info(), l4_icu_msi_info_u(), l4_icu_set_mode(), l4_icu_set_mode_u(), l4_icu_unbind(), l4_icu_unbind_u(), l4_icu_unmask(), l4_icu_unmask_u(), l4_iofpage(), l4_ipc(), l4_ipc(), l4_ipc_call(), l4_ipc_error(), l4_ipc_error_code(), l4_ipc_is_rcv_error(), l4_ipc_is_snd_error(), l4_ipc_receive(), l4_ipc_reply_and_wait(), l4_ipc_send(), l4_ipc_send_and_wait(), l4_ipc_sleep(), l4_ipc_sleep_ms(), l4_ipc_sleep_us(), l4_ipc_timeout(), l4_ipc_to_errno(), l4_ipc_wait(), l4_irq_bind_vcpu(), l4_irq_bind_vcpu_u(), l4_irq_detach(), l4_irq_detach_u(), l4_irq_receive(), l4_irq_receive_u(), l4_irq_trigger(), l4_irq_trigger_u(), l4_irq_unmask(), l4_irq_unmask_u(), l4_irq_wait(), l4_irq_wait_u(), l4_is_fpage_valid(), l4_is_fpage_writable(), l4_is_invalid_cap(), l4_is_valid_cap(), l4_kernel_info_get_mem_desc_end(), l4_kernel_info_get_mem_desc_is_virtual(), l4_kernel_info_get_mem_desc_start(), l4_kernel_info_get_mem_desc_subtype(), l4_kernel_info_get_mem_desc_type(), l4_kernel_info_get_mem_descs(), l4_kernel_info_get_num_mem_descs(), l4_kernel_info_set_mem_desc(), l4_kernel_info_version_offset(), l4_kip(), l4_kip_clock(), l4_kip_clock_lw(), l4_kip_clock_ns(), l4_kip_version(), l4_kip_version_string(), l4_map_control(), l4_map_obj_control(), l4_msgtag(), l4_msgtag_flags(), l4_msgtag_has_error(), l4_msgtag_is_exception(), l4_msgtag_is_io_page_fault(), l4_msgtag_is_page_fault(), l4_msgtag_is_sigma0(), l4_msgtag_items(), l4_msgtag_label(), l4_msgtag_words(), l4_obj_fpage(), l4_platform_ctl_cpu_allow_shutdown(), l4_platform_ctl_cpu_disable(), l4_platform_ctl_cpu_enable(), l4_platform_ctl_set_task_asid(), l4_platform_ctl_system_shutdown(), l4_platform_ctl_system_suspend(), l4_rcv_timeout(), l4_round_page(), l4_round_size(), l4_sched_cpu_set(), l4_sched_param(), l4_scheduler_idle_time(), l4_scheduler_info(), l4_scheduler_info_with_classes(), l4_scheduler_is_online(), l4_scheduler_run_thread(), l4_semaphore_down(), l4_semaphore_up(), l4_sleep(), l4_sleep_forever(), l4_snd_timeout(), l4_sndfpage_add(), l4_task_add_ku_mem(), l4_task_cap_equal(), l4_task_cap_valid(), l4_task_delete_obj(), l4_task_map(), l4_task_release_cap(), l4_task_unmap(), l4_task_unmap_batch(), l4_task_vgicc_map(), l4_thread_arm_set_tpidruro(), l4_thread_control_alien(), l4_thread_control_bind(), l4_thread_control_commit(), l4_thread_control_exc_handler(), l4_thread_control_pager(), l4_thread_control_start(), l4_thread_ex_regs(), l4_thread_ex_regs_ret(), l4_thread_ex_regs_ret_u(), l4_thread_ex_regs_u(), l4_thread_group_add(), l4_thread_group_remove(), l4_thread_modify_sender_add(), l4_thread_modify_sender_commit(), l4_thread_modify_sender_start(), l4_thread_register_del_irq(), l4_thread_register_doorbell_irq(), l4_thread_stats_time(), l4_thread_switch(), l4_thread_vcpu_control(), l4_thread_vcpu_control_ext(), l4_thread_vcpu_control_ext_u(), l4_thread_vcpu_control_u(), l4_thread_vcpu_resume_commit(), l4_thread_vcpu_resume_start(), l4_thread_yield(), l4_timeout(), l4_timeout_abs(), l4_timeout_get(), l4_timeout_is_absolute(), l4_timeout_rel(), l4_timeout_rel_get(), l4_touch_ro(), l4_touch_rw(), l4_trunc_page(), l4_trunc_size(), l4_usleep(), l4_utcb(), l4_utcb_br(), l4_utcb_exc(), l4_utcb_exc_is_ex_regs_exception(), l4_utcb_exc_is_ex_regs_exception(), l4_utcb_exc_is_pf(), l4_utcb_exc_is_pf(), l4_utcb_exc_pc(), l4_utcb_exc_pc(), l4_utcb_exc_pc_set(), l4_utcb_exc_pfa(), l4_utcb_exc_pfa(), l4_utcb_exc_typeval(), l4_utcb_exc_typeval(), l4_utcb_inherit_fpu(), l4_utcb_mr(), l4_utcb_mr64_idx(), l4_utcb_tcr(), l4_vcon_get_attr(), l4_vcon_get_attr_u(), l4_vcon_read(), l4_vcon_read_u(), l4_vcon_read_with_flags(), l4_vcon_send(), l4_vcon_send_u(), l4_vcon_set_attr(), l4_vcon_set_attr_raw(), l4_vcon_set_attr_u(), l4_vcon_write(), l4_vcon_write_u(), l4_vcpu_check_version(), l4_vm_vmx_clear(), l4_vm_vmx_field_len(), l4_vm_vmx_field_order(), l4_vm_vmx_get_caps(), l4_vm_vmx_get_caps_default1(), l4_vm_vmx_get_cr2_index(), l4_vm_vmx_get_hw_vmcs(), l4_vm_vmx_ptr_load(), l4_vm_vmx_read(), l4_vm_vmx_read_16(), l4_vm_vmx_read_32(), l4_vm_vmx_read_64(), l4_vm_vmx_read_nat(), l4_vm_vmx_set_hw_vmcs(), l4_vm_vmx_write(), l4_vm_vmx_write_16(), l4_vm_vmx_write_32(), l4_vm_vmx_write_64(), l4_vm_vmx_write_nat(), l4re_debug_obj_debug(), l4re_dma_space_associate(), l4re_dma_space_map(), l4re_dma_space_unmap(), l4re_ds_allocate(), l4re_ds_clear(), l4re_ds_copy_in(), l4re_ds_flags(), l4re_ds_info(), l4re_ds_map_info(), l4re_ds_size(), l4re_env(), l4re_env_cap_entry_t::l4re_env_cap_entry_t(), l4re_env_cap_entry_t::l4re_env_cap_entry_t(), l4re_env_get_cap(), l4re_env_get_cap_e(), l4re_env_get_cap_l(), l4re_event_get_axis_info(), l4re_event_get_buffer(), l4re_event_get_num_streams(), l4re_event_get_stream_info(), l4re_event_get_stream_info_for_id(), l4re_kip(), l4re_log_print(), l4re_log_print_srv(), l4re_log_printn(), l4re_log_printn_srv(), l4re_ma_alloc(), l4re_ma_alloc_align(), l4re_ma_alloc_align_srv(), l4re_ns_query_srv(), l4re_ns_query_to_srv(), l4re_ns_register_obj_srv(), l4re_rm_attach(), l4re_rm_attach_srv(), l4re_rm_detach(), l4re_rm_detach_ds(), l4re_rm_detach_ds_unmap(), l4re_rm_detach_srv(), l4re_rm_detach_unmap(), l4re_rm_find(), l4re_rm_find_srv(), l4re_rm_free_area(), l4re_rm_free_area_srv(), l4re_rm_get_info(), l4re_rm_get_info_srv(), l4re_rm_reserve_area(), l4re_rm_reserve_area_srv(), l4re_rm_show_lists(), l4re_rm_show_lists_srv(), l4re_util_cap_alloc(), l4re_util_cap_free(), l4re_util_cap_free_um(), l4re_util_cap_last(), l4re_util_kumem_alloc(), l4re_video_goos_create_buffer(), l4re_video_goos_create_view(), l4re_video_goos_delete_buffer(), l4re_video_goos_delete_view(), l4re_video_goos_get_static_buffer(), l4re_video_goos_get_view(), l4re_video_goos_info(), l4re_video_goos_refresh(), l4re_video_view_get_info(), l4re_video_view_refresh(), l4re_video_view_set_info(), l4re_video_view_set_viewport(), l4re_video_view_stack(), l4util_micros2l4to(), l4vcpu_ext_alloc(), l4vcpu_irq_disable(), l4vcpu_irq_disable_save(), l4vcpu_irq_enable(), l4vcpu_irq_restore(), l4vcpu_is_irq_entry(), l4vcpu_is_page_fault_entry(), l4vcpu_print_state(), l4vcpu_wait_for_event(), l4virtio_config_queue(), l4virtio_device_config_ds(), l4virtio_device_notification_irq(), l4virtio_register_ds(), l4virtio_set_status(), l4_msgtag_t::label(), l4_msgtag_t::label(), and l4_msgtag_t::words().

## 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 273 of file compiler.h.

References L4_INLINE.

## 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 347 of file compiler.h.

References l4_barrier(), L4_INLINE, and L4_NORETURN.

Here is the call graph for this function: