Author: mhorne
Date: Mon Jan 13 03:39:02 2020
New Revision: 356675
URL: https://svnweb.freebsd.org/changeset/base/356675

Log:
  RISC-V: fix global symbol lookups for mpentry with lld
  
  This is a follow up to r356481. In locore.S, before virtual memory is
  set up, we should avoid using indirect address lookups through the GOT.
  Therefore we need to convert uses of the la instruction to lla, which
  always generates an auipc/addi pair of instructions. This conversion was
  done for the BSP case, but not the AP case, resulting in a fault
  somewhere before mpva and a failure to bring APs online.
  
  Reported by:  lwhsu
  Reviewed by:  lwhsu, jrtc27 (accepted in a comment)
  Differential Revision:        https://reviews.freebsd.org/D23138

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

Modified: head/sys/riscv/riscv/locore.S
==============================================================================
--- head/sys/riscv/riscv/locore.S       Mon Jan 13 03:36:43 2020        
(r356674)
+++ head/sys/riscv/riscv/locore.S       Mon Jan 13 03:39:02 2020        
(r356675)
@@ -287,7 +287,7 @@ ENTRY(mpentry)
        li      t1, 4
        mulw    t1, t1, a0
        /* Get the pointer */
-       la      t0, __riscv_boot_ap
+       lla     t0, __riscv_boot_ap
        add     t0, t0, t1
 
 1:
@@ -296,7 +296,7 @@ ENTRY(mpentry)
        beqz    t1, 1b
 
        /* Setup stack pointer */
-       la      t0, secondary_stacks
+       lla     t0, secondary_stacks
        li      t1, (PAGE_SIZE * KSTACK_PAGES)
        mulw    t2, t1, a0
        add     t0, t0, t2
@@ -306,14 +306,14 @@ ENTRY(mpentry)
        add     sp, t0, t1
 
        /* Setup supervisor trap vector */
-       la      t0, mpva
+       lla     t0, mpva
        sub     t0, t0, s9
        li      t1, KERNBASE
        add     t0, t0, t1
        csrw    stvec, t0
 
        /* Set page tables base register */
-       la      s2, pagetable_l1
+       lla     s2, pagetable_l1
        srli    s2, s2, PAGE_SHIFT
        li      t0, SATP_MODE_SV39
        or      s2, s2, t0
_______________________________________________
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