Xenomai
3.1
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_ARM64_ASM_THREAD_H
20
#define _COBALT_ARM64_ASM_THREAD_H
21
22
#include <linux/version.h>
23
#include <asm-generic/xenomai/thread.h>
24
25
#if defined(CONFIG_XENO_ARCH_FPU) && LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0)
26
#define ARM64_XENO_OLD_SWITCH
27
#endif
28
29
struct
xnarchtcb {
30
struct
xntcb core;
31
#ifdef ARM64_XENO_OLD_SWITCH
32
struct
fpsimd_state xnfpsimd_state;
33
struct
fpsimd_state *fpup;
34
#define xnarch_fpu_ptr(tcb) ((tcb)->fpup)
35
#endif
36
};
37
38
#define xnarch_fault_regs(d) ((d)->regs)
39
#define xnarch_fault_trap(d) ((d)->exception)
40
#define xnarch_fault_code(d) (0)
41
#define xnarch_fault_pc(d) ((unsigned long)((d)->regs->pc - 4))
/* XXX ? */
42
43
#define xnarch_fault_pf_p(d) ((d)->exception == IPIPE_TRAP_ACCESS)
44
#define xnarch_fault_bp_p(d) ((current->ptrace & PT_PTRACED) && \
45
((d)->exception == IPIPE_TRAP_BREAK || \
46
(d)->exception == IPIPE_TRAP_UNDEFINSTR))
47
48
#define xnarch_fault_notify(d) (!xnarch_fault_bp_p(d))
49
50
void
xnarch_switch_to(
struct
xnthread *out,
struct
xnthread *in);
51
52
static
inline
void
xnarch_enter_root(
struct
xnthread *root) { }
53
54
int
xnarch_escalate(
void
);
55
56
#ifdef ARM64_XENO_OLD_SWITCH
57
58
void
xnarch_init_root_tcb(
struct
xnthread *thread);
59
60
void
xnarch_init_shadow_tcb(
struct
xnthread *thread);
61
62
void
xnarch_leave_root(
struct
xnthread *root);
63
64
void
xnarch_switch_fpu(
struct
xnthread *from,
struct
xnthread *thread);
65
66
#else
/* !ARM64_XENO_OLD_SWITCH */
67
68
static
inline
void
xnarch_init_root_tcb(
struct
xnthread *thread) { }
69
static
inline
void
xnarch_init_shadow_tcb(
struct
xnthread *thread) { }
70
static
inline
void
xnarch_leave_root(
struct
xnthread *root) { }
71
static
inline
void
xnarch_switch_fpu(
struct
xnthread *f,
struct
xnthread *t) { }
72
73
#endif
/* !ARM64_XENO_OLD_SWITCH */
74
75
static
inline
int
xnarch_fault_fpu_p(
struct
ipipe_trap_data *d)
76
{
77
return
xnarch_fault_trap(d) == IPIPE_TRAP_FPU_ACC;
78
}
79
80
static
inline
int
81
xnarch_handle_fpu_fault(
struct
xnthread *from,
82
struct
xnthread *to,
struct
ipipe_trap_data *d)
83
{
84
return
0;
85
}
86
87
static
inline
void
xnarch_enable_kfpu(
void
) { }
88
89
static
inline
void
xnarch_disable_kfpu(
void
) { }
90
91
#endif
/* !_COBALT_ARM64_ASM_THREAD_H */
kernel
cobalt
arch
arm64
include
asm
xenomai
thread.h
Generated by
1.8.14