1 /* src/vm/jit/alpha/md.h - machine dependent Alpha 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_ALPHA_MD_H
29 #define _VM_JIT_ALPHA_MD_H
36 #include "vm/jit/alpha/codegen.h"
38 #include "vm/global.h"
41 #include "vm/jit/asmpart.h"
42 #include "vm/jit/codegen-common.h"
45 /* global variables ***********************************************************/
47 extern bool has_ext_instr_set;
50 /* inline functions ***********************************************************/
52 /* md_stacktrace_get_returnaddress *********************************************
54 Returns the return address of the current stackframe, specified by
55 the passed stack pointer and the stack frame size.
57 *******************************************************************************/
59 inline static void *md_stacktrace_get_returnaddress(void *sp, int32_t stackframesize)
63 /* On Alpha the return address is located on the top of the
66 ra = *((void **) (((uintptr_t) sp) + stackframesize - SIZEOF_VOID_P));
72 /* md_codegen_get_pv_from_pc ***************************************************
77 277afffe ldah pv,-2(ra)
78 237ba61c lda pv,-23012(pv)
80 *******************************************************************************/
82 inline static void *md_codegen_get_pv_from_pc(void *ra)
92 /* Get first instruction word after jump. */
96 /* Get opcode and displacement. */
98 opcode = M_MEM_GET_Opcode(mcode);
99 disp = M_MEM_GET_Memory_disp(mcode);
101 /* Check for short or long load (2 instructions). */
104 case 0x08: /* LDA: TODO use define */
105 assert((mcode >> 16) == 0x237a);
107 pv = ((uint8_t *) pc) + disp;
110 case 0x09: /* LDAH: TODO use define */
111 pv = ((uint8_t *) pc) + (disp << 16);
113 /* Get displacement of second instruction (LDA). */
117 assert((mcode >> 16) == 0x237b);
119 disp = M_MEM_GET_Memory_disp(mcode);
121 pv = ((uint8_t *) pv) + disp;
125 vm_abort_disassemble(pc, 2, "md_codegen_get_pv_from_pc: unknown instruction %x", mcode);
133 /* md_cacheflush ***************************************************************
135 Calls the system's function to flush the instruction and data
138 *******************************************************************************/
140 inline static void md_cacheflush(void *addr, int nbytes)
142 asm_cacheflush(addr, nbytes);
146 /* md_icacheflush **************************************************************
148 Calls the system's function to flush the instruction cache.
150 *******************************************************************************/
152 inline static void md_icacheflush(void *addr, int nbytes)
154 asm_cacheflush(addr, nbytes);
158 /* md_dcacheflush **************************************************************
160 Calls the system's function to flush the data cache.
162 *******************************************************************************/
164 inline static void md_dcacheflush(void *addr, int nbytes)
169 #endif /* _VM_JIT_ALPHA_MD_H */
173 * These are local overrides for various environment variables in Emacs.
174 * Please do not remove this and leave it at the end of the file, where
175 * Emacs will automagically detect them.
176 * ---------------------------------------------------------------------
179 * indent-tabs-mode: t