From owner-svn-src-projects@FreeBSD.ORG Mon Sep 1 18:25:50 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 64248FB2; Mon, 1 Sep 2014 18:25:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 4FD481EDE; Mon, 1 Sep 2014 18:25:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s81IPoQE081551; Mon, 1 Sep 2014 18:25:50 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s81IPoe6081550; Mon, 1 Sep 2014 18:25:50 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201409011825.s81IPoe6081550@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 1 Sep 2014 18:25:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r270940 - projects/arm64/sys/arm64/arm64 X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Sep 2014 18:25:50 -0000 Author: andrew Date: Mon Sep 1 18:25:49 2014 New Revision: 270940 URL: http://svnweb.freebsd.org/changeset/base/270940 Log: Implement cpu_throw Modified: projects/arm64/sys/arm64/arm64/swtch.S Modified: projects/arm64/sys/arm64/arm64/swtch.S ============================================================================== --- projects/arm64/sys/arm64/arm64/swtch.S Mon Sep 1 18:25:46 2014 (r270939) +++ projects/arm64/sys/arm64/arm64/swtch.S Mon Sep 1 18:25:49 2014 (r270940) @@ -39,11 +39,51 @@ __FBSDID("$FreeBSD$"); * void cpu_throw(struct thread *old, struct thread *new) */ ENTRY(cpu_throw) - adr x0, .Lcpu_throw_panic_str - bl _C_LABEL(panic) +#ifdef SMP +#error cpu_throw needs to be ported to support SMP +#endif + + /* Load the PCPU area */ + /* TODO: Adjust for the core we are on */ + ldr x3, .Lcurpcpu + + /* Store the new curthread */ + str x1, [x3, #PC_CURTHREAD] + msr tpidr_el1, x1 + /* And the new pcb */ + ldr x4, [x1, #TD_PCB] + str x4, [x3, #PC_CURPCB] + + /* + * TODO: We may need to flush the cache here. + */ + + /* Switch to the new pmap */ + ldr x5, [x4, #PCB_L1ADDR] + msr ttbr0_el1, x5 + isb + + /* Invalidate the TLB */ + tlbi vmalle1 + + /* Restore the registers */ + ldp x5, x6, [x4, #PCB_SP] + mov sp, x5 + msr tpidr_el0, x6 + ldp x8, x9, [x4, #PCB_REGS + 8 * 8] + ldp x10, x11, [x4, #PCB_REGS + 10 * 8] + ldp x12, x13, [x4, #PCB_REGS + 12 * 8] + ldp x14, x15, [x4, #PCB_REGS + 14 * 8] + ldp x16, x17, [x4, #PCB_REGS + 16 * 8] + ldp x18, x19, [x4, #PCB_REGS + 18 * 8] + ldp x20, x21, [x4, #PCB_REGS + 20 * 8] + ldp x22, x23, [x4, #PCB_REGS + 22 * 8] + ldp x24, x25, [x4, #PCB_REGS + 24 * 8] + ldp x26, x27, [x4, #PCB_REGS + 26 * 8] + ldp x28, x29, [x4, #PCB_REGS + 28 * 8] + ldr x30, [x4, #PCB_REGS + 30 * 8] + ret -.Lcpu_throw_panic_str: - .asciz "cpu_throw\0\0" END(cpu_throw) /*