1 /* src/vm/jit/x86_64/md.c - machine dependent x86_64 functions
3 Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
28 #ifndef _VM_JIT_X86_64_MD_H
29 #define _VM_JIT_X86_64_MD_H
36 #include "vm/jit/codegen-common.h"
39 /* inline functions ***********************************************************/
41 /* md_stacktrace_get_returnaddress *********************************************
43 Returns the return address of the current stackframe, specified by
44 the passed stack pointer and the stack frame size.
46 *******************************************************************************/
48 inline static void *md_stacktrace_get_returnaddress(void *sp, int32_t stackframesize)
52 /* On x86_64 the return address is above the current stack
55 ra = *((void **) (((uintptr_t) sp) + stackframesize));
61 /* md_codegen_get_pv_from_pc ***************************************************
63 On this architecture just a wrapper function to
64 codegen_get_pv_from_pc.
66 *******************************************************************************/
68 inline static void *md_codegen_get_pv_from_pc(void *ra)
72 /* Get the start address of the function which contains this
73 address from the method table. */
75 pv = codegen_get_pv_from_pc(ra);
81 /* md_cacheflush ***************************************************************
83 Calls the system's function to flush the instruction and data
86 *******************************************************************************/
88 inline static void md_cacheflush(u1 *addr, s4 nbytes)
94 /* md_icacheflush **************************************************************
96 Calls the system's function to flush the instruction cache.
98 *******************************************************************************/
100 inline static void md_icacheflush(u1 *addr, s4 nbytes)
106 /* md_dcacheflush **************************************************************
108 Calls the system's function to flush the data cache.
110 *******************************************************************************/
112 inline static void md_dcacheflush(u1 *addr, s4 nbytes)
117 #endif /* _VM_JIT_X86_64_MD_H */
121 * These are local overrides for various environment variables in Emacs.
122 * Please do not remove this and leave it at the end of the file, where
123 * Emacs will automagically detect them.
124 * ---------------------------------------------------------------------
127 * indent-tabs-mode: t
131 * vim:noexpandtab:sw=4:ts=4: