Tue Sep 23 08:50:11 2008 UTC ()
stts: don't modify %cr0 if TS is already set.


(ad)
diff -r1.12 -r1.13 src/sys/arch/i386/i386/cpufunc.S

cvs diff -r1.12 -r1.13 src/sys/arch/i386/i386/cpufunc.S (expand / switch to unified diff)

--- src/sys/arch/i386/i386/cpufunc.S 2008/05/25 15:56:12 1.12
+++ src/sys/arch/i386/i386/cpufunc.S 2008/09/23 08:50:11 1.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cpufunc.S,v 1.12 2008/05/25 15:56:12 chs Exp $ */ 1/* $NetBSD: cpufunc.S,v 1.13 2008/09/23 08:50:11 ad Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum, and by Andrew Doran. 8 * by Charles M. Hannum, and by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32/* 32/*
33 * Functions to provide access to i386-specific instructions. 33 * Functions to provide access to i386-specific instructions.
34 * 34 *
35 * These are shared with NetBSD/xen. 35 * These are shared with NetBSD/xen.
36 */ 36 */
37 37
38#include <machine/asm.h> 38#include <machine/asm.h>
39__KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.12 2008/05/25 15:56:12 chs Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.13 2008/09/23 08:50:11 ad Exp $");
40 40
41#include "opt_xen.h" 41#include "opt_xen.h"
42 42
43#include <machine/specialreg.h> 43#include <machine/specialreg.h>
44#include <machine/segments.h> 44#include <machine/segments.h>
45 45
46#include "assym.h" 46#include "assym.h"
47 47
48/* Small and slow, so align less. */ 48/* Small and slow, so align less. */
49#undef _ALIGN_TEXT 49#undef _ALIGN_TEXT
50#define _ALIGN_TEXT .align 8 50#define _ALIGN_TEXT .align 8
51 51
52ENTRY(x86_lfence) 52ENTRY(x86_lfence)
@@ -361,28 +361,31 @@ END(frstor) @@ -361,28 +361,31 @@ END(frstor)
361 361
362ENTRY(fwait) 362ENTRY(fwait)
363 fwait 363 fwait
364 ret 364 ret
365END(fwait) 365END(fwait)
366 366
367ENTRY(clts) 367ENTRY(clts)
368 clts 368 clts
369 ret 369 ret
370END(clts) 370END(clts)
371 371
372ENTRY(stts) 372ENTRY(stts)
373 movl %cr0, %eax 373 movl %cr0, %eax
 374 testl $CR0_TS, %eax
 375 jnz 1f
374 orl $CR0_TS, %eax 376 orl $CR0_TS, %eax
375 movl %eax, %cr0 377 movl %eax, %cr0
 3781:
376 ret 379 ret
377END(stts) 380END(stts)
378 381
379ENTRY(fxsave) 382ENTRY(fxsave)
380 movl 4(%esp), %eax 383 movl 4(%esp), %eax
381 fxsave (%eax) 384 fxsave (%eax)
382 ret 385 ret
383END(fxsave) 386END(fxsave)
384 387
385ENTRY(fxrstor) 388ENTRY(fxrstor)
386 movl 4(%esp), %eax 389 movl 4(%esp), %eax
387 fxrstor (%eax) 390 fxrstor (%eax)
388 ret 391 ret