6 #include "vm/jit/sparc64/md-abi.h"
8 #include "vm/exceptions.h"
9 #include "vm/stringlocal.h"
10 #include "vm/jit/asmpart.h"
11 #include "vm/jit/stacktrace.h"
14 /* md_init *********************************************************************
16 Do some machine dependent initialization.
18 *******************************************************************************/
26 /* md_stacktrace_get_returnaddress *********************************************
28 Returns the return address of the current stackframe, specified by
29 the passed stack pointer and the stack frame size.
31 *******************************************************************************/
33 u1 *md_stacktrace_get_returnaddress(u1 *sp, u4 framesize)
35 /* where's it gonna be ? */
41 /* md_codegen_findmethod *******************************************************
44 This reconstructs and returns the PV of a method given a return address
45 pointer. (basically, same was as the generated code following the jump does)
50 277afffe ldah pv,-2(ra)
51 237ba61c lda pv,-23012(pv)
53 *******************************************************************************/
55 u1 *md_codegen_findmethod(u1 *ra)
63 /* get first instruction word after jump */
67 /* check if we have 2 instructions (ldah, lda) */
69 if ((mcode >> 16) == 0x277a) {
70 /* get displacement of first instruction (ldah) */
72 offset = (s4) (mcode << 16);
75 /* get displacement of second instruction (lda) */
77 mcode = *((u4 *) (ra + 1 * 4));
79 assert((mcode >> 16) == 0x237b);
81 offset = (s2) (mcode & 0x0000ffff);
85 /* get displacement of first instruction (lda) */
87 assert((mcode >> 16) == 0x237a);
89 offset = (s2) (mcode & 0x0000ffff);
97 /* md_cacheflush ***************************************************************
99 Calls the system's function to flush the instruction and data
102 *******************************************************************************/
104 void md_cacheflush(u1 *addr, s4 nbytes)
110 /* md_icacheflush **************************************************************
112 Calls the system's function to flush the instruction cache.
114 *******************************************************************************/
116 void md_icacheflush(u1 *addr, s4 nbytes)
122 /* md_patch_replacement_point **************************************************
124 Patch the given replacement point.
126 *******************************************************************************/
128 void md_patch_replacement_point(rplpoint *rp)
132 /* save the current machine code */
133 mcode = *(u4*)rp->pc;
135 /* write the new machine code */
136 *(u4*)(rp->pc) = (u4) rp->mcode;
138 /* store saved mcode */
141 #if !defined(NDEBUG) && defined(ENABLE_DISASSEMBLER)
149 /* flush instruction cache */
150 /* md_icacheflush(rp->pc,4); */
154 * These are local overrides for various environment variables in Emacs.
155 * Please do not remove this and leave it at the end of the file, where
156 * Emacs will automagically detect them.
157 * ---------------------------------------------------------------------
160 * indent-tabs-mode: t
164 * vim:noexpandtab:sw=4:ts=4: