From owner-svn-src-all@freebsd.org Tue Oct 22 16:52:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 892DB15F76A; Tue, 22 Oct 2019 16:52:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yKLx2wL6z42GB; Tue, 22 Oct 2019 16:52:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48E5DF59C; Tue, 22 Oct 2019 16:52:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MGqv3c082613; Tue, 22 Oct 2019 16:52:57 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MGquxu082611; Tue, 22 Oct 2019 16:52:56 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910221652.x9MGquxu082611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 22 Oct 2019 16:52:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353893 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 353893 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 16:52:57 -0000 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;