CACAO
trap.hpp
Go to the documentation of this file.
1 /* src/vm/jit/trap.hpp - hardware traps
2 
3  Copyright (C) 2008-2013
4  CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5  Copyright (C) 2009 Theobroma Systems Ltd.
6 
7  This file is part of CACAO.
8 
9  This program is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2, or (at
12  your option) any later version.
13 
14  This program is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  02110-1301, USA.
23 
24 */
25 
26 
27 #ifndef TRAP_HPP_
28 #define TRAP_HPP_ 1
29 
30 #include "config.h"
31 
32 #include <stdint.h>
33 
34 #include "vm/options.hpp"
35 
37 
38 
39 /**
40  * Contains information about a decoded trap instruction.
41  */
42 typedef struct trapinfo_t {
43  int type; ///< Specific trap type (see md-trap.h).
44  intptr_t value; ///< Value (numeric or address) passed with the trap.
45 } trapinfo_t;
46 
47 
48 /**
49  * Trap signal number defines. Use these instead of the signal
50  * numbers provided by your specific OS.
51  */
52 enum {
59 };
60 
61 /* Include machine dependent trap stuff. */
62 
63 #include "md-trap.hpp"
64 
65 
66 /* function prototypes ********************************************************/
67 
68 void trap_init(void);
69 
70 void trap_handle(int sig, void* xpc, void* context);
71 
72 bool md_trap_decode(trapinfo_t* trp, int sig, void* xpc, executionstate_t* es);
73 
74 #endif // TRAP_HPP_
75 
76 
77 /*
78  * These are local overrides for various environment variables in Emacs.
79  * Please do not remove this and leave it at the end of the file, where
80  * Emacs will automagically detect them.
81  * ---------------------------------------------------------------------
82  * Local variables:
83  * mode: c++
84  * indent-tabs-mode: t
85  * c-basic-offset: 4
86  * tab-width: 4
87  * End:
88  * vim:noexpandtab:sw=4:ts=4:
89  */
intptr_t value
Value (numeric or address) passed with the trap.
Definition: trap.hpp:44
Contains information about a decoded trap instruction.
Definition: trap.hpp:42
void trap_init(void)
Mmap the first memory page to support hardware exceptions and check the maximum hardware trap displac...
Definition: trap.cpp:68
#define xpc
Definition: md-asm.hpp:51
int type
Specific trap type (see md-trap.h).
Definition: trap.hpp:43
bool md_trap_decode(trapinfo_t *trp, int sig, void *xpc, executionstate_t *es)
Decode the trap instruction at the given PC.
Definition: md.cpp:192
void trap_handle(int sig, void *xpc, void *context)
Handles the signal which is generated by trap instructions, caught by a signal handler and calls the ...
Definition: trap.cpp:101
struct trapinfo_t trapinfo_t
Contains information about a decoded trap instruction.