From owner-svn-src-all@FreeBSD.ORG Mon Mar 10 20:47:28 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 29B7C7F7; Mon, 10 Mar 2014 20:47:28 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0A643D04; Mon, 10 Mar 2014 20:47:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2AKlRAH048919; Mon, 10 Mar 2014 20:47:27 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2AKlQMq048912; Mon, 10 Mar 2014 20:47:26 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201403102047.s2AKlQMq048912@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 10 Mar 2014 20:47:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r262981 - in stable: 10/sys/amd64/amd64 10/sys/amd64/include 10/sys/x86/acpica 8/sys/amd64/acpica 8/sys/amd64/amd64 8/sys/amd64/include 9/sys/amd64/acpica 9/sys/amd64/amd64 9/sys/amd64/... X-SVN-Group: stable-8 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.17 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: Mon, 10 Mar 2014 20:47:28 -0000 Author: jkim Date: Mon Mar 10 20:47:24 2014 New Revision: 262981 URL: http://svnweb.freebsd.org/changeset/base/262981 Log: MFC: r262746, r262748, r262750, r262752 Move fpusave() wrapper for suspend hander to sys/amd64/amd64/fpu.c. Modified: stable/8/sys/amd64/acpica/acpi_wakeup.c stable/8/sys/amd64/amd64/cpu_switch.S stable/8/sys/amd64/amd64/fpu.c stable/8/sys/amd64/amd64/mp_machdep.c stable/8/sys/amd64/include/fpu.h stable/8/sys/amd64/include/md_var.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/amd64/amd64/cpu_switch.S stable/10/sys/amd64/amd64/fpu.c stable/10/sys/amd64/amd64/mp_machdep.c stable/10/sys/amd64/include/fpu.h stable/10/sys/amd64/include/md_var.h stable/10/sys/x86/acpica/acpi_wakeup.c stable/9/sys/amd64/acpica/acpi_wakeup.c stable/9/sys/amd64/amd64/cpu_switch.S stable/9/sys/amd64/amd64/fpu.c stable/9/sys/amd64/amd64/mp_machdep.c stable/9/sys/amd64/include/fpu.h stable/9/sys/amd64/include/md_var.h Directory Properties: stable/10/ (props changed) stable/9/sys/ (props changed) Modified: stable/8/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- stable/8/sys/amd64/acpica/acpi_wakeup.c Mon Mar 10 19:36:26 2014 (r262980) +++ stable/8/sys/amd64/acpica/acpi_wakeup.c Mon Mar 10 20:47:24 2014 (r262981) @@ -247,7 +247,7 @@ acpi_sleep_machdep(struct acpi_softc *sc load_cr3(KPML4phys); if (savectx(susppcbs[0])) { - ctx_fpusave(suspfpusave[0]); + fpususpend(suspfpusave[0]); #ifdef SMP if (wakeup_cpus != 0 && suspend_cpus(wakeup_cpus) == 0) { device_printf(sc->acpi_dev, Modified: stable/8/sys/amd64/amd64/cpu_switch.S ============================================================================== --- stable/8/sys/amd64/amd64/cpu_switch.S Mon Mar 10 19:36:26 2014 (r262980) +++ stable/8/sys/amd64/amd64/cpu_switch.S Mon Mar 10 20:47:24 2014 (r262981) @@ -326,8 +326,8 @@ ENTRY(savectx) movq %r14,PCB_R14(%rdi) movq %r15,PCB_R15(%rdi) - movq %cr0,%rsi - movq %rsi,PCB_CR0(%rdi) + movq %cr0,%rax + movq %rax,PCB_CR0(%rdi) movq %cr2,%rax movq %rax,PCB_CR2(%rdi) movq %cr3,%rax @@ -366,19 +366,6 @@ ENTRY(savectx) sldt PCB_LDT(%rdi) str PCB_TR(%rdi) -2: movq %rsi,%cr0 /* The previous %cr0 is saved in %rsi. */ - movl $1,%eax ret END(savectx) - -/* - * Wrapper around fpusave to care about TS0_CR. - */ -ENTRY(ctx_fpusave) - movq %cr0,%rsi - clts - call fpusave - movq %rsi,%cr0 - ret -END(ctx_fpusave) Modified: stable/8/sys/amd64/amd64/fpu.c ============================================================================== --- stable/8/sys/amd64/amd64/fpu.c Mon Mar 10 19:36:26 2014 (r262980) +++ stable/8/sys/amd64/amd64/fpu.c Mon Mar 10 20:47:24 2014 (r262981) @@ -179,6 +179,17 @@ fpurestore(void *addr) fxrstor((char *)addr); } +void +fpususpend(void *addr) +{ + u_long cr0; + + cr0 = rcr0(); + stop_emulating(); + fpusave(addr); + load_cr0(cr0); +} + /* * Enable XSAVE if supported and allowed by user. * Calculate the xsave_mask. Modified: stable/8/sys/amd64/amd64/mp_machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/mp_machdep.c Mon Mar 10 19:36:26 2014 (r262980) +++ stable/8/sys/amd64/amd64/mp_machdep.c Mon Mar 10 20:47:24 2014 (r262981) @@ -1352,7 +1352,7 @@ cpususpend_handler(void) cr3 = rcr3(); if (savectx(susppcbs[cpu])) { - ctx_fpusave(suspfpusave[cpu]); + fpususpend(suspfpusave[cpu]); wbinvd(); atomic_set_int(&stopped_cpus, cpumask); } else { Modified: stable/8/sys/amd64/include/fpu.h ============================================================================== --- stable/8/sys/amd64/include/fpu.h Mon Mar 10 19:36:26 2014 (r262980) +++ stable/8/sys/amd64/include/fpu.h Mon Mar 10 20:47:24 2014 (r262981) @@ -145,6 +145,7 @@ int fpusetregs(struct thread *td, struct char *xfpustate, size_t xfpustate_size); int fpusetxstate(struct thread *td, char *xfpustate, size_t xfpustate_size); +void fpususpend(void *addr); int fputrap(void); void fpuuserinited(struct thread *td); struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags); Modified: stable/8/sys/amd64/include/md_var.h ============================================================================== --- stable/8/sys/amd64/include/md_var.h Mon Mar 10 19:36:26 2014 (r262980) +++ stable/8/sys/amd64/include/md_var.h Mon Mar 10 20:47:24 2014 (r262981) @@ -85,7 +85,6 @@ void *alloc_fpusave(int flags); void amd64_syscall(struct thread *td, int traced); void busdma_swi(void); void cpu_setregs(void); -void ctx_fpusave(void *); void doreti_iret(void) __asm(__STRING(doreti_iret)); void doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault)); void ld_ds(void) __asm(__STRING(ld_ds));