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

« back to all changes in this revision

Viewing changes to include/asm-arm/system.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:
53
53
       - last_task_used_math for Linux US threads (only current or NULL when MP)
54
54
       - current for RT US threads.
55
55
    */
 
56
    unsigned is_root;
56
57
#define xnarch_fpu_ptr(tcb)     ((tcb)->fpup)
57
58
#else /* !CONFIG_XENO_HW_FPU */
58
59
#define xnarch_fpu_ptr(tcb)     NULL
88
89
#define xnarch_fault_trap(fi)   ((fi)->exception)
89
90
#define xnarch_fault_code(fi)   (0)
90
91
#define xnarch_fault_pc(fi)     ((fi)->regs->ARM_pc - (thumb_mode((fi)->regs) ? 2 : 4)) /* XXX ? */
91
 
#define xnarch_fault_fpu_p(fi)  (0)
 
92
#ifndef CONFIG_XENO_HW_FPU
 
93
/* It is normal on ARM for user-space support running with a kernel compiled
 
94
   with FPU support to make FPU faults, even on the context of real-time threads
 
95
   which do not otherwise use FPU, so we simply ignore these faults. */
 
96
#define xnarch_fault_fpu_p(fi) (0)
 
97
#else /* CONFIG_XENO_HW_FPU */
 
98
static inline int xnarch_fault_fpu_p(struct xnarch_fltinfo *fi)
 
99
{
 
100
    /* This function does the same thing to decode the faulting instruct as
 
101
       "call_fpe" in arch/arm/entry-armv.S */
 
102
    static unsigned copro_to_exc[16] = {
 
103
        IPIPE_TRAP_UNDEFINSTR,
 
104
        /* FPE */
 
105
        IPIPE_TRAP_FPU, IPIPE_TRAP_FPU,
 
106
        IPIPE_TRAP_UNDEFINSTR,
 
107
#ifdef CONFIG_CRUNCH
 
108
        IPIPE_TRAP_FPU, IPIPE_TRAP_FPU, IPIPE_TRAP_FPU,
 
109
#else /* !CONFIG_CRUNCH */
 
110
        IPIPE_TRAP_UNDEFINSTR, IPIPE_TRAP_UNDEFINSTR, IPIPE_TRAP_UNDEFINSTR,
 
111
#endif /* !CONFIG_CRUNCH */
 
112
        IPIPE_TRAP_UNDEFINSTR, IPIPE_TRAP_UNDEFINSTR, IPIPE_TRAP_UNDEFINSTR,
 
113
#ifdef CONFIG_VFP
 
114
        IPIPE_TRAP_VFP, IPIPE_TRAP_VFP,
 
115
#else /* !CONFIG_VFP */
 
116
        IPIPE_TRAP_UNDEFINSTR, IPIPE_TRAP_UNDEFINSTR,
 
117
#endif /* !CONFIG_VFP */
 
118
        IPIPE_TRAP_UNDEFINSTR, IPIPE_TRAP_UNDEFINSTR,
 
119
        IPIPE_TRAP_UNDEFINSTR, IPIPE_TRAP_UNDEFINSTR,
 
120
    };
 
121
    unsigned instr, exc, cp;
 
122
    char *pc;
 
123
 
 
124
    if (fi->exception == IPIPE_TRAP_FPU || fi->exception == IPIPE_TRAP_VFP)
 
125
        return 1;
 
126
 
 
127
    /* When an FPU fault occurs in user-mode, it will be properly resolved
 
128
       before __ipipe_dispatch_event is called. */
 
129
    if (fi->exception != IPIPE_TRAP_UNDEFINSTR || xnarch_fault_um(fi))
 
130
        return 0;
 
131
 
 
132
    pc = (char *) xnarch_fault_pc(fi);
 
133
    if (unlikely(thumb_mode(fi->regs))) {
 
134
        unsigned short thumbh, thumbl;
 
135
 
 
136
        thumbh = *(unsigned short *) pc;
 
137
        thumbl = *((unsigned short *) pc + 1);
 
138
        
 
139
        if ((thumbh & 0x0000f800) < 0x0000e800)
 
140
            return 0;
 
141
        instr = (thumbh << 16) | thumbl;
 
142
 
 
143
#ifdef CONFIG_NEON
 
144
        if ((instr & 0xef000000) == 0xef000000
 
145
            || (instr & 0xff100000) == 0xf9000000) {
 
146
                fi->exception = IPIPE_TRAP_VFP;
 
147
                return 1;
 
148
        }
 
149
#endif
 
150
    } else {
 
151
        instr = *(unsigned *) pc;
 
152
 
 
153
#ifdef CONFIG_NEON
 
154
        if ((instr & 0xfe000000) == 0xf2000000
 
155
            || (instr & 0xff100000) == 0xf4000000) {
 
156
                fi->exception = IPIPE_TRAP_VFP;
 
157
                return 1;
 
158
        }
 
159
#endif
 
160
    }
 
161
 
 
162
    if ((instr & 0x0c000000) != 0x0c000000)
 
163
        return 0;
 
164
 
 
165
    cp = (instr & 0x00000f00) >> 8;
 
166
#ifdef CONFIG_IWMMXT
 
167
    /* We need something equivalent to _TIF_USING_IWMMXT for Xenomai kernel
 
168
       threads */
 
169
    if (cp <= 1) {
 
170
        fi->exception = IPIPE_TRAP_FPU;
 
171
        return 1;
 
172
    }
 
173
#endif
 
174
 
 
175
    fi->exception = exc = copro_to_exc[cp];
 
176
    return exc != IPIPE_TRAP_UNDEFINSTR;
 
177
}
 
178
#endif /* CONFIG_XENO_HW_FPU */
92
179
/* The following predicates are only usable over a regular Linux stack
93
180
   context. */
94
181
#define xnarch_fault_pf_p(fi)   ((fi)->exception == IPIPE_TRAP_ACCESS)