Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Cleanup of linkage issues for non-Linux hosts
Peter Dinda [Sun, 12 Jul 2015 21:50:03 +0000 (16:50 -0500)]
- minor asm fixes to allow -fPIC
- elimination of unneeded global
- conditional compilation of assorted string functions

Kconfig.stdlibs
palacios/include/palacios/vmm_lowlevel.h
palacios/include/palacios/vmx_lowlevel.h
palacios/src/palacios/vmm_hashtable.c
palacios/src/palacios/vmm_string.c

index 2d0dfb2..5c0c053 100644 (file)
@@ -128,6 +128,12 @@ config BUILT_IN_ATOI
        help 
          This enables Palacios' internal implementation of atoi
 
+config BUILT_IN_ATOX
+       bool "atox()"
+       depends on BUILT_IN_STDLIB
+       help 
+         This enables Palacios' internal implementation of atox
+
 config BUILT_IN_STRCHR
        bool "strchr()"
        default n
@@ -149,6 +155,34 @@ config BUILT_IN_STRPBRK
        help 
          This enables Palacios' internal implementation of strpbrk
 
+config BUILT_IN_STR_TOLOWER
+       bool "str_tolower()"
+       default n
+       depends on BUILT_IN_STDLIB
+       help 
+         This enables Palacios' internal implementation of str_tolower
+
+config BUILT_IN_STR_TOUPPER
+       bool "str_toupper()"
+       default n
+       depends on BUILT_IN_STDLIB
+       help 
+         This enables Palacios' internal implementation of str_toupper
+
+config BUILT_IN_STRTOI
+       bool "strtoi()"
+       default n
+       depends on BUILT_IN_STDLIB
+       help 
+         This enables Palacios' internal implementation of strtoi
+
+config BUILT_IN_STRTOX
+       bool "strtox()"
+       default n
+       depends on BUILT_IN_STDLIB
+       help 
+         This enables Palacios' internal implementation of strtox
+
 
 config BUILT_IN_STDIO
        bool "Enable Built in versions of stdio functions"
index af1f820..eec0d91 100644 (file)
@@ -70,9 +70,14 @@ static void __inline__ v3_cpuid(uint32_t target,
                                uint32_t * eax, uint32_t * ebx, 
                                uint32_t * ecx, uint32_t * edx) {
 #ifdef __V3_64BIT__
+    // avoid rbx on -FPIC - gcc likes to own rbx even on 64 bit PIC code
     __asm__ __volatile__ (
+                         "pushq %%rbx\n\t"
+                         "movq %%rdi, %%rbx\n\t"
                          "cpuid\n\t"
-                         : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
+                         "movq %%rbx, %%rdi\n\t"
+                         "popq %%rbx\n\t"
+                         : "=a" (*eax), "=D" (*ebx), "=c" (*ecx), "=d" (*edx)
                          : "0" (target), "2" (*ecx)
                          );
 #elif __V3_32BIT__
index fd63406..713875f 100644 (file)
@@ -205,22 +205,22 @@ static inline int vmx_off() {
 static inline int enable_vmx() {
 #ifdef __V3_64BIT__
     __asm__ __volatile__ (
-                         "movq %%cr4, %%rbx;"
-                         "orq  $0x00002000, %%rbx;"
-                         "movq %%rbx, %%cr4;"
+                         "movq %%cr4, %%rcx;"
+                         "orq  $0x00002000, %%rcx;"
+                         "movq %%rcx, %%cr4;"
                          : 
                          :
-                         : "%rbx"
+                         : "%rcx"
                          );
 
 
     __asm__ __volatile__ (
-                         "movq %%cr0, %%rbx; "
-                         "orq  $0x00000020,%%rbx; "
-                         "movq %%rbx, %%cr0;"
+                         "movq %%cr0, %%rcx; "
+                         "orq  $0x00000020,%%rcx; "
+                         "movq %%rcx, %%cr0;"
                          :
                          :
-                         : "%rbx"
+                         : "%rcx"
                          );
 #elif __V3_32BIT__
     __asm__ __volatile__ (
index 8400416..4d05215 100644 (file)
@@ -197,7 +197,7 @@ static const uint_t load_factors[] = {
     32715575, 65431158, 130862298, 261724573,
     523449198, 1046898282 };
 
-const uint_t prime_table_length = sizeof(primes) / sizeof(primes[0]);
+static const uint_t prime_table_length = sizeof(primes) / sizeof(primes[0]);
 
 
 
index 01c408c..7950934 100644 (file)
@@ -320,6 +320,7 @@ int atoi(const char * buf) {
 #endif
 
 
+#ifdef V3_CONFIG_BUILT_IN_STRTOI
 int strtoi(const char * nptr, char ** endptr) {
     int ret = 0;
     char * buf = (char *)nptr;
@@ -337,7 +338,9 @@ int strtoi(const char * nptr, char ** endptr) {
 
     return ret;
 }
+#endif
 
+#ifdef V3_CONFIG_BUILT_IN_ATOX
 uint64_t atox(const char * buf) {
     uint64_t ret = 0;
 
@@ -359,7 +362,9 @@ uint64_t atox(const char * buf) {
 
     return ret;
 }
+#endif
 
+#ifdef V3_CONFIG_BUILT_IN_STRTOX
 uint64_t strtox(const char * nptr, char ** endptr) {
     uint64_t ret = 0;
     char * buf = (char *)nptr;
@@ -387,7 +392,7 @@ uint64_t strtox(const char * nptr, char ** endptr) {
     return ret;
 
 }
-
+#endif
 
 
 #ifdef V3_CONFIG_BUILT_IN_STRCHR
@@ -505,7 +510,7 @@ char *strstr(const char *haystack, const char *needle)
 }
 #endif
 
-
+#ifdef V3_CONFIG_BUILT_IN_STR_TOLOWER
 void str_tolower(char * s) {
     while (isalpha(*s)) {
        if (!islower(*s)) {
@@ -514,8 +519,9 @@ void str_tolower(char * s) {
        s++;
     }
 }
+#endif
 
-
+#ifdef V3_CONFIG_BUILT_IN_STR_TOUPPER
 void str_toupper(char * s) {
     while (isalpha(*s)) {
        if (!isupper(*s)) {
@@ -524,3 +530,4 @@ void str_toupper(char * s) {
        s++;
     }
 }
+#endif