Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Mar 2014 20:47:25 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@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/...
Message-ID:  <201403102047.s2AKlP7M048901@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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/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
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
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
  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/8/sys/   (props changed)
  stable/8/sys/amd64/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/10/sys/amd64/amd64/cpu_switch.S
==============================================================================
--- stable/10/sys/amd64/amd64/cpu_switch.S	Mon Mar 10 19:36:26 2014	(r262980)
+++ stable/10/sys/amd64/amd64/cpu_switch.S	Mon Mar 10 20:47:24 2014	(r262981)
@@ -345,8 +345,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
@@ -409,8 +409,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)
@@ -548,14 +546,3 @@ ENTRY(resumectx)
 	xorl	%eax,%eax
 	ret
 END(resumectx)
-
-/*
- * 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/10/sys/amd64/amd64/fpu.c
==============================================================================
--- stable/10/sys/amd64/amd64/fpu.c	Mon Mar 10 19:36:26 2014	(r262980)
+++ stable/10/sys/amd64/amd64/fpu.c	Mon Mar 10 20:47:24 2014	(r262981)
@@ -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: stable/10/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- stable/10/sys/amd64/amd64/mp_machdep.c	Mon Mar 10 19:36:26 2014	(r262980)
+++ stable/10/sys/amd64/amd64/mp_machdep.c	Mon Mar 10 20:47:24 2014	(r262981)
@@ -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: stable/10/sys/amd64/include/fpu.h
==============================================================================
--- stable/10/sys/amd64/include/fpu.h	Mon Mar 10 19:36:26 2014	(r262980)
+++ stable/10/sys/amd64/include/fpu.h	Mon Mar 10 20:47:24 2014	(r262981)
@@ -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: stable/10/sys/amd64/include/md_var.h
==============================================================================
--- stable/10/sys/amd64/include/md_var.h	Mon Mar 10 19:36:26 2014	(r262980)
+++ stable/10/sys/amd64/include/md_var.h	Mon Mar 10 20:47:24 2014	(r262981)
@@ -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: stable/10/sys/x86/acpica/acpi_wakeup.c
==============================================================================
--- stable/10/sys/x86/acpica/acpi_wakeup.c	Mon Mar 10 19:36:26 2014	(r262980)
+++ stable/10/sys/x86/acpica/acpi_wakeup.c	Mon Mar 10 20:47:24 2014	(r262981)
@@ -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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403102047.s2AKlP7M048901>