hurd: Generalize init-first.c to support x86_64
authorSergey Bugaev <bugaevc@gmail.com>
Thu, 23 Feb 2023 15:14:36 +0000 (18:14 +0300)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Fri, 24 Feb 2023 19:44:03 +0000 (20:44 +0100)
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230223151436.49180-2-bugaevc@gmail.com>

sysdeps/mach/hurd/x86/init-first.c [moved from sysdeps/mach/hurd/i386/init-first.c with 97% similarity]

similarity index 97%
rename from sysdeps/mach/hurd/i386/init-first.c
rename to sysdeps/mach/hurd/x86/init-first.c
index 0542456..2fccaef 100644 (file)
@@ -225,9 +225,15 @@ _hurd_stack_setup (void)
   void doinit (intptr_t *data)
     {
       init ((void **) data);
+# ifdef __x86_64__
+      asm volatile ("movq %0, %%rsp\n" /* Switch to new outermost stack.  */
+                    "xorq %%rbp, %%rbp\n" /* Clear outermost frame pointer.  */
+                    "jmp *%1" : : "r" (data), "r" (caller));
+# else
       asm volatile ("movl %0, %%esp\n" /* Switch to new outermost stack.  */
                    "xorl %%ebp, %%ebp\n" /* Clear outermost frame pointer.  */
                    "jmp *%1" : : "r" (data), "r" (caller));
+# endif
       __builtin_unreachable ();
     }