*/
+
+#define NEED_MEMSET 0
+#define NEED_MEMCPY 0
+#define NEED_MEMCMP 0
+#define NEED_STRLEN 0
+#define NEED_STRNLEN 0
+#define NEED_STRCMP 0
+#define NEED_STRNCMP 0
+#define NEED_STRCAT 0
+#define NEED_STRNCAT 0
+#define NEED_STRCPY 0
+#define NEED_STRNCPY 0
+#define NEED_STRDUP 0
+#define NEED_ATOI 0
+#define NEED_STRCHR 0
+#define NEED_STRRCHR 0
+#define NEED_STRPBRK 0
+
+
+
#include <palacios/vmm_string.h>
#include <palacios/vmm.h>
static float e = 0.00000001;
-double ceil(double x) {
- if ((double)(x - (int)x) == 0) {
- return (int)x;
- }
- return (int)(x + e) + 1;
+double v3_ceil(double x) {
+ if ((double)(x - (int)x) == 0) {
+ return (int)x;
+ }
+ return (int)(x + e) + 1;
}
-#if 0
+
+#if NEED_MEMSET
void* memset(void* s, int c, size_t n)
{
unsigned char* p = (unsigned char*) s;
return s;
}
+#endif
-
+#if NEED_MEMCPY
void* memcpy(void *dst, const void* src, size_t n)
{
unsigned char* d = (unsigned char*) dst;
return dst;
}
+#endif
+#if NEED_CMP
int memcmp(const void *s1_, const void *s2_, size_t n)
{
const signed char *s1 = s1_, *s2 = s2_;
return 0;
}
+#endif
+
+#if NEED_STRLEN
size_t strlen(const char* s)
{
size_t len = 0;
++len;
return len;
}
+#endif
+
+
+#if NEED_STRNLEN
/*
* This it a GNU extension.
* It is like strlen(), but it will check at most maxlen
++len;
return len;
}
+#endif
+
+#if NEED_STRCMP
int strcmp(const char* s1, const char* s2)
{
while (1) {
++s2;
}
}
+#endif
+
+#if NEED_STRNCMP
int strncmp(const char* s1, const char* s2, size_t limit)
{
size_t i = 0;
/* limit reached and equal */
return 0;
}
+#endif
+
+#if NEED_STRCAT
char *strcat(char *s1, const char *s2)
{
char *t1;
return t1;
}
+#endif
+
+
+#if NEED_STRNCAT
+char *strncat(char *s1, const char *s2, size_t limit)
+{
+ size_t i = 0;
+ char *t1;
+ t1 = s1;
+ while (*s1) s1++;
+ while (i < limit) {
+ if(*s2 == '\0') break;
+ *s1++ = *s2++;
+ }
+ *s1 = '\0';
+ return t1;
+}
+#endif
+
+
+#if NEED_STRCPY
char *strcpy(char *dest, const char *src)
{
char *ret = dest;
return ret;
}
+#endif
+
+#if NEED_STRNCPY
char *strncpy(char *dest, const char *src, size_t limit)
{
char *ret = dest;
return ret;
}
+#endif
+
+
+#if NEED_STRDUP
char *strdup(const char *s1)
{
char *ret;
return ret;
}
+#endif
+
+
+
+#if NEED_ATOI
int atoi(const char *buf)
{
int ret = 0;
while (*buf >= '0' && *buf <= '9') {
- ret *= 10;
- ret += *buf - '0';
- buf++;
+ ret *= 10;
+ ret += *buf - '0';
+ buf++;
}
return ret;
}
+#endif
+
+#if NEED_STRCHR
char *strchr(const char *s, int c)
{
while (*s != '\0') {
}
return 0;
}
+#endif
+
+#if NEED_STRRCHR
char *strrchr(const char *s, int c)
{
size_t len = strlen(s);
}
return 0;
}
+#endif
+#if NEED_STRPBRK
char *strpbrk(const char *s, const char *accept)
{
size_t setLen = strlen(accept);
return 0;
}
-
#endif
+