cbb7f9b6df26dd1609b9144d02f7a4548aa306be
[cacao.git] / src / vm / jit / s390 / md.h
1 /* src/vm/jit/s390/md.h - machine dependent s390 Linux functions
2
3    Copyright (C) 2006, 2007, 2008
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 #ifndef _VM_JIT_S390_MD_H
27 #define _VM_JIT_S390_MD_H
28
29 #include "config.h"
30
31 #include <assert.h>
32 #include <stdint.h>
33
34 #include "vm/jit/codegen-common.hpp"
35 #include "vm/jit/methodtree.h"
36
37
38 /* md_stacktrace_get_returnaddress *********************************************
39
40    Returns the return address of the current stackframe, specified by
41    the passed stack pointer and the stack frame size.
42
43 *******************************************************************************/
44
45 inline static void *md_stacktrace_get_returnaddress(void *sp, int32_t stackframesize)
46 {
47         void *ra;
48
49         /* On S390 the return address is located on the top of the
50            stackframe. */
51
52         ra = *((void **) (((uintptr_t) sp) + stackframesize - 8));
53
54         return ra;
55 }
56
57
58 /* md_codegen_get_pv_from_pc ***************************************************
59
60    On this architecture just a wrapper function to methodtree_find.
61
62 *******************************************************************************/
63
64 inline static void *md_codegen_get_pv_from_pc(void *ra)
65 {
66         void *pv;
67
68         /* Get the start address of the function which contains this
69        address from the method table. */
70
71         pv = methodtree_find(ra);
72
73         return pv;
74 }
75
76
77 /* md_cacheflush ***************************************************************
78
79    Calls the system's function to flush the instruction and data
80    cache.
81
82 *******************************************************************************/
83
84 inline static void md_cacheflush(void *addr, int nbytes)
85 {
86         /* do nothing */
87 }
88
89
90 /* md_icacheflush **************************************************************
91
92    Calls the system's function to flush the instruction cache.
93
94 *******************************************************************************/
95
96 inline static void md_icacheflush(void *addr, int nbytes)
97 {
98         /* do nothing */
99 }
100
101
102 /* md_dcacheflush **************************************************************
103
104    Calls the system's function to flush the data cache.
105
106 *******************************************************************************/
107
108 inline static void md_dcacheflush(void *addr, int nbytes)
109 {
110         /* do nothing */
111 }
112
113 #endif /* _VM_JIT_S390_MD_H */
114
115
116 /*
117  * These are local overrides for various environment variables in Emacs.
118  * Please do not remove this and leave it at the end of the file, where
119  * Emacs will automagically detect them.
120  * ---------------------------------------------------------------------
121  * Local variables:
122  * mode: c
123  * indent-tabs-mode: t
124  * c-basic-offset: 4
125  * tab-width: 4
126  * End:
127  * vim:noexpandtab:sw=4:ts=4:
128  */