Porting Guide (libtest)

From liblfds.org
Revision as of 15:56, 1 April 2018 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


To permit libtest to work on a range of platforms a porting abstraction layer has been written. Porting simply involves implementing the porting abstraction layer; the library will then compile and work. Implementation involves providing values to a small set defines, macros and typedefs and implementing one or two functions.

The Porting Abstraction Layer

The porting abstraction layer consists of three header files and three C files, thus;

        │   └───libtest
        │       ├───libtest_porting_abstraction_layer_compiler.h
        │       └───libtest_porting_abstraction_layer_operating_system.h

Each header file uses #ifdefs and compiler defined macros to select the appropriate porting abstraction layer implementation for the local platform.

Accordingly, to add a new platform, introduce a new #ifdef, which matches the appropriate compiler defined macros for your platform.

The abstraction layer for libtest seems much larger than it is. Most of it is optional or invariant. The only actually vital function is libtest_pal_get_full_logical_processor_set.


#define LIBTEST_PAL_LOAD_LINKED( destination, source )
#define LIBTEST_PAL_STORE_CONDITIONAL( destination, source, stored_flag )



Additionally, in this file, include any needed OS provided header files. Currently, stdlib.h and time.h are required and because of this, libtest requires a hosted implementation. This will be fixed in an upcoming release.


void libtest_pal_free( void *memory );


void libtest_pal_get_full_logical_processor_set( struct lfds711_list_asu_state *lasus,
                                                 struct libshared_memory_state *ms );


void *libtest_pal_malloc( size_t size );

See Also