vkernel64: Add bug workaround.
authorJordan Gordeev <jgordeev@dir.bg>
Thu, 7 Jan 2010 10:30:15 +0000 (12:30 +0200)
committerSascha Wildner <saw@online.de>
Sun, 21 Mar 2010 08:16:44 +0000 (09:16 +0100)
sys/kern/init_main.c

index 52b864f..d44aaad 100644 (file)
 #include <sys/user.h>
 #include <sys/copyright.h>
 
+#if defined(__amd64__) && defined(_KERNEL_VIRTUAL)
+#include <stdio.h>
+#endif
+
 int vfs_mountroot_devfs(void);
 
 /* Components of the first process -- never freed. */
@@ -200,8 +204,22 @@ mi_startup(void)
 
        if (sysinit == NULL) {
                sysinit = SET_BEGIN(sysinit_set);
+#if defined(__amd64__) && defined(_KERNEL_VIRTUAL)
+               /*
+                * XXX For whatever reason, on 64-bit vkernels
+                * the value of sysinit obtained from the
+                * linker set is wrong.
+                */
+               if ((long)sysinit % 8 != 0) {
+                       fprintf(stderr, "Fixing sysinit value...\n");
+                       sysinit = (long)sysinit + 4;
+               }
+#endif
                sysinit_end = SET_LIMIT(sysinit_set);
        }
+#if defined(__amd64__) && defined(_KERNEL_VIRTUAL)
+       KKASSERT((long)sysinit % 8 == 0);
+#endif
 
 restart:
        /*