Merging 7971:887db7d64bc9 with 7970:21b063622472.
[cacao.git] / src / vm / jit / x86_64 / md.h
1 /* src/vm/jit/x86_64/md.h - machine dependent x86_64 functions
2
3    Copyright (C) 1996-2005, 2006, 2007, 2008
4
5    This file is part of CACAO.
6
7    This program is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License as
9    published by the Free Software Foundation; either version 2, or (at
10    your option) any later version.
11
12    This program is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20    02110-1301, USA.
21
22 */
23
24
25 #ifndef _VM_JIT_X86_64_MD_H
26 #define _VM_JIT_X86_64_MD_H
27
28 #include "config.h"
29
30 #include <assert.h>
31 #include <stdint.h>
32
33 #include "vm/jit/codegen-common.h"
34 #include "vm/jit/methodtree.h"
35
36
37 /* inline functions ***********************************************************/
38
39 /* md_stacktrace_get_returnaddress *********************************************
40
41    Returns the return address of the current stackframe, specified by
42    the passed stack pointer and the stack frame size.
43
44 *******************************************************************************/
45
46 inline static void *md_stacktrace_get_returnaddress(void *sp, int32_t stackframesize)
47 {
48         void *ra;
49
50         /* On x86_64 the return address is above the current stack
51            frame. */
52
53         ra = *((void **) (((uintptr_t) sp) + stackframesize));
54
55         return ra;
56 }
57
58
59 /* md_codegen_get_pv_from_pc ***************************************************
60
61    On this architecture this is just a wrapper to methodtree_find.
62
63 *******************************************************************************/
64
65 inline static void *md_codegen_get_pv_from_pc(void *ra)
66 {
67         void *pv;
68
69         /* Get the start address of the function which contains this
70        address from the method tree. */
71
72         pv = methodtree_find(ra);
73
74         return pv;
75 }
76
77
78 /* md_cacheflush ***************************************************************
79
80    Calls the system's function to flush the instruction and data
81    cache.
82
83 *******************************************************************************/
84
85 inline static void md_cacheflush(u1 *addr, s4 nbytes)
86 {
87         /* do nothing */
88 }
89
90
91 /* md_icacheflush **************************************************************
92
93    Calls the system's function to flush the instruction cache.
94
95 *******************************************************************************/
96
97 inline static void md_icacheflush(u1 *addr, s4 nbytes)
98 {
99         /* do nothing */
100 }
101
102
103 /* md_dcacheflush **************************************************************
104
105    Calls the system's function to flush the data cache.
106
107 *******************************************************************************/
108
109 inline static void md_dcacheflush(u1 *addr, s4 nbytes)
110 {
111         /* do nothing */
112 }
113
114 #endif /* _VM_JIT_X86_64_MD_H */
115
116
117 /*
118  * These are local overrides for various environment variables in Emacs.
119  * Please do not remove this and leave it at the end of the file, where
120  * Emacs will automagically detect them.
121  * ---------------------------------------------------------------------
122  * Local variables:
123  * mode: c
124  * indent-tabs-mode: t
125  * c-basic-offset: 4
126  * tab-width: 4
127  * End:
128  * vim:noexpandtab:sw=4:ts=4:
129  */