1 /*
2  * (c) 2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
3  *     economic rights: Technische Universität Dresden (Germany)
4  * This file is part of TUD:OS and distributed under the terms of the
5  * GNU Lesser General Public License 2.1.
6  * Please see the COPYING-LGPL-2.1 file for details.
7  */
8 #pragma once
9 
10 #include <ucontext.h>
11 #include <sys/ucontext.h>
12 #include <stdio.h>
13 
14 static inline
fill_ucontext_frame(ucontext_t * ucf,l4_exc_regs_t * ue)15 void fill_ucontext_frame(ucontext_t *ucf, l4_exc_regs_t *ue)
16 {
17   ucf->uc_mcontext.regs->trap          = 0;
18 
19   ucf->uc_mcontext.regs->gpr[0]        = ue->r[0];
20   // ...
21   ucf->uc_mcontext.regs->dar           = ue->pfa;
22 }
23 
24 static inline
fill_utcb_exc(l4_exc_regs_t * ue,ucontext_t * ucf)25 void fill_utcb_exc(l4_exc_regs_t *ue, ucontext_t *ucf)
26 {
27   ue->r[0] = ucf->uc_mcontext.regs->gpr[0];
28   // ...
29 }
30 
31 static inline
show_regs(l4_exc_regs_t * u)32 void show_regs(l4_exc_regs_t *u)
33 {
34   printf("Exception: State (tbd):\n");
35   (void)u;
36 }
37