From owner-svn-src-all@FreeBSD.ORG Tue Mar 4 21:35:58 2014 Return-Path: Delivered-To: svn-src-all@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 D04563B5; Tue, 4 Mar 2014 21:35:58 +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 BBAF9E05; Tue, 4 Mar 2014 21:35:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s24LZwD5023998; Tue, 4 Mar 2014 21:35:58 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s24LZvoW023992; Tue, 4 Mar 2014 21:35:57 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201403042135.s24LZvoW023992@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 4 Mar 2014 21:35:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262752 - in head/sys: amd64/amd64 amd64/include x86/acpica X-SVN-Group: head 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: Tue, 04 Mar 2014 21:35:59 -0000 Author: jkim Date: Tue Mar 4 21:35:57 2014 New Revision: 262752 URL: http://svnweb.freebsd.org/changeset/base/262752 Log: Move fpusave() wrapper for suspend hander to sys/amd64/amd64/fpu.c. Inspired by: jhb Modified: head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/amd64/fpu.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/include/fpu.h head/sys/amd64/include/md_var.h head/sys/x86/acpica/acpi_wakeup.c Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Tue Mar 4 20:21:43 2014 (r262751) +++ head/sys/amd64/amd64/cpu_switch.S Tue Mar 4 21:35:57 2014 (r262752) @@ -546,16 +546,3 @@ ENTRY(resumectx) xorl %eax,%eax ret END(resumectx) - -/* - * Wrapper around fpusave to care about CR0_TS. - */ -ENTRY(ctx_fpusave) - movq %cr0,%rax - pushq %rax - clts - call fpusave - popq %rax - movq %rax,%cr0 - ret -END(ctx_fpusave) Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Tue Mar 4 20:21:43 2014 (r262751) +++ head/sys/amd64/amd64/fpu.c Tue Mar 4 21:35:57 2014 (r262752) @@ -162,6 +162,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: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Tue Mar 4 20:21:43 2014 (r262751) +++ head/sys/amd64/amd64/mp_machdep.c Tue Mar 4 21:35:57 2014 (r262752) @@ -1464,7 +1464,7 @@ cpususpend_handler(void) cpu = PCPU_GET(cpuid); if (savectx(susppcbs[cpu])) { - ctx_fpusave(susppcbs[cpu]->pcb_fpususpend); + fpususpend(susppcbs[cpu]->pcb_fpususpend); wbinvd(); CPU_SET_ATOMIC(cpu, &suspended_cpus); } else { Modified: head/sys/amd64/include/fpu.h ============================================================================== --- head/sys/amd64/include/fpu.h Tue Mar 4 20:21:43 2014 (r262751) +++ head/sys/amd64/include/fpu.h Tue Mar 4 21:35:57 2014 (r262752) @@ -63,6 +63,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_sse(void); int fputrap_x87(void); void fpuuserinited(struct thread *td); Modified: head/sys/amd64/include/md_var.h ============================================================================== --- head/sys/amd64/include/md_var.h Tue Mar 4 20:21:43 2014 (r262751) +++ head/sys/amd64/include/md_var.h Tue Mar 4 21:35:57 2014 (r262752) @@ -89,7 +89,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)); Modified: head/sys/x86/acpica/acpi_wakeup.c ============================================================================== --- head/sys/x86/acpica/acpi_wakeup.c Tue Mar 4 20:21:43 2014 (r262751) +++ head/sys/x86/acpica/acpi_wakeup.c Tue Mar 4 21:35:57 2014 (r262752) @@ -202,7 +202,7 @@ acpi_sleep_machdep(struct acpi_softc *sc if (savectx(susppcbs[0])) { #ifdef __amd64__ - ctx_fpusave(susppcbs[0]->pcb_fpususpend); + fpususpend(susppcbs[0]->pcb_fpususpend); #endif #ifdef SMP if (!CPU_EMPTY(&suspcpus) && suspend_cpus(suspcpus) == 0) {