source: soft/giet_vm/libs/common.h @ 176

Last change on this file since 176 was 176, checked in by karaoui, 12 years ago

abort() in libs/common.h is now a static inline function.

File size: 1.4 KB
Line 
1//////////////////////////////////////////////////////////////////////////////////
2// File     : common.h         
3// Date     : 20/07/2012
4// Author   : mohamed karaoui
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
7
8#ifndef _COMMON_H_
9#define _COMMON_H_
10
11/**
12   the same as the C assert.
13   Taken from Mutekh(SRL API)
14 */
15#define assert(expr)                                                                                                \
16    do {                                                                                                                                \
17        if ( ! (expr) ) {                                                                                               \
18            giet_tty_printf("assertion (%s) failed on %s:%d !\n",  \
19                                                   #expr, __FILE__, __LINE__ );                                 \
20            __abort();                                                                                          \
21        }                                                                                                                               \
22    } while(0)
23
24/**
25   @this aborts the current execution.
26   Taken from Mutekh(SRL API)
27 */
28
29static inline void __abort()
30{
31        asm volatile ("break 0");
32        while(1);
33}
34
35////////////////////////////////////////////////////////////////////////////////////////
36//  mempcy()
37// GCC may requires this function. Taken from MutekH.
38////////////////////////////////////////////////////////////////////////////////////////
39void *memcpy(void *_dst, const void *_src, unsigned int size);
40
41////////////////////////////////////////////////////////////////////////////////////////
42//  memset()
43// GCC may requires this function. Taken from MutekH.
44////////////////////////////////////////////////////////////////////////////////////////
45inline void * memset(void *dst, int s, unsigned int count);
46
47#endif /* _COMMON_H_ */
Note: See TracBrowser for help on using the repository browser.