~ubuntu-branches/ubuntu/lucid/xenomai/lucid

« back to all changes in this revision

Viewing changes to include/asm-x86/bits/pod_32.h

  • Committer: Bazaar Package Importer
  • Author(s): Andres Rodriguez
  • Date: 2009-06-24 22:17:01 UTC
  • mfrom: (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090624221701-mwnah8aj90zmp6uj
Tags: 2.4.8-2ubuntu1
* Merge from debian unstable (LP: #391918), remaining changes:
  - Add lpia to supported architectures.
  - debian/rules: Create file for debhelper to pick up, use debhelper to
    install it.
  - debian/libxenomai1.dirs: Do not create directory.
  - debian/libxenomai1.preinst: Remove symlink on upgrade, remove old udev.
    rule unless modified in which case move to new name.
  - debian/libxenomai1.postinst: Do not create symlink.
  - debian/libxenomai1.postrm: No symlink to remove.
  - Bump build-depend on debhelper to install udev rules into
    /lib/udev/rules.d, add Breaks on udev to get correct version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Copyright (C) 2001,2002,2003 Philippe Gerum <rpm@xenomai.org>.
3
3
 * Copyright (C) 2004 The HYADES Project (http://www.hyades-itea.org).
4
 
 * Copyright (C) 2004,2005 Gilles Chanteperdrix <gilles.chanteperdrix@laposte.net>.
 
4
 * Copyright (C) 2004,2005 Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>.
5
5
 *
6
6
 * Xenomai is free software; you can redistribute it and/or modify it
7
7
 * under the terms of the GNU General Public License as published by
23
23
#define _XENO_ASM_X86_BITS_POD_32_H
24
24
#define _XENO_ASM_X86_BITS_POD_H
25
25
 
26
 
unsigned xnarch_tsc_scale;
27
 
unsigned xnarch_tsc_shift;
28
 
unsigned xnarch_tsc_divide;
29
 
 
30
 
long long xnarch_tsc_to_ns(long long ts)
31
 
{
32
 
        return xnarch_llmulshft(ts, xnarch_tsc_scale, xnarch_tsc_shift);
33
 
}
34
 
#define XNARCH_TSC_TO_NS
35
 
 
36
 
long long xnarch_ns_to_tsc(long long ns)
37
 
{
38
 
        return xnarch_llimd(ns, xnarch_tsc_divide, xnarch_tsc_scale);
39
 
}
40
 
#define XNARCH_NS_TO_TSC
41
 
 
42
26
#include <asm-generic/xenomai/bits/pod.h>
43
27
#include <asm/xenomai/switch.h>
44
28
 
63
47
        rootcb->ts_usedfpu = wrap_test_fpu_used(current) != 0;
64
48
        rootcb->cr0_ts = (read_cr0() & 8) != 0;
65
49
        /* So that xnarch_save_fpu() will operate on the right FPU area. */
66
 
        rootcb->fpup = &rootcb->user_task->thread.i387;
 
50
        if (rootcb->cr0_ts || rootcb->ts_usedfpu)
 
51
                rootcb->fpup = x86_fpustate_ptr(&rootcb->user_task->thread);
 
52
        else
 
53
                /*
 
54
                 * The kernel is currently using fpu in kernel-space,
 
55
                 * do not clobber the user-space fpu backup area.
 
56
                 */
 
57
                rootcb->fpup = &rootcb->fpuenv;
67
58
}
68
59
 
69
60
#define xnarch_enter_root(rootcb)  do { } while(0)
308
299
                if (tcb->cr0_ts)
309
300
                        return;
310
301
 
311
 
                if (wrap_test_fpu_used(task)) {
312
 
                        /* Fpu context was not even saved, do not restore */
313
 
                        clts();
 
302
                if (tcb->ts_usedfpu && !wrap_test_fpu_used(task)) {
 
303
                        xnarch_restore_fpu(tcb);
314
304
                        return;
315
305
                }
316
 
                
317
 
                xnarch_restore_fpu(tcb);
318
 
                return;
319
306
        }
320
307
 
321
308
        clts();
322
 
 
323
 
        if (!cpu_has_fxsr && task)
324
 
                /* fnsave, called by switch_to, initialized the FPU state, so that on
325
 
                   cpus prior to PII (i.e. without fxsr), we need to restore the saved
326
 
                   state. */
327
 
                __asm__ __volatile__("frstor %0": /* no output */
328
 
                                     :"m"(*tcb->fpup));
329
309
}
330
310
 
331
311
#else /* !CONFIG_XENO_HW_FPU */