summaryrefslogtreecommitdiff
path: root/arch/x86/machine
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/machine')
-rw-r--r--arch/x86/machine/param.h11
-rw-r--r--arch/x86/machine/string.c30
-rw-r--r--arch/x86/machine/string.h32
3 files changed, 47 insertions, 26 deletions
diff --git a/arch/x86/machine/param.h b/arch/x86/machine/param.h
index 6ee11cce..557bc800 100644
--- a/arch/x86/machine/param.h
+++ b/arch/x86/machine/param.h
@@ -52,17 +52,6 @@
#define __read_mostly __section(".data.read_mostly")
/*
- * Provide architecture-specific string functions.
- */
-#define ARCH_STRING_MEMCPY
-#define ARCH_STRING_MEMMOVE
-#define ARCH_STRING_MEMSET
-#define ARCH_STRING_MEMCMP
-#define ARCH_STRING_STRLEN
-#define ARCH_STRING_STRCPY
-#define ARCH_STRING_STRCMP
-
-/*
* System timer frequency.
*
* The selected value of 200 translates to a period of 5ms, small enough to
diff --git a/arch/x86/machine/string.c b/arch/x86/machine/string.c
index 10d9ee0a..1f1cab40 100644
--- a/arch/x86/machine/string.c
+++ b/arch/x86/machine/string.c
@@ -18,9 +18,9 @@
#include <stddef.h>
#include <string.h>
-#include <kern/param.h>
+#include <machine/string.h>
-#ifdef ARCH_STRING_MEMCPY
+#ifdef STRING_ARCH_MEMCPY
void *
memcpy(void *dest, const void *src, size_t n)
{
@@ -32,9 +32,9 @@ memcpy(void *dest, const void *src, size_t n)
: : "memory");
return orig_dest;
}
-#endif /* ARCH_STRING_MEMCPY */
+#endif /* STRING_ARCH_MEMCPY */
-#ifdef ARCH_STRING_MEMMOVE
+#ifdef STRING_ARCH_MEMMOVE
void *
memmove(void *dest, const void *src, size_t n)
{
@@ -56,9 +56,9 @@ memmove(void *dest, const void *src, size_t n)
return orig_dest;
}
-#endif /* ARCH_STRING_MEMMOVE */
+#endif /* STRING_ARCH_MEMMOVE */
-#ifdef ARCH_STRING_MEMSET
+#ifdef STRING_ARCH_MEMSET
void *
memset(void *s, int c, size_t n)
{
@@ -71,9 +71,9 @@ memset(void *s, int c, size_t n)
: "memory");
return orig_s;
}
-#endif /* ARCH_STRING_MEMSET */
+#endif /* STRING_ARCH_MEMSET */
-#ifdef ARCH_STRING_MEMCMP
+#ifdef STRING_ARCH_MEMCMP
int
memcmp(const void *s1, const void *s2, size_t n)
{
@@ -90,9 +90,9 @@ memcmp(const void *s1, const void *s2, size_t n)
c2 = *(((const unsigned char *)s2) - 1);
return (int)c1 - (int)c2;
}
-#endif /* ARCH_STRING_MEMCMP */
+#endif /* STRING_ARCH_MEMCMP */
-#ifdef ARCH_STRING_STRLEN
+#ifdef STRING_ARCH_STRLEN
size_t
strlen(const char *s)
{
@@ -105,9 +105,9 @@ strlen(const char *s)
: "memory");
return ~n - 1;
}
-#endif /* ARCH_STRING_STRLEN */
+#endif /* STRING_ARCH_STRLEN */
-#ifdef ARCH_STRING_STRCPY
+#ifdef STRING_ARCH_STRCPY
char *
strcpy(char *dest, const char *src)
{
@@ -123,9 +123,9 @@ strcpy(char *dest, const char *src)
: : "al", "memory");
return orig_dest;
}
-#endif /* ARCH_STRING_STRCPY */
+#endif /* STRING_ARCH_STRCPY */
-#ifdef ARCH_STRING_STRCMP
+#ifdef STRING_ARCH_STRCMP
int
strcmp(const char *s1, const char *s2)
{
@@ -144,4 +144,4 @@ strcmp(const char *s1, const char *s2)
c2 = *(((const unsigned char *)s2) - 1);
return (int)c1 - (int)c2;
}
-#endif /* ARCH_STRING_STRCMP */
+#endif /* STRING_ARCH_STRCMP */
diff --git a/arch/x86/machine/string.h b/arch/x86/machine/string.h
new file mode 100644
index 00000000..d57bb24e
--- /dev/null
+++ b/arch/x86/machine/string.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2017 Richard Braun.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _X86_STRING_H
+#define _X86_STRING_H
+
+/*
+ * Provide architecture-specific string functions.
+ */
+#define STRING_ARCH_MEMCPY
+#define STRING_ARCH_MEMMOVE
+#define STRING_ARCH_MEMSET
+#define STRING_ARCH_MEMCMP
+#define STRING_ARCH_STRLEN
+#define STRING_ARCH_STRCPY
+#define STRING_ARCH_STRCMP
+
+#endif /* _X86_STRING_H */