Ignore:
Timestamp:
Feb 12, 2013, 6:33:31 PM (11 years ago)
Author:
meunier
Message:

Added support for memspaces and const.
Added an interrupt masking to the "giet_context_switch" syscall
Corrected two bugs in boot/boot_init.c (one minor and one regarding barriers initialization)
Reformatted the code in all files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/libs/common.h

    r178 r228  
    1616 */
    1717//////////////////////////////////////////////////////////////////////////
    18 static inline void *memcpy(void *_dst, const void *_src, unsigned int size)
    19 {
    20     unsigned int *dst = _dst;
    21     const unsigned int *src = _src;
     18static inline void * memcpy(void * _dst, const void * _src, unsigned int size) {
     19    unsigned int * dst = _dst;
     20    const unsigned int * src = _src;
    2221
    2322    /* if source and destination buffer are word-aligned,
    2423     * then copy word-by-word */
    25     if (!((unsigned int)dst & 3) && !((unsigned int)src & 3))
     24    if (!((unsigned int)dst & 3) && !((unsigned int)src & 3)) {
    2625        while (size > 3) {
    2726            *dst++ = *src++;
    2827            size -= 4;
    2928        }
     29    }
    3030
    31     unsigned char *cdst = (unsigned char*)dst;
    32     unsigned char *csrc = (unsigned char*)src;
     31    unsigned char * cdst = (unsigned char *) dst;
     32    unsigned char * csrc = (unsigned char *) src;
    3333
    3434    /* byte-by-byte copy */
     
    3939}
    4040
     41
    4142//////////////////////////////////////////////////////////
    42 static inline void * memset(void *dst, int s, unsigned int count)
    43 {
    44         char *a = (char *) dst;
    45         while (count--)
    46                 *a++ = (char)s;
    47         return dst;
     43static inline void * memset(void * dst, int s, unsigned int count) {
     44    char * a = (char *) dst;
     45    while (count--) {
     46        *a++ = (char) s;
     47    }
     48    return dst;
    4849}
    4950
     51
    5052/**
    51    the same as the C assert.
    52    Taken from Mutekh(SRL API)
    53  */
    54 #define assert(expr)                                                                                                \
    55     do {                                                                                                                                \
    56         if ( ! (expr) ) {                                                                                               \
     53  the same as the C assert.
     54  Taken from Mutekh(SRL API)
     55  */
     56#define assert(expr)                                                    \
     57    do {                                                                \
     58        if ( ! (expr) ) {                                                \
    5759            giet_tty_printf("assertion (%s) failed on %s:%d !\n",  \
    58                                                    #expr, __FILE__, __LINE__ );                                 \
    59             __abort();                                                                                          \
    60         }                                                                                                                               \
     60#expr, __FILE__, __LINE__ );                    \
     61            __abort();                                                \
     62        }                                                                \
    6163    } while(0)
    6264
    6365/**
    64    @this aborts the current execution.
    65    Taken from Mutekh(SRL API)
    66  */
    67 static inline void __abort()
    68 {
    69         asm volatile ("break 0");
    70         while(1);
     66  @this aborts the current execution.
     67  Taken from Mutekh(SRL API)
     68  */
     69static inline void __abort() {
     70    asm volatile ("break 0");
     71    while (1);
    7172}
    7273
    7374#endif /* _COMMON_H_ */
     75
     76
     77// Local Variables:
     78// tab-width: 4
     79// c-basic-offset: 4
     80// c-file-offsets:((innamespace . 0)(inline-open . 0))
     81// indent-tabs-mode: nil
     82// End:
     83// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
     84
Note: See TracChangeset for help on using the changeset viewer.