From a4250b231c8527c669c0395db69bd83cf71e9065 Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Tue, 3 Nov 2020 20:17:04 +0000 Subject: Rename FreeStanding to Freestanding where appropriate --- runtime/CMakeLists.txt | 4 +-- runtime/FreeStanding/CMakeLists.txt | 21 --------------- runtime/FreeStanding/memcmp.c | 53 ------------------------------------- runtime/FreeStanding/memcpy.c | 19 ------------- runtime/FreeStanding/memmove.c | 30 --------------------- runtime/FreeStanding/memset.c | 17 ------------ runtime/Freestanding/CMakeLists.txt | 21 +++++++++++++++ runtime/Freestanding/memcmp.c | 53 +++++++++++++++++++++++++++++++++++++ runtime/Freestanding/memcpy.c | 19 +++++++++++++ runtime/Freestanding/memmove.c | 30 +++++++++++++++++++++ runtime/Freestanding/memset.c | 17 ++++++++++++ 11 files changed, 142 insertions(+), 142 deletions(-) delete mode 100644 runtime/FreeStanding/CMakeLists.txt delete mode 100644 runtime/FreeStanding/memcmp.c delete mode 100644 runtime/FreeStanding/memcpy.c delete mode 100644 runtime/FreeStanding/memmove.c delete mode 100644 runtime/FreeStanding/memset.c create mode 100644 runtime/Freestanding/CMakeLists.txt create mode 100644 runtime/Freestanding/memcmp.c create mode 100644 runtime/Freestanding/memcpy.c create mode 100644 runtime/Freestanding/memmove.c create mode 100644 runtime/Freestanding/memset.c (limited to 'runtime') diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 327f5407..52f4e766 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -85,12 +85,12 @@ foreach (_suffix ${LIB_BC_SUFFIX}) list(APPEND "LIB_BC_FLAGS_${_suffix}" ${COMMON_CC_FLAGS}) endforeach () -add_subdirectory(FreeStanding) +add_subdirectory(Freestanding) add_subdirectory(Intrinsic) add_subdirectory(klee-libc) set(RUNTIME_LIBRARIES - RuntimeFreeStanding + RuntimeFreestanding RuntimeIntrinsic RuntimeKLEELibc ) diff --git a/runtime/FreeStanding/CMakeLists.txt b/runtime/FreeStanding/CMakeLists.txt deleted file mode 100644 index cf558a7d..00000000 --- a/runtime/FreeStanding/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -#===------------------------------------------------------------------------===# -# -# The KLEE Symbolic Virtual Machine -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -#===------------------------------------------------------------------------===# - -set(LIB_PREFIX "RuntimeFreeStanding") -set(SRC_FILES - memcmp.c - memcpy.c - memmove.c - memset.c - ) - -# Build it -include("${CMAKE_SOURCE_DIR}/cmake/compile_bitcode_library.cmake") -prefix_with_path("${SRC_FILES}" "${CMAKE_CURRENT_SOURCE_DIR}/" prefixed_files) -add_bitcode_library_targets("${LIB_PREFIX}" "${prefixed_files}" "" "") \ No newline at end of file diff --git a/runtime/FreeStanding/memcmp.c b/runtime/FreeStanding/memcmp.c deleted file mode 100644 index 566daf48..00000000 --- a/runtime/FreeStanding/memcmp.c +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -/* - * Compare memory regions. - */ -int memcmp(const void *s1, const void *s2, size_t n) { - if (n != 0) { - const unsigned char *p1 = s1, *p2 = s2; - - do { - if (*p1++ != *p2++) { - return (*--p1 - *--p2); - } - } while (--n != 0); - } - return (0); -} diff --git a/runtime/FreeStanding/memcpy.c b/runtime/FreeStanding/memcpy.c deleted file mode 100644 index c7c6e6d3..00000000 --- a/runtime/FreeStanding/memcpy.c +++ /dev/null @@ -1,19 +0,0 @@ -/*===-- memcpy.c ----------------------------------------------------------===// -// -// The KLEE Symbolic Virtual Machine -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===*/ - -#include - -void *memcpy(void *destaddr, void const *srcaddr, size_t len) { - char *dest = destaddr; - char const *src = srcaddr; - - while (len-- > 0) - *dest++ = *src++; - return destaddr; -} diff --git a/runtime/FreeStanding/memmove.c b/runtime/FreeStanding/memmove.c deleted file mode 100644 index ee0e53ae..00000000 --- a/runtime/FreeStanding/memmove.c +++ /dev/null @@ -1,30 +0,0 @@ -/*===-- 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 - -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; -} diff --git a/runtime/FreeStanding/memset.c b/runtime/FreeStanding/memset.c deleted file mode 100644 index b439001e..00000000 --- a/runtime/FreeStanding/memset.c +++ /dev/null @@ -1,17 +0,0 @@ -/*===-- memset.c ----------------------------------------------------------===// -// -// The KLEE Symbolic Virtual Machine -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===*/ - -#include - -void *memset(void *dst, int s, size_t count) { - char *a = dst; - while (count-- > 0) - *a++ = s; - return dst; -} diff --git a/runtime/Freestanding/CMakeLists.txt b/runtime/Freestanding/CMakeLists.txt new file mode 100644 index 00000000..872a4f05 --- /dev/null +++ b/runtime/Freestanding/CMakeLists.txt @@ -0,0 +1,21 @@ +#===------------------------------------------------------------------------===# +# +# The KLEE Symbolic Virtual Machine +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +#===------------------------------------------------------------------------===# + +set(LIB_PREFIX "RuntimeFreestanding") +set(SRC_FILES + memcmp.c + memcpy.c + memmove.c + memset.c + ) + +# Build it +include("${CMAKE_SOURCE_DIR}/cmake/compile_bitcode_library.cmake") +prefix_with_path("${SRC_FILES}" "${CMAKE_CURRENT_SOURCE_DIR}/" prefixed_files) +add_bitcode_library_targets("${LIB_PREFIX}" "${prefixed_files}" "" "") \ No newline at end of file diff --git a/runtime/Freestanding/memcmp.c b/runtime/Freestanding/memcmp.c new file mode 100644 index 00000000..566daf48 --- /dev/null +++ b/runtime/Freestanding/memcmp.c @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +/* + * Compare memory regions. + */ +int memcmp(const void *s1, const void *s2, size_t n) { + if (n != 0) { + const unsigned char *p1 = s1, *p2 = s2; + + do { + if (*p1++ != *p2++) { + return (*--p1 - *--p2); + } + } while (--n != 0); + } + return (0); +} diff --git a/runtime/Freestanding/memcpy.c b/runtime/Freestanding/memcpy.c new file mode 100644 index 00000000..c7c6e6d3 --- /dev/null +++ b/runtime/Freestanding/memcpy.c @@ -0,0 +1,19 @@ +/*===-- memcpy.c ----------------------------------------------------------===// +// +// The KLEE Symbolic Virtual Machine +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===*/ + +#include + +void *memcpy(void *destaddr, void const *srcaddr, size_t len) { + char *dest = destaddr; + char const *src = srcaddr; + + while (len-- > 0) + *dest++ = *src++; + return destaddr; +} 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 + +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; +} diff --git a/runtime/Freestanding/memset.c b/runtime/Freestanding/memset.c new file mode 100644 index 00000000..b439001e --- /dev/null +++ b/runtime/Freestanding/memset.c @@ -0,0 +1,17 @@ +/*===-- memset.c ----------------------------------------------------------===// +// +// The KLEE Symbolic Virtual Machine +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===*/ + +#include + +void *memset(void *dst, int s, size_t count) { + char *a = dst; + while (count-- > 0) + *a++ = s; + return dst; +} -- cgit 1.4.1