]> xenbits.xensource.com Git - people/royger/freebsd.git/commitdiff
powerpc64: fix loader regression
authorLeandro Lupori <luporl@FreeBSD.org>
Tue, 21 Sep 2021 20:22:42 +0000 (17:22 -0300)
committerAlfredo Dal'Ava Junior <alfredo@FreeBSD.org>
Fri, 4 Mar 2022 22:18:22 +0000 (19:18 -0300)
After b4cb3fe0e39a, loader started crashing on PowerPC64, with a
Program Exception (700) error. The problem was that archsw was
used before being initialized, with the new mount feature. This
change fixes the issue by initializing archsw earlier, before
setting currdev, that triggers the mount.

Reviewed by: tsoome
MFC after: 1 month
X-MFC-With: b4cb3fe0e39a
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D32027

(cherry picked from commit 680ca739458ba8cba221ea74794c2cd9771c77f8)

stand/powerpc/ofw/main.c

index d30be975ac4115b042a5a70b7fb7516f66258a4d..81195d3f24449d4b0aec061062c3062f6cee85bd 100644 (file)
@@ -168,6 +168,17 @@ main(int (*openfirm)(void *))
          */
        cons_probe();
 
+       archsw.arch_getdev = ofw_getdev;
+       archsw.arch_copyin = ofw_copyin;
+       archsw.arch_copyout = ofw_copyout;
+       archsw.arch_readin = ofw_readin;
+#ifdef CAS
+       setenv("cas", "1", 0);
+       archsw.arch_autoload = ppc64_autoload;
+#else
+       archsw.arch_autoload = ofw_autoload;
+#endif
+
        /* Set up currdev variable to have hooks in place. */
        env_setenv("currdev", EV_VOLATILE, "", ofw_setcurrdev, env_nounset);
 
@@ -214,17 +225,6 @@ main(int (*openfirm)(void *))
        if (!(mfmsr() & PSL_DR))
                setenv("usefdt", "1", 1);
 
-       archsw.arch_getdev = ofw_getdev;
-       archsw.arch_copyin = ofw_copyin;
-       archsw.arch_copyout = ofw_copyout;
-       archsw.arch_readin = ofw_readin;
-#ifdef CAS
-       setenv("cas", "1", 0);
-       archsw.arch_autoload = ppc64_autoload;
-#else
-       archsw.arch_autoload = ofw_autoload;
-#endif
-
        interact();                             /* doesn't return */
 
        OF_exit();