Date: Tue, 22 Oct 2019 16:52:56 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353893 - head/sys/riscv/riscv Message-ID: <201910221652.x9MGquxu082611@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Tue Oct 22 16:52:56 2019 New Revision: 353893 URL: https://svnweb.freebsd.org/changeset/base/353893 Log: Fix thread0 kernel stack initialization on riscv. - td_kstack_pages was not being initialized. - td_kstack is supposed to be the base address of the stack region, not the top. The arm ports seem to have similar problems and will be fixed next. Reported by: Jenkins via lwhsu MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/riscv/riscv/locore.S head/sys/riscv/riscv/machdep.c Modified: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Tue Oct 22 16:21:24 2019 (r353892) +++ head/sys/riscv/riscv/locore.S Tue Oct 22 16:52:56 2019 (r353893) @@ -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: head/sys/riscv/riscv/machdep.c ============================================================================== --- head/sys/riscv/riscv/machdep.c Tue Oct 22 16:21:24 2019 (r353892) +++ head/sys/riscv/riscv/machdep.c Tue Oct 22 16:52:56 2019 (r353893) @@ -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) @@ -658,7 +657,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?201910221652.x9MGquxu082611>