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