xen-vtx-unstable

view xen/arch/x86/i387.c @ 6759:b5d91089e42c

Newer binutils is a bit stricter and errors out when you try
to use movl on a 16 bit word on x86_64. Using just a "mov"
compiles fine and should result in the same code.

{standard input}: Assembler messages:
{standard input}:2138: Error: suffix or operands invalid for `mov'
{standard input}:2140: Error: suffix or operands invalid for `mov'
{standard input}:2142: Error: suffix or operands invalid for `mov'
{standard input}:2144: Error: suffix or operands invalid for `mov'

Signed-off-by: Rik van Riel <riel@redhat.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Sep 13 10:21:22 2005 +0000 (2005-09-13)
parents 48dd03e4b388
children
line source
1 /*
2 * linux/arch/i386/kernel/i387.c
3 *
4 * Copyright (C) 1994 Linus Torvalds
5 *
6 * Pentium III FXSR, SSE support
7 * General FPU state handling cleanups
8 * Gareth Hughes <gareth@valinux.com>, May 2000
9 */
11 #include <xen/config.h>
12 #include <xen/sched.h>
13 #include <asm/current.h>
14 #include <asm/processor.h>
15 #include <asm/i387.h>
17 void init_fpu(void)
18 {
19 __asm__ __volatile__ ( "fninit" );
20 if ( cpu_has_xmm )
21 load_mxcsr(0x1f80);
22 set_bit(_VCPUF_fpu_initialised, &current->vcpu_flags);
23 }
25 void save_init_fpu(struct vcpu *tsk)
26 {
27 /*
28 * The guest OS may have set the 'virtual STTS' flag.
29 * This causes us to set the real flag, so we'll need
30 * to temporarily clear it while saving f-p state.
31 */
32 if ( VMX_DOMAIN(tsk) || (tsk->arch.guest_context.ctrlreg[0] & X86_CR0_TS) )
33 clts();
35 if ( cpu_has_fxsr )
36 __asm__ __volatile__ (
37 "fxsave %0 ; fnclex"
38 : "=m" (tsk->arch.guest_context.fpu_ctxt) );
39 else
40 __asm__ __volatile__ (
41 "fnsave %0 ; fwait"
42 : "=m" (tsk->arch.guest_context.fpu_ctxt) );
44 clear_bit(_VCPUF_fpu_dirtied, &tsk->vcpu_flags);
45 stts();
46 }
48 void restore_fpu(struct vcpu *tsk)
49 {
50 /*
51 * FXRSTOR can fault if passed a corrupted data block. We handle this
52 * possibility, which may occur if the block was passed to us by control
53 * tools, by silently clearing the block.
54 */
55 if ( cpu_has_fxsr )
56 __asm__ __volatile__ (
57 "1: fxrstor %0 \n"
58 ".section .fixup,\"ax\" \n"
59 "2: push %%"__OP"ax \n"
60 " push %%"__OP"cx \n"
61 " push %%"__OP"di \n"
62 " lea %0,%%"__OP"di \n"
63 " mov %1,%%ecx \n"
64 " xor %%eax,%%eax \n"
65 " rep ; stosl \n"
66 " pop %%"__OP"di \n"
67 " pop %%"__OP"cx \n"
68 " pop %%"__OP"ax \n"
69 " jmp 1b \n"
70 ".previous \n"
71 ".section __ex_table,\"a\"\n"
72 " "__FIXUP_ALIGN" \n"
73 " "__FIXUP_WORD" 1b,2b \n"
74 ".previous \n"
75 :
76 : "m" (tsk->arch.guest_context.fpu_ctxt),
77 "i" (sizeof(tsk->arch.guest_context.fpu_ctxt)/4) );
78 else
79 __asm__ __volatile__ (
80 "frstor %0"
81 : : "m" (tsk->arch.guest_context.fpu_ctxt) );
82 }
84 /*
85 * Local variables:
86 * mode: C
87 * c-set-style: "BSD"
88 * c-basic-offset: 4
89 * tab-width: 4
90 * indent-tabs-mode: nil
91 * End:
92 */