From owner-svn-src-head@freebsd.org Tue Aug 22 13:16:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8AC4DEA854; Tue, 22 Aug 2017 13:16:15 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id C20531620; Tue, 22 Aug 2017 13:16:15 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MDGECA005963; Tue, 22 Aug 2017 13:16:14 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MDGEP0005957; Tue, 22 Aug 2017 13:16:14 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201708221316.v7MDGEP0005957@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 22 Aug 2017 13:16:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322786 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 322786 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 13:16:16 -0000 Author: andrew Date: Tue Aug 22 13:16:14 2017 New Revision: 322786 URL: https://svnweb.freebsd.org/changeset/base/322786 Log: Move the l0 pagetable address to struct mdproc. It is a property of the whole process so should live there. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/genassym.c head/sys/arm64/arm64/pmap.c head/sys/arm64/arm64/swtch.S head/sys/arm64/arm64/vm_machdep.c head/sys/arm64/include/pcb.h head/sys/arm64/include/proc.h Modified: head/sys/arm64/arm64/genassym.c ============================================================================== --- head/sys/arm64/arm64/genassym.c Tue Aug 22 13:08:22 2017 (r322785) +++ head/sys/arm64/arm64/genassym.c Tue Aug 22 13:16:14 2017 (r322786) @@ -50,12 +50,15 @@ ASSYM(PCB_SINGLE_STEP_SHIFT, PCB_SINGLE_STEP_SHIFT); ASSYM(PCB_REGS, offsetof(struct pcb, pcb_x)); ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); ASSYM(PCB_TPIDRRO, offsetof(struct pcb, pcb_tpidrro_el0)); -ASSYM(PCB_L0ADDR, offsetof(struct pcb, pcb_l0addr)); ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags)); +ASSYM(P_MD, offsetof(struct proc, p_md)); +ASSYM(MD_L0ADDR, offsetof(struct mdproc, md_l0addr)); + ASSYM(SF_UC, offsetof(struct sigframe, sf_uc)); +ASSYM(TD_PROC, offsetof(struct thread, td_proc)); ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); ASSYM(TD_FRAME, offsetof(struct thread, td_frame)); Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Tue Aug 22 13:08:22 2017 (r322785) +++ head/sys/arm64/arm64/pmap.c Tue Aug 22 13:16:14 2017 (r322786) @@ -4662,8 +4662,9 @@ pmap_activate(struct thread *td) critical_enter(); pmap = vmspace_pmap(td->td_proc->p_vmspace); - td->td_pcb->pcb_l0addr = vtophys(pmap->pm_l0); - __asm __volatile("msr ttbr0_el1, %0" : : "r"(td->td_pcb->pcb_l0addr)); + td->td_proc->p_md.md_l0addr = vtophys(pmap->pm_l0); + __asm __volatile("msr ttbr0_el1, %0" : : + "r"(td->td_proc->p_md.md_l0addr)); pmap_invalidate_all(pmap); critical_exit(); } Modified: head/sys/arm64/arm64/swtch.S ============================================================================== --- head/sys/arm64/arm64/swtch.S Tue Aug 22 13:08:22 2017 (r322785) +++ head/sys/arm64/arm64/swtch.S Tue Aug 22 13:16:14 2017 (r322786) @@ -86,7 +86,8 @@ ENTRY(cpu_throw) */ /* Switch to the new pmap */ - ldr x5, [x4, #PCB_L0ADDR] + ldr x28, [x1, #TD_PROC] + ldr x5, [x28, #(P_MD + MD_L0ADDR)] msr ttbr0_el1, x5 isb @@ -186,8 +187,15 @@ ENTRY(cpu_switch) * to a user process. */ + /* + * Load the proc pointers. If these are the same then we are in the + * same process so don't need to switch page tables or issue a + * TLB invalidate. + */ + ldr x28, [x1, #TD_PROC] + /* Switch to the new pmap */ - ldr x5, [x4, #PCB_L0ADDR] + ldr x5, [x28, #(P_MD + MD_L0ADDR)] msr ttbr0_el1, x5 isb Modified: head/sys/arm64/arm64/vm_machdep.c ============================================================================== --- head/sys/arm64/arm64/vm_machdep.c Tue Aug 22 13:08:22 2017 (r322785) +++ head/sys/arm64/arm64/vm_machdep.c Tue Aug 22 13:16:14 2017 (r322786) @@ -91,7 +91,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t td2->td_pcb = pcb2; bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); - td2->td_pcb->pcb_l0addr = + td2->td_proc->p_md.md_l0addr = vtophys(vmspace_pmap(td2->td_proc->p_vmspace)->pm_l0); tf = (struct trapframe *)STACKALIGN((struct trapframe *)pcb2 - 1); Modified: head/sys/arm64/include/pcb.h ============================================================================== --- head/sys/arm64/include/pcb.h Tue Aug 22 13:08:22 2017 (r322785) +++ head/sys/arm64/include/pcb.h Tue Aug 22 13:16:14 2017 (r322786) @@ -43,7 +43,6 @@ struct pcb { uint64_t pcb_sp; uint64_t pcb_tpidr_el0; uint64_t pcb_tpidrro_el0; - vm_offset_t pcb_l0addr; /* Fault handler, the error value is passed in x0 */ vm_offset_t pcb_onfault; Modified: head/sys/arm64/include/proc.h ============================================================================== --- head/sys/arm64/include/proc.h Tue Aug 22 13:08:22 2017 (r322785) +++ head/sys/arm64/include/proc.h Tue Aug 22 13:16:14 2017 (r322786) @@ -40,7 +40,7 @@ struct mdthread { }; struct mdproc { - int dummy; + vm_offset_t md_l0addr; }; #define KINFO_PROC_SIZE 1088