source: soft/giet_vm/libs/utils.c @ 241

Last change on this file since 241 was 228, checked in by meunier, 12 years ago

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 size: 1.3 KB
RevLine 
[189]1
2////////////////////////////////////////////////////////////////////////////////////////
3//  mempcy()
4// GCC requires this function. Taken from MutekH.
5////////////////////////////////////////////////////////////////////////////////////////
[228]6void * memcpy(void *_dst, const void * _src, unsigned int size) {
7    unsigned int * dst = _dst;
8    const unsigned int * src = _src;
9    if (!((unsigned int) dst & 3) && ! ((unsigned int) src & 3) ) {
[189]10        while (size > 3) {
11            *dst++ = *src++;
12            size -= 4;
13        }
[228]14    }
[189]15
[228]16    unsigned char * cdst = (unsigned char *) dst;
17    unsigned char * csrc = (unsigned char *) src;
[189]18
19    while (size--) {
20        *cdst++ = *csrc++;
21    }
22    return _dst;
23}
24
[228]25
[189]26////////////////////////////////////////////////////////////////////////////////////////
27//  memset()
28// GCC requires this function. Taken from MutekH.
29////////////////////////////////////////////////////////////////////////////////////////
[228]30void * memset(void * dst, int s, unsigned int count) {
31    char * a = (char *) dst;
32    while (count--) {
33        *a++ = (char) s;
34    }
35    return dst;
[189]36}
[228]37
38
39// Local Variables:
40// tab-width: 4
41// c-basic-offset: 4
42// c-file-offsets:((innamespace . 0)(inline-open . 0))
43// indent-tabs-mode: nil
44// End:
45// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
46
Note: See TracBrowser for help on using the repository browser.