diff options
author | Martin Nowack <martin.nowack@gmail.com> | 2018-05-15 15:10:16 +0100 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2018-07-04 15:13:02 +0100 |
commit | 6803c37be83f0c97c95870a18cb230e135a131c9 (patch) | |
tree | e42ae967f248014aa392ac1a985fc5a39203c789 /runtime/FreeStanding/memmove.c | |
parent | b25705f4d9cfdb4a7f9ecc4565cb31623f7bd38d (diff) | |
download | klee-6803c37be83f0c97c95870a18cb230e135a131c9.tar.gz |
Reorganise runtime libraries provided by KLEE
Strictly differentiate between the following type of libraries: * FreeStanding: contains minimal amount of methods a compiler would expect * klee-libc: contains a minimal libc implementation * POSIX: contains a POSIX layer that can be used on top of a libc implementation * Intrinsic: contains additional runtime functions which provide KLEE-specific functionalities, (e.g. checks) Builds always archives instead of single modules. This allows to reduce linked-in dependencies of tested applications.
Diffstat (limited to 'runtime/FreeStanding/memmove.c')
-rw-r--r-- | runtime/FreeStanding/memmove.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/runtime/FreeStanding/memmove.c b/runtime/FreeStanding/memmove.c new file mode 100644 index 00000000..ee0e53ae --- /dev/null +++ b/runtime/FreeStanding/memmove.c @@ -0,0 +1,30 @@ +/*===-- memmove.c ---------------------------------------------------------===// +// +// The KLEE Symbolic Virtual Machine +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===*/ + +#include <stdlib.h> + +void *memmove(void *dst, const void *src, size_t count) { + char *a = dst; + const char *b = src; + + if (src == dst) + return dst; + + if (src > dst) { + while (count--) + *a++ = *b++; + } else { + a += count - 1; + b += count - 1; + while (count--) + *a-- = *b--; + } + + return dst; +} |