Xenomai
3.0.2
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
thread.h
1
/*
2
* Copyright (C) 2005 Stelian Pop
3
*
4
* Xenomai is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
8
*
9
* Xenomai is distributed in the hope that it will be useful, but
10
* WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with Xenomai; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17
* 02111-1307, USA.
18
*/
19
#ifndef _COBALT_ARM_ASM_THREAD_H
20
#define _COBALT_ARM_ASM_THREAD_H
21
22
#include <asm-generic/xenomai/thread.h>
23
24
#ifdef CONFIG_XENO_ARCH_FPU
25
#ifdef CONFIG_VFP
26
#include <asm/vfp.h>
27
#endif
/* CONFIG_VFP */
28
#endif
/* !CONFIG_XENO_ARCH_FPU */
29
30
struct
xnarchtcb {
31
struct
xntcb core;
32
#ifdef CONFIG_XENO_ARCH_FPU
33
#ifdef CONFIG_VFP
34
union
vfp_state *fpup;
35
#define xnarch_fpu_ptr(tcb) ((tcb)->fpup)
36
#else
37
#define xnarch_fpu_ptr(tcb) NULL
38
#endif
39
#endif
40
struct
{
41
unsigned
long
pc;
42
unsigned
long
r0;
43
#ifdef __ARM_EABI__
44
unsigned
long
r7;
45
#endif
46
#ifdef CONFIG_ARM_THUMB
47
unsigned
long
psr;
48
#endif
49
} mayday;
50
};
51
52
#define xnarch_fault_regs(d) ((d)->regs)
53
#define xnarch_fault_trap(d) ((d)->exception)
54
#define xnarch_fault_code(d) (0)
55
#define xnarch_fault_pc(d) ((d)->regs->ARM_pc - (thumb_mode((d)->regs) ? 2 : 4))
/* XXX ? */
56
57
#define xnarch_fault_pf_p(d) ((d)->exception == IPIPE_TRAP_ACCESS)
58
#define xnarch_fault_bp_p(d) ((current->ptrace & PT_PTRACED) && \
59
((d)->exception == IPIPE_TRAP_BREAK || \
60
(d)->exception == IPIPE_TRAP_UNDEFINSTR))
61
62
#define xnarch_fault_notify(d) (!xnarch_fault_bp_p(d))
63
64
void
xnarch_switch_to(
struct
xnthread *out,
struct
xnthread *in);
65
66
static
inline
void
xnarch_enter_root(
struct
xnthread *root) { }
67
68
static
inline
int
xnarch_escalate(
void
)
69
{
70
if
(ipipe_root_p) {
71
ipipe_raise_irq(cobalt_pipeline.escalate_virq);
72
return
1;
73
}
74
75
return
0;
76
}
77
78
#if defined(CONFIG_XENO_ARCH_FPU) && defined(CONFIG_VFP)
79
80
static
inline
void
xnarch_init_root_tcb(
struct
xnthread *thread)
81
{
82
struct
xnarchtcb *tcb = xnthread_archtcb(thread);
83
tcb->fpup = NULL;
84
}
85
86
void
xnarch_init_shadow_tcb(
struct
xnthread *thread);
87
88
int
xnarch_fault_fpu_p(
struct
ipipe_trap_data *d);
89
90
void
xnarch_leave_root(
struct
xnthread *root);
91
92
void
xnarch_save_fpu(
struct
xnthread *thread);
93
94
void
xnarch_switch_fpu(
struct
xnthread *from,
struct
xnthread *thread);
95
96
int
xnarch_handle_fpu_fault(
struct
xnthread *from,
97
struct
xnthread *to,
struct
ipipe_trap_data *d);
98
99
#else
/* !CONFIG_XENO_ARCH_FPU || !CONFIG_VFP */
100
101
static
inline
void
xnarch_init_root_tcb(
struct
xnthread *thread) { }
102
static
inline
void
xnarch_init_shadow_tcb(
struct
xnthread *thread) { }
103
104
/*
105
* Userland may raise FPU faults with FPU-enabled kernels, regardless
106
* of whether real-time threads actually use FPU, so we simply ignore
107
* these faults.
108
*/
109
static
inline
int
xnarch_fault_fpu_p(
struct
ipipe_trap_data *d)
110
{
111
return
0;
112
}
113
114
static
inline
void
xnarch_leave_root(
struct
xnthread *root) { }
115
116
static
inline
void
xnarch_save_fpu(
struct
xnthread *thread) { }
117
118
static
inline
void
xnarch_switch_fpu(
struct
xnthread *f,
struct
xnthread *t) { }
119
120
static
inline
int
xnarch_handle_fpu_fault(
struct
xnthread *from,
121
struct
xnthread *to,
struct
ipipe_trap_data *d)
122
{
123
return
0;
124
}
125
#endif
/* !CONFIG_XENO_ARCH_FPU || !CONFIG_VFP */
126
127
static
inline
void
xnarch_enable_kfpu(
void
) { }
128
129
static
inline
void
xnarch_disable_kfpu(
void
) { }
130
131
#endif
/* !_COBALT_ARM_ASM_THREAD_H */
kernel
cobalt
arch
arm
include
asm
xenomai
thread.h
Generated by
1.8.10