1 /* src/vm/jit/x86_64/md.h - machine dependent x86_64 functions
3 Copyright (C) 1996-2005, 2006, 2007, 2008
5 This file is part of CACAO.
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.
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.
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
25 #ifndef _VM_JIT_X86_64_MD_H
26 #define _VM_JIT_X86_64_MD_H
33 #include "vm/jit/codegen-common.h"
34 #include "vm/jit/methodtree.h"
37 /* inline functions ***********************************************************/
39 /* md_stacktrace_get_returnaddress *********************************************
41 Returns the return address of the current stackframe, specified by
42 the passed stack pointer and the stack frame size.
44 *******************************************************************************/
46 inline static void *md_stacktrace_get_returnaddress(void *sp, int32_t stackframesize)
50 /* On x86_64 the return address is above the current stack
53 ra = *((void **) (((uintptr_t) sp) + stackframesize));
59 /* md_codegen_get_pv_from_pc ***************************************************
61 On this architecture this is just a wrapper to methodtree_find.
63 *******************************************************************************/
65 inline static void *md_codegen_get_pv_from_pc(void *ra)
69 /* Get the start address of the function which contains this
70 address from the method tree. */
72 pv = methodtree_find(ra);
78 /* md_cacheflush ***************************************************************
80 Calls the system's function to flush the instruction and data
83 *******************************************************************************/
85 inline static void md_cacheflush(u1 *addr, s4 nbytes)
91 /* md_icacheflush **************************************************************
93 Calls the system's function to flush the instruction cache.
95 *******************************************************************************/
97 inline static void md_icacheflush(u1 *addr, s4 nbytes)
103 /* md_dcacheflush **************************************************************
105 Calls the system's function to flush the data cache.
107 *******************************************************************************/
109 inline static void md_dcacheflush(u1 *addr, s4 nbytes)
114 #endif /* _VM_JIT_X86_64_MD_H */
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 * ---------------------------------------------------------------------
124 * indent-tabs-mode: t
128 * vim:noexpandtab:sw=4:ts=4: