svn commit: r356202 - head/sys/riscv/riscv

Ruslan Bukin br at FreeBSD.org
Mon Dec 30 13:29:31 UTC 2019


Author: br
Date: Mon Dec 30 13:29:30 2019
New Revision: 356202
URL: https://svnweb.freebsd.org/changeset/base/356202

Log:
  Round the kernel stack allocation up as required.
  
  Submitted by:	James Clarke <jrtc27 at jrtc27.com>
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D22961

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

Modified: head/sys/riscv/riscv/locore.S
==============================================================================
--- head/sys/riscv/riscv/locore.S	Mon Dec 30 09:22:52 2019	(r356201)
+++ head/sys/riscv/riscv/locore.S	Mon Dec 30 13:29:30 2019	(r356202)
@@ -186,8 +186,10 @@ va:
 	/* Initialize stack pointer */
 	la	s3, initstack_end
 	mv	sp, s3
-	addi	sp, sp, -PCB_SIZE
 
+	/* Allocate space for thread0 PCB and riscv_bootparams */
+	addi	sp, sp, -(PCB_SIZE + 40) & ~STACKALIGNBYTES
+
 	/* Clear BSS */
 	la	s0, _C_LABEL(__bss_start)
 	la	s1, _C_LABEL(_end)
@@ -203,8 +205,6 @@ va:
 #endif
 
 	/* Fill riscv_bootparams */
-	addi	sp, sp, -40
-
 	la	t0, pagetable_l1
 	sd	t0, 0(sp) /* kern_l1pt */
 	sd	s9, 8(sp) /* kern_phys */


More information about the svn-src-all mailing list