Xenomai  3.0-rc6
thread.h
1 /*
2  * Copyright (C) 2009,2013 Philippe Gerum <rpm@xenomai.org>.
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_NIOS2_ASM_THREAD_H
20 #define _COBALT_NIOS2_ASM_THREAD_H
21 
22 #include <asm-generic/xenomai/thread.h>
23 
24 #ifndef CONFIG_MMU
25 #error "Xenomai: please use Xenomai 2.5.x for MMU-less support"
26 #endif
27 
28 struct xnarchtcb {
29  struct xntcb core;
30  struct {
31  unsigned long ea;
32  unsigned long r2;
33  unsigned long r3;
34  } mayday;
35 };
36 
37 #define xnarch_fpu_ptr(tcb) NULL
38 #define xnarch_fault_trap(d) ((d)->exception)
39 #define xnarch_fault_code(d) (0) /* None on this arch. */
40 #define xnarch_fault_pc(d) ((d)->regs->ea)
41 #define xnarch_fault_fpu_p(d) (0) /* Can't be. */
42 #define xnarch_fault_pf_p(d) (0) /* No page faults. */
43 #define xnarch_fault_bp_p(d) ((current->ptrace & PT_PTRACED) && \
44  ((d)->exception == IPIPE_TRAP_BP))
45 
46 #define xnarch_fault_notify(d) (xnarch_fault_bp_p(d) == 0)
47 
48 static inline void xnarch_init_root_tcb(struct xnthread *thread) { }
49 static inline void xnarch_init_shadow_tcb(struct xnthread *thread) { }
50 static inline void xnarch_enter_root(struct xnthread *root) { }
51 static inline void xnarch_leave_root(struct xnthread *thread) { }
52 static inline void xnarch_save_fpu(struct xnthread *thread) { }
53 static inline void
54 xnarch_switch_fpu(struct xnthread *from, struct xnthread *to)
55 {
56  return 0;
57 }
58 
59 static inline int
60 xnarch_handle_fpu_fault(struct xnthread *from,
61  struct xnthread *to, struct ipipe_trap_data *d)
62 {
63  return 0;
64 }
65 
66 void xnarch_switch_to(struct xnthread *out, struct xnthread *in);
67 
68 int xnarch_escalate(void);
69 
70 #endif /* !_COBALT_NIOS2_ASM_THREAD_H */