Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Oct 2019 18:36:49 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r354196 - stable/12/sys/riscv/riscv
Message-ID:  <201910301836.x9UIan0b006682@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Oct 30 18:36:49 2019
New Revision: 354196
URL: https://svnweb.freebsd.org/changeset/base/354196

Log:
  MFC r353893:
  Fix thread0 kernel stack initialization on riscv.

Modified:
  stable/12/sys/riscv/riscv/locore.S
  stable/12/sys/riscv/riscv/machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/riscv/riscv/locore.S
==============================================================================
--- stable/12/sys/riscv/riscv/locore.S	Wed Oct 30 18:21:58 2019	(r354195)
+++ stable/12/sys/riscv/riscv/locore.S	Wed Oct 30 18:36:49 2019	(r354196)
@@ -209,7 +209,7 @@ va:
 	sd	t0, 0(sp) /* kern_l1pt */
 	sd	s9, 8(sp) /* kern_phys */
 
-	la	t0, initstack_end
+	la	t0, initstack
 	sd	t0, 16(sp) /* kern_stack */
 
 	li	t0, (VM_MAX_KERNEL_ADDRESS - 2 * L2_SIZE)

Modified: stable/12/sys/riscv/riscv/machdep.c
==============================================================================
--- stable/12/sys/riscv/riscv/machdep.c	Wed Oct 30 18:21:58 2019	(r354195)
+++ stable/12/sys/riscv/riscv/machdep.c	Wed Oct 30 18:36:49 2019	(r354196)
@@ -123,7 +123,6 @@ uint32_t boot_hart;	/* The hart we booted on. */
 cpuset_t all_harts;
 
 extern int *end;
-extern int *initstack_end;
 
 static void
 cpu_startup(void *dummy)
@@ -656,7 +655,9 @@ init_proc0(vm_offset_t kstack)
 
 	proc_linkup0(&proc0, &thread0);
 	thread0.td_kstack = kstack;
-	thread0.td_pcb = (struct pcb *)(thread0.td_kstack) - 1;
+	thread0.td_kstack_pages = KSTACK_PAGES;
+	thread0.td_pcb = (struct pcb *)(thread0.td_kstack +
+	    thread0.td_kstack_pages * PAGE_SIZE) - 1;
 	thread0.td_pcb->pcb_fpflags = 0;
 	thread0.td_frame = &proc0_tf;
 	pcpup->pc_curpcb = thread0.td_pcb;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910301836.x9UIan0b006682>