Author: mhorne
Date: Sun Sep  8 19:53:11 2019
New Revision: 352036
URL: https://svnweb.freebsd.org/changeset/base/352036

Log:
  Fix compilation of locore.S with clang
  
  The branch from _start to mpentry has to cross a large section of data;
  an offset larger than can be specified with a 12-bit branch immediate.
  Fix this by converting the branch to an unconditional jump. The gcc
  assembler does this conversion silently but it is not done automatically
  by clang.
  
  Reported by:  Jeremy Bennett <jeremy.benn...@embecosm.com>
  Reviewed by:  markj
  Approved by:  markj (mentor)
  MFC after:    1 week
  Differential Revision:        https://reviews.freebsd.org/D21437

Modified:
  head/sys/riscv/riscv/locore.S

Modified: head/sys/riscv/riscv/locore.S
==============================================================================
--- head/sys/riscv/riscv/locore.S       Sun Sep  8 19:46:34 2019        
(r352035)
+++ head/sys/riscv/riscv/locore.S       Sun Sep  8 19:53:11 2019        
(r352036)
@@ -69,12 +69,18 @@ _start:
        la      t0, hart_lottery
        li      t1, 1
        amoadd.w t0, t1, 0(t0)
-       bnez    t0, mpentry
 
        /*
-        * Page tables
+        * We must jump to mpentry in the non-BSP case because the offset is
+        * too large to fit in a 12-bit branch immediate.
         */
+       beqz    t0, 1f
+       j       mpentry
 
+       /*
+        * Page tables
+        */
+1:
        /* Add L1 entry for kernel */
        la      s1, pagetable_l1
        la      s2, pagetable_l2        /* Link to next level PN */
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to