Author: andrew
Date: Mon Mar  2 14:06:50 2020
New Revision: 358545
URL: https://svnweb.freebsd.org/changeset/base/358545

Log:
  Generate the offsets for struct arm64_bootparams and use it in locore.S
  
  This removes one place with hard coded offsets in locore.S
  
  Sponsored by: Innovate UK

Modified:
  head/sys/arm64/arm64/genassym.c
  head/sys/arm64/arm64/locore.S

Modified: head/sys/arm64/arm64/genassym.c
==============================================================================
--- head/sys/arm64/arm64/genassym.c     Mon Mar  2 14:04:09 2020        
(r358544)
+++ head/sys/arm64/arm64/genassym.c     Mon Mar  2 14:06:50 2020        
(r358545)
@@ -34,7 +34,17 @@ __FBSDID("$FreeBSD$");
 #include <sys/proc.h>
 
 #include <machine/frame.h>
+#include <machine/machdep.h>
 #include <machine/pcb.h>
+
+/* Sizeof arm64_bootparams, rounded to keep stack alignment */
+ASSYM(BOOTPARAMS_SIZE, roundup2(sizeof(struct arm64_bootparams),
+    STACKALIGNBYTES + 1));
+ASSYM(BP_MODULEP, offsetof(struct arm64_bootparams, modulep));
+ASSYM(BP_KERN_L1PT, offsetof(struct arm64_bootparams, kern_l1pt));
+ASSYM(BP_KERN_DELTA, offsetof(struct arm64_bootparams, kern_delta));
+ASSYM(BP_KERN_STACK, offsetof(struct arm64_bootparams, kern_stack));
+ASSYM(BP_KERN_L0PT, offsetof(struct arm64_bootparams,kern_l0pt));
 
 ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
 ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);

Modified: head/sys/arm64/arm64/locore.S
==============================================================================
--- head/sys/arm64/arm64/locore.S       Mon Mar  2 14:04:09 2020        
(r358544)
+++ head/sys/arm64/arm64/locore.S       Mon Mar  2 14:06:50 2020        
(r358545)
@@ -153,18 +153,18 @@ virtdone:
        sub     x26, x26, x29
        sub     x24, x24, x29
 
-       sub     sp, sp, #(64 * 4)
+       sub     sp, sp, #BOOTPARAMS_SIZE
        mov     x0, sp
 
        /* Degate the delda so it is VA -> PA */
        neg     x29, x29
 
-       str     x1,  [x0]       /* modulep */
-       str     x26, [x0, 8]    /* kern_l1pt */
-       str     x29, [x0, 16]   /* kern_delta */
+       str     x1,  [x0, #BP_MODULEP]
+       str     x26, [x0, #BP_KERN_L1PT]
+       str     x29, [x0, #BP_KERN_DELTA]
        adr     x25, initstack
-       str     x25, [x0, 24]   /* kern_stack */
-       str     x24, [x0, 32]   /* kern_l0pt */
+       str     x25, [x0, #BP_KERN_STACK]
+       str     x24, [x0, #BP_KERN_L0PT]
 
        /* trace back starts here */
        mov     fp, #0
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to