1 /* src/vm/jit/alpha/md.h - machine dependent Alpha functions
3 Copyright (C) 1996-2005, 2006, 2007, 2008
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
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.
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.
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
26 #ifndef _VM_JIT_ALPHA_MD_H
27 #define _VM_JIT_ALPHA_MD_H
34 #include "vm/jit/alpha/codegen.h"
36 #include "vm/global.h"
39 #include "vm/jit/asmpart.h"
40 #include "vm/jit/codegen-common.hpp"
43 /* global variables ***********************************************************/
45 extern bool has_ext_instr_set;
48 /* inline functions ***********************************************************/
50 /* md_stacktrace_get_returnaddress *********************************************
52 Returns the return address of the current stackframe, specified by
53 the passed stack pointer and the stack frame size.
55 *******************************************************************************/
57 inline static void *md_stacktrace_get_returnaddress(void *sp, int32_t stackframesize)
61 /* On Alpha the return address is located on the top of the
64 ra = *((void **) (((uintptr_t) sp) + stackframesize - SIZEOF_VOID_P));
70 /* md_codegen_get_pv_from_pc ***************************************************
75 277afffe ldah pv,-2(ra)
76 237ba61c lda pv,-23012(pv)
78 *******************************************************************************/
80 inline static void *md_codegen_get_pv_from_pc(void *ra)
90 /* Get first instruction word after jump. */
94 /* Get opcode and displacement. */
96 opcode = M_MEM_GET_Opcode(mcode);
97 disp = M_MEM_GET_Memory_disp(mcode);
99 /* Check for short or long load (2 instructions). */
102 case 0x08: /* LDA: TODO use define */
103 assert((mcode >> 16) == 0x237a);
105 pv = ((uint8_t *) pc) + disp;
108 case 0x09: /* LDAH: TODO use define */
109 pv = ((uint8_t *) pc) + (disp << 16);
111 /* Get displacement of second instruction (LDA). */
115 assert((mcode >> 16) == 0x237b);
117 disp = M_MEM_GET_Memory_disp(mcode);
119 pv = ((uint8_t *) pv) + disp;
123 vm_abort_disassemble(pc, 2, "md_codegen_get_pv_from_pc: unknown instruction %x", mcode);
131 /* md_cacheflush ***************************************************************
133 Calls the system's function to flush the instruction and data
136 *******************************************************************************/
138 inline static void md_cacheflush(void *addr, int nbytes)
140 asm_cacheflush(addr, nbytes);
144 /* md_icacheflush **************************************************************
146 Calls the system's function to flush the instruction cache.
148 *******************************************************************************/
150 inline static void md_icacheflush(void *addr, int nbytes)
152 asm_cacheflush(addr, nbytes);
156 /* md_dcacheflush **************************************************************
158 Calls the system's function to flush the data cache.
160 *******************************************************************************/
162 inline static void md_dcacheflush(void *addr, int nbytes)
167 #endif /* _VM_JIT_ALPHA_MD_H */
171 * These are local overrides for various environment variables in Emacs.
172 * Please do not remove this and leave it at the end of the file, where
173 * Emacs will automagically detect them.
174 * ---------------------------------------------------------------------
177 * indent-tabs-mode: t