CACAO
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
source
cacao
src
vm
jit
powerpc
netbsd
md-os.cpp
Go to the documentation of this file.
1
/* src/vm/jit/powerpc/netbsd/md-os.cpp - machine dependent PowerPC NetBSD functions
2
3
Copyright (C) 1996-2013
4
CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5
6
This file is part of CACAO.
7
8
This program is free software; you can redistribute it and/or
9
modify it under the terms of the GNU General Public License as
10
published by the Free Software Foundation; either version 2, or (at
11
your option) any later version.
12
13
This program is distributed in the hope that it will be useful, but
14
WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
General Public License for more details.
17
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21
02110-1301, USA.
22
23
*/
24
25
26
#include "config.h"
27
28
#include <
ucontext.h
>
29
30
#include "
vm/types.hpp
"
31
32
#include "
vm/jit/powerpc/netbsd/md-abi.hpp
"
33
34
#include "
vm/signallocal.hpp
"
35
36
#include "
vm/jit/asmpart.hpp
"
37
#include "
vm/jit/stacktrace.hpp
"
38
39
40
/* md_signal_handle_sigsegv ****************************************************
41
42
NullPointerException signal handler for hardware null pointer
43
check.
44
45
*******************************************************************************/
46
47
void
md_signal_handler_sigsegv
(
int
sig, siginfo_t *siginfo,
void
*_p)
48
{
49
ucontext_t
*_uc;
50
mcontext_t
*_mc;
51
u4
instr;
52
s4
reg;
53
ptrint
addr;
54
u1
*
pv
;
55
u1
*
sp
;
56
u1
*
ra
;
57
u1
*
xpc
;
58
59
_uc = (
ucontext_t
*) _p;
60
_mc = _uc->
uc_mcontext
.uc_regs;
61
62
instr = *((
u4
*) _mc->gregs[PT_NIP]);
63
reg = (instr >> 16) & 0x1f;
64
addr = _mc->gregs[reg];
65
66
if
(addr == 0) {
67
pv = (
u1
*) _mc->gregs[
REG_PV
];
68
sp = (
u1
*) _mc->gregs[
REG_SP
];
69
ra = (
u1
*) _mc->gregs[PT_LNK];
/* this is correct for leafs */
70
xpc = (
u1
*) _mc->gregs[PT_NIP];
71
72
_mc->gregs[
REG_ITMP1_XPTR
] =
73
(
ptrint
) stacktrace_hardware_nullpointerexception(pv, sp, ra, xpc);
74
75
_mc->gregs[
REG_ITMP2_XPC
] = (
ptrint
) xpc;
76
_mc->gregs[PT_NIP] = (
ptrint
)
asm_handle_exception
;
77
78
}
else
{
79
throw_cacao_exception_exit(
string_java_lang_InternalError
,
80
"Segmentation fault: 0x%08lx at 0x%08lx"
,
81
addr, _mc->gregs[PT_NIP]);
82
}
83
}
84
85
86
/*
87
* These are local overrides for various environment variables in Emacs.
88
* Please do not remove this and leave it at the end of the file, where
89
* Emacs will automagically detect them.
90
* ---------------------------------------------------------------------
91
* Local variables:
92
* mode: c++
93
* indent-tabs-mode: t
94
* c-basic-offset: 4
95
* tab-width: 4
96
* End:
97
*/
REG_SP
#define REG_SP
Definition:
md-abi.hpp:53
md-abi.hpp
pv
#define pv
Definition:
md-asm.hpp:65
REG_PV
#define REG_PV
Definition:
md-abi.hpp:42
ra
#define ra
Definition:
md-asm.hpp:62
md_signal_handler_sigsegv
void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
NullPointerException signal handler for hardware null pointer check.
Definition:
md-os.cpp:50
string_java_lang_InternalError
const char * string_java_lang_InternalError
ucontext::uc_mcontext
struct sigcontext uc_mcontext
Definition:
md-os.cpp:42
REG_ITMP1_XPTR
#define REG_ITMP1_XPTR
Definition:
md-abi.hpp:50
u1
uint8_t u1
Definition:
types.hpp:40
types.hpp
REG_ITMP2_XPC
#define REG_ITMP2_XPC
Definition:
md-abi.hpp:51
ucontext
Definition:
md-os.cpp:38
xpc
#define xpc
Definition:
md-asm.hpp:51
stacktrace.hpp
signallocal.hpp
asmpart.hpp
s4
int32_t s4
Definition:
types.hpp:45
asm_handle_exception
void asm_handle_exception(void)
u4
uint32_t u4
Definition:
types.hpp:46
mcontext_t
CONTEXT mcontext_t
Definition:
ucontext.h:27
sp
#define sp
Definition:
md-asm.hpp:81
ucontext.h
ptrint
uintptr_t ptrint
Definition:
types.hpp:54
Generated on Fri Aug 4 2017 03:01:48 for CACAO by
1.8.5