1 /* src/vm/jit/mips/asmpart.S - Java-C interface functions for MIPS
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
25 $Id: asmpart.S 8274 2007-08-08 15:58:17Z twisti $
32 #include "vm/jit/mips/md-abi.h"
33 #include "vm/jit/mips/md-asm.h"
35 #include "vm/jit/abi-asm.h"
36 #include "vm/jit/methodheader.h"
43 /* export functions ***********************************************************/
45 .globl asm_vm_call_method
46 .globl asm_vm_call_method_int
47 .globl asm_vm_call_method_long
48 .globl asm_vm_call_method_float
49 .globl asm_vm_call_method_double
50 .globl asm_vm_call_method_exception_handler
51 .globl asm_vm_call_method_end
53 .globl asm_call_jit_compiler
55 .globl asm_handle_exception
56 .globl asm_handle_nat_exception
58 .globl asm_abstractmethoderror
60 #if defined(ENABLE_REPLACEMENT)
61 .globl asm_replacement_out
62 .globl asm_replacement_in
65 .globl compare_and_swap
68 /* asm_vm_call_method **********************************************************
70 * This function calls a Java-method (which possibly needs compilation) *
71 * with up to 4 address parameters. *
73 * This functions calls the JIT-compiler which eventually translates the *
74 * method into machine code. *
76 * A possibly throwed exception will be returned to the caller as function *
77 * return value, so the java method cannot return a fucntion value (this *
78 * function usually calls 'main' and '<clinit>' which do not return a *
82 * javaobject_header *asm_calljavafunction (methodinfo *m, *
83 * void *arg1, void *arg2, void *arg3, void *arg4); *
85 *******************************************************************************/
87 .ent asm_vm_call_method
91 #if SIZEOF_VOID_P == 8
93 .dword 0 /* catch type all */
94 .dword 0 /* handler pc */
96 .dword 0 /* start pc */
97 .word 1 /* extable size */
98 .word 0 /* 4-byte ALIGNMENT PADDING */
99 .dword 0 /* line number table start */
100 .dword 0 /* line number table size */
101 .word 0 /* 4-byte ALIGNMENT PADDING */
102 .word 0 /* fltsave */
103 .word 0 /* intsave */
106 .word 0 /* frame size */
107 .dword 0 /* codeinfo pointer */
109 #else /* SIZEOF_VOID_P == 8 */
111 .word 0 /* catch type all */
112 .word 0 /* handler pc */
114 .word 0 /* start pc */
115 .word 1 /* extable size */
116 .word 0 /* line number table start */
117 .word 0 /* line number table size */
118 .word 0 /* fltsave */
119 .word 0 /* intsave */
122 .word 0 /* frame size */
123 .word 0 /* method pointer (pointer to name) */
125 #endif /* SIZEOF_VOID_P == 8 */
128 asm_vm_call_method_int:
129 asm_vm_call_method_long:
130 asm_vm_call_method_float:
131 asm_vm_call_method_double:
132 .set noreorder /* XXX we need to recompute pv */
134 aaddiu sp,sp,-12*8 /* allocate stack space (only 11 needed)*/
135 ast ra,0*8(sp) /* save return address */
137 bal L_asm_vm_call_method_compute_pv
138 ast pv,1*8(sp) /* procedure vector */
139 L_asm_vm_call_method_compute_pv:
142 ast s0,3*8(sp) /* save callee saved register */
143 ast a0,4*8(sp) /* save method PV */
145 #if SIZEOF_VOID_P == 8
146 sdc1 fss0,5*8(sp) /* save non JavaABI saved flt registers */
154 move t0,a1 /* address of data structure */
155 move t1,a2 /* stack argument count */
156 move s0,sp /* save stack pointer */
158 #if SIZEOF_VOID_P == 8
178 #else /* SIZEOF_VOID_P == 8 */
180 # if WORDS_BIGENDIAN == 1
192 # if !defined(ENABLE_SOFT_FLOAT)
197 #endif /* SIZEOF_VOID_P == 8 */
199 beqz t1,L_asm_vm_call_method_stack_copy_done
202 sll t2,t1,3 /* calculate stackframe size (* 8) */
203 asubu sp,sp,t2 /* create stackframe */
204 move t2,sp /* temporary stack pointer */
206 L_asm_vm_call_method_stack_copy_loop:
207 #if SIZEOF_VOID_P == 8
208 ld t3,16*8(t0) /* load argument */
209 sd t3,0(t2) /* store argument on stack */
211 # if !defined(ENABLE_SOFT_FLOAT)
212 lw t3,6*8+0(t0) /* load argument */
214 sw t3,0(t2) /* store argument on stack */
221 aaddi t1,t1,-1 /* subtract 1 argument */
222 aaddi t0,t0,8 /* load address of next argument */
223 aaddi t2,t2,8 /* increase stack pointer */
225 bgtz t1,L_asm_vm_call_method_stack_copy_loop
228 L_asm_vm_call_method_stack_copy_done:
229 ala mptr,4*8(s0) /* get address of PV */
230 ald pv,0*8(mptr) /* load PV */
233 L_asm_vm_call_method_recompute_pv:
234 #if SIZEOF_VOID_P == 8
235 aaddiu pv,ra,-76*4 /* recompute procedure vector */
237 aaddiu pv,ra,(asm_vm_call_method - L_asm_vm_call_method_recompute_pv)
240 .set reorder /* XXX we need to recompute pv */
242 move sp,s0 /* restore stack pointer */
245 ald ra,0*8(sp) /* restore return address */
246 ald pv,1*8(sp) /* restore procedure vector */
249 #if SIZEOF_VOID_P == 8
250 ldc1 fss0,5*8(sp) /* restore non JavaABI saved flt regs */
258 aaddiu sp,sp,12*8 /* free stack space */
261 asm_vm_call_method_exception_handler:
262 move sp,s0 /* restore stack pointer */
263 #if SIZEOF_VOID_P == 4
264 aaddiu sp,sp,-4*4 /* reserve space for 1 argument */
268 jal builtin_throw_exception
269 #if SIZEOF_VOID_P == 4
272 asm_vm_call_method_end:
275 .end asm_vm_call_method
278 /****************** function asm_call_jit_compiler *****************************
280 * invokes the compiler for untranslated JavaVM methods. *
282 * Register REG_ITEMP1 contains a pointer to the method info structure *
283 * (prepared by createcompilerstub). Using the return address in R31 and the *
284 * offset in the LDA instruction or using the value in methodptr R25 the *
285 * patching address for storing the method address can be computed: *
287 * method address was either loaded using *
288 * M_ALD (REG_PV, REG_PV, a) ; invokestatic/special ($28) *
289 * M_JSR (REG_RA, REG_PV); *
291 * M_LDA (REG_PV, REG_RA, val) *
293 * M_ALD (REG_PV, REG_METHODPTR, m) ; invokevirtual/interface ($25) *
294 * M_JSR (REG_RA, REG_PV); *
296 * in the static case the method pointer can be computed using the *
297 * return address and the lda function following the jmp instruction *
299 *******************************************************************************/
301 .ent asm_call_jit_compiler
303 asm_call_jit_compiler:
304 #if SIZEOF_VOID_P == 8
306 aaddiu sp,sp,-(ARG_CNT+2)*8 /* +2: keep stack 16-bytes aligned */
308 ast ra,0*8(sp) /* save return address */
310 SAVE_ARGUMENT_REGISTERS(1)
312 move a0,itmp1 /* pass methodinfo pointer */
313 move a1,mptr /* pass method pointer */
314 aaddiu a2,sp,(ARG_CNT+2)*8 /* pass java sp */
316 jal jit_asm_compile /* call jit compiler */
319 ald ra,0*8(sp) /* restore return address */
321 RESTORE_ARGUMENT_REGISTERS(1)
323 aaddiu sp,sp,(ARG_CNT+2)*8 /* remove stack frame */
325 #else /* SIZEOF_VOID_P == 8 */
327 aaddiu sp,sp,-(ARG_CNT+2)*8 /* +4: keep stack 16-bytes aligned */
329 ast ra,4*4+0*4(sp) /* save return address */
331 SAVE_ARGUMENT_REGISTERS(6)
333 move a0,itmp1 /* pass methodinfo pointer */
334 move a1,mptr /* pass method pointer */
335 aaddiu a2,sp,(ARG_CNT+2)*8 /* pass java sp */
337 jal jit_asm_compile /* call jit compiler */
340 ald ra,4*4+0*4(sp) /* restore return address */
342 RESTORE_ARGUMENT_REGISTERS(6)
344 aaddiu sp,sp,(ARG_CNT+2)*8 /* remove stack frame */
346 #endif /* SIZEOF_VOID_P == 8 */
348 beqz pv,L_asm_call_jit_compiler_exception
350 jr pv /* and call method. The method returns */
351 /* directly to the caller (ra). */
353 L_asm_call_jit_compiler_exception:
356 jal exceptions_get_and_clear_exception
360 move xptr,v0 /* get exception */
361 aaddiu xpc,ra,-4 /* exception address is RA - 4 */
362 b asm_handle_nat_exception
364 .end asm_call_jit_compiler
367 /* asm_handle_exception ********************************************************
369 This function handles an exception. It does not use the usual calling
370 conventions. The exception pointer is passed in REG_ITMP1 and the
371 pc from the exception raising position is passed in REG_ITMP2. It searches
372 the local exception table for a handler. If no one is found, it unwinds
373 stacks and continues searching the callers.
375 *******************************************************************************/
377 .ent asm_handle_nat_exception
379 asm_handle_nat_exception:
380 L_asm_handle_exception_stack_loop:
381 #if SIZEOF_VOID_P == 8
382 aaddiu sp,sp,-6*8 /* keep stack 16-byte aligned */
383 ast xptr,0*8(sp) /* save exception pointer */
384 ast xpc,1*8(sp) /* save exception pc */
385 ast ra,3*8(sp) /* save RA */
386 ast zero,4*8(sp) /* save maybe-leaf flag (cleared) */
388 aaddiu sp,sp,-(4*4+6*8) /* allocate stack */
389 ast xptr,4*4+0*8(sp) /* save exception pointer */
390 ast xpc,4*4+1*8(sp) /* save exception pc */
391 ast ra,4*4+3*8(sp) /* save return address */
392 ast zero,4*4+4*8(sp) /* save maybe-leaf flag (cleared) */
395 move a0,ra /* pass RA */
396 jal md_codegen_get_pv_from_pc /* get PV from RA */
398 #if SIZEOF_VOID_P == 8
399 ast v0,2*8(sp) /* save PV */
401 ald a0,0*8(sp) /* pass xptr */
402 ald a1,1*8(sp) /* pass xpc */
403 move a2,v0 /* pass PV */
404 aaddiu a3,sp,6*8 /* pass Java SP */
406 ast v0,4*4+2*8(sp) /* save data segment pointer */
408 ald a0,4*4+0*8(sp) /* pass exception pointer */
409 ald a1,4*4+1*8(sp) /* pass exception pc */
410 move a2,v0 /* pass data segment pointer */
411 aaddiu a3,sp,(4*4+6*8) /* pass Java stack pointer */
414 b L_asm_handle_exception_continue
416 .aent asm_handle_exception
418 asm_handle_exception:
419 aaddiu sp,sp,-(ARG_CNT+TMP_CNT)*8 /* create maybe-leaf stackframe */
421 SAVE_ARGUMENT_REGISTERS(0) /* we save arg and temp registers in */
422 SAVE_TEMPORARY_REGISTERS(ARG_CNT) /* case this is a leaf method */
424 #if SIZEOF_VOID_P == 8
425 aaddiu sp,sp,-6*8 /* allocate stack */
426 ast xptr,0*8(sp) /* save exception pointer */
427 ast pv,2*8(sp) /* save PV */
428 ast ra,3*8(sp) /* save RA */
429 addu t0,zero,1 /* set maybe-leaf flag */
430 ast t0,4*8(sp) /* save maybe-leaf flag */
432 aaddiu sp,sp,-(4*4+6*8) /* allocate stack */
433 ast xptr,4*4+0*8(sp) /* save exception pointer */
434 ast xpc,4*4+1*8(sp) /* save exception pc */
435 ast pv,4*4+2*8(sp) /* save data segment pointer */
436 ast ra,4*4+3*8(sp) /* save return address */
437 addu t0,zero,1 /* set maybe-leaf flag */
438 ast t0,4*4+4*8(sp) /* save maybe-leaf flag */
441 move a0,xptr /* pass xptr */
442 move a1,xpc /* pass xpc */
443 move a2,pv /* pass PV */
445 #if SIZEOF_VOID_P == 8
446 aaddiu a3,sp,(ARG_CNT+TMP_CNT+6)*8 /* pass Java SP */
448 aaddiu a3,sp,4*4+(ARG_CNT+TMP_CNT+6)*8 /* pass Java stack pointer */
451 L_asm_handle_exception_continue:
452 jal exceptions_handle_exception
454 beqz v0,L_asm_handle_exception_not_catched
456 move xpc,v0 /* move handlerpc into xpc */
458 #if SIZEOF_VOID_P == 8
459 ald xptr,0*8(sp) /* restore exception pointer */
460 ald pv,2*8(sp) /* restore PV */
461 ald ra,3*8(sp) /* restore RA */
462 ald t0,4*8(sp) /* get maybe-leaf flag */
463 aaddiu sp,sp,6*8 /* free stackframe */
465 ald xptr,4*4+0*8(sp) /* restore exception pointer */
466 ald pv,4*4+2*8(sp) /* restore data segment pointer */
467 ald ra,4*4+3*8(sp) /* restore return address */
468 ald t0,4*4+4*8(sp) /* get maybe-leaf flag */
469 aaddiu sp,sp,4*4+6*8 /* free stackframe */
472 beqz t0,L_asm_handle_exception_no_leaf
474 RESTORE_ARGUMENT_REGISTERS(0) /* if this is a leaf method, we have */
475 RESTORE_TEMPORARY_REGISTERS(ARG_CNT)/* to restore arg and temp registers */
477 aaddiu sp,sp,(ARG_CNT+TMP_CNT)*8 /* remove maybe-leaf stackframe */
479 L_asm_handle_exception_no_leaf:
480 jr xpc /* jump to the handler */
482 L_asm_handle_exception_not_catched:
483 #if SIZEOF_VOID_P == 8
484 ald xptr,0*8(sp) /* restore xptr */
485 ald pv,2*8(sp) /* restore PV */
486 ald ra,3*8(sp) /* restore RA */
487 ald t0,4*8(sp) /* get maybe-leaf flag */
488 aaddiu sp,sp,6*8 /* free stackframe */
490 ald xptr,4*4+0*8(sp) /* restore xptr */
491 ald pv,4*4+2*8(sp) /* restore PV */
492 ald ra,4*4+3*8(sp) /* restore RA */
493 ald t0,4*4+4*8(sp) /* get maybe-leaf flag */
494 aaddiu sp,sp,4*4+6*8 /* free stackframe */
497 beqz t0,L_asm_handle_exception_no_leaf_stack
499 aaddiu sp,sp,(ARG_CNT+TMP_CNT)*8 /* remove maybe-leaf stackframe */
500 move t0,zero /* clear the maybe-leaf flag */
502 L_asm_handle_exception_no_leaf_stack:
503 lw t1,FrameSize(pv) /* get frame size */
504 aaddu t1,sp,t1 /* pointer to save area */
506 lw t2,IsLeaf(pv) /* is leaf procedure */
507 bnez t2,L_asm_handle_exception_no_ra_restore
509 ald ra,-1*8(t1) /* restore ra */
510 aaddiu t1,t1,-8 /* t1-- */
512 L_asm_handle_exception_no_ra_restore:
513 move xpc,ra /* the new xpc is ra */
514 lw t2,IntSave(pv) /* t1 = saved int register count */
515 ala t3,ex_int2 /* t3 = current pc */
516 sll t2,t2,2 /* t2 = register count * 4 */
517 asubu t3,t3,t2 /* t3 = IntSave - 4 * register count */
518 jr t3 /* jump to save position */
530 sll t2,t2,1 /* t2 = register count * 4 * 2 */
531 asubu t1,t1,t2 /* t1 = t0 - 8 * register count */
533 lw t2,FltSave(pv) /* t2 = saved flt register count */
534 ala t3,ex_flt2 /* t3 = current pc */
535 sll t2,t2,2 /* t2 = register count * 4 */
536 asubu t3,t3,t2 /* t3 = ex_int_sav - 4 * register count */
537 jr t3 /* jump to save position */
539 #if SIZEOF_VOID_P == 8
544 #else /* SIZEOF_VOID_P == 8 */
545 # if !defined(ENABLE_SOFT_FLOAT)
552 # endif /* !defined(ENABLE_SOFT_FLOAT) */
553 #endif /* SIZEOF_VOID_P == 8 */
556 lw t1,FrameSize(pv) /* get frame size */
557 aaddu sp,sp,t1 /* unwind stack */
558 b L_asm_handle_exception_stack_loop
560 .end asm_handle_nat_exception
563 /* asm_abstractmethoderror *****************************************************
565 Creates and throws an AbstractMethodError.
567 *******************************************************************************/
569 .ent asm_abstractmethoderror
571 asm_abstractmethoderror:
572 aaddiu sp,sp,-2*8 /* create stackframe */
573 ast ra,0*8(sp) /* save return address */
574 aaddiu a0,sp,2*8 /* pass java sp */
575 move a1,ra /* pass exception address */
576 jal exceptions_asm_new_abstractmethoderror
577 ald ra,0*8(sp) /* restore return address */
578 aaddiu sp,sp,2*8 /* remove stackframe */
580 move xptr,v0 /* get exception pointer */
581 aaddiu xpc,ra,-4 /* exception address is ra - 4 */
582 b asm_handle_nat_exception
584 .end asm_abstractmethoderror
587 #if defined(ENABLE_REPLACEMENT)
589 /* asm_replacement_out *********************************************************
591 This code is jumped to from the replacement-out stubs that are executed
592 when a thread reaches an activated replacement point.
594 The purpose of asm_replacement_out is to read out the parts of the
595 execution state that cannot be accessed from C code, store this state,
596 and then call the C function replace_me.
599 16 start of stack inside method to replace
600 0 rplpoint * info on the replacement point that was reached
602 NOTE: itmp3 has been clobbered by the replacement-out stub!
604 *******************************************************************************/
606 /* some room to accomodate changes of the stack frame size during replacement */
607 /* XXX we should find a cleaner solution here */
608 #define REPLACEMENT_ROOM 512
610 #define REPLACEMENT_STACK_OFFSET ((sizeexecutionstate + REPLACEMENT_ROOM + 0xf) & ~0xf)
612 .ent asm_replacement_out
615 /* create stack frame */
616 aaddiu sp,sp,-REPLACEMENT_STACK_OFFSET
618 /* save registers in execution state */
619 ast $0 ,( 0*8+offes_intregs)(sp)
620 ast $1 ,( 1*8+offes_intregs)(sp)
621 ast $2 ,( 2*8+offes_intregs)(sp)
622 ast $3 ,( 3*8+offes_intregs)(sp)
623 ast $4 ,( 4*8+offes_intregs)(sp)
624 ast $5 ,( 5*8+offes_intregs)(sp)
625 ast $6 ,( 6*8+offes_intregs)(sp)
626 ast $7 ,( 7*8+offes_intregs)(sp)
627 ast $8 ,( 8*8+offes_intregs)(sp)
628 ast $9 ,( 9*8+offes_intregs)(sp)
629 ast $10,(10*8+offes_intregs)(sp)
630 ast $11,(11*8+offes_intregs)(sp)
631 ast $12,(12*8+offes_intregs)(sp)
632 ast $13,(13*8+offes_intregs)(sp)
633 ast $14,(14*8+offes_intregs)(sp)
634 ast $15,(15*8+offes_intregs)(sp)
635 ast $16,(16*8+offes_intregs)(sp)
636 ast $17,(17*8+offes_intregs)(sp)
637 ast $18,(18*8+offes_intregs)(sp)
638 ast $19,(19*8+offes_intregs)(sp)
639 ast $20,(20*8+offes_intregs)(sp)
640 ast $21,(21*8+offes_intregs)(sp)
641 ast $22,(22*8+offes_intregs)(sp)
642 ast $23,(23*8+offes_intregs)(sp)
643 ast $24,(24*8+offes_intregs)(sp)
644 ast $25,(25*8+offes_intregs)(sp)
645 ast $26,(26*8+offes_intregs)(sp)
646 ast $27,(27*8+offes_intregs)(sp)
647 ast $28,(28*8+offes_intregs)(sp)
648 ast $29,(29*8+offes_intregs)(sp)
649 ast $30,(30*8+offes_intregs)(sp)
650 ast $31,(31*8+offes_intregs)(sp)
652 #if SIZEOF_VOID_P == 8
654 sdc1 $f0 ,( 0*8+offes_fltregs)(sp)
655 sdc1 $f1 ,( 1*8+offes_fltregs)(sp)
656 sdc1 $f2 ,( 2*8+offes_fltregs)(sp)
657 sdc1 $f3 ,( 3*8+offes_fltregs)(sp)
658 sdc1 $f4 ,( 4*8+offes_fltregs)(sp)
659 sdc1 $f5 ,( 5*8+offes_fltregs)(sp)
660 sdc1 $f6 ,( 6*8+offes_fltregs)(sp)
661 sdc1 $f7 ,( 7*8+offes_fltregs)(sp)
662 sdc1 $f8 ,( 8*8+offes_fltregs)(sp)
663 sdc1 $f9 ,( 9*8+offes_fltregs)(sp)
664 sdc1 $f10,(10*8+offes_fltregs)(sp)
665 sdc1 $f11,(11*8+offes_fltregs)(sp)
666 sdc1 $f12,(12*8+offes_fltregs)(sp)
667 sdc1 $f13,(13*8+offes_fltregs)(sp)
668 sdc1 $f14,(14*8+offes_fltregs)(sp)
669 sdc1 $f15,(15*8+offes_fltregs)(sp)
670 sdc1 $f16,(16*8+offes_fltregs)(sp)
671 sdc1 $f17,(17*8+offes_fltregs)(sp)
672 sdc1 $f18,(18*8+offes_fltregs)(sp)
673 sdc1 $f19,(19*8+offes_fltregs)(sp)
674 sdc1 $f20,(20*8+offes_fltregs)(sp)
675 sdc1 $f21,(21*8+offes_fltregs)(sp)
676 sdc1 $f22,(22*8+offes_fltregs)(sp)
677 sdc1 $f23,(23*8+offes_fltregs)(sp)
678 sdc1 $f24,(24*8+offes_fltregs)(sp)
679 sdc1 $f25,(25*8+offes_fltregs)(sp)
680 sdc1 $f26,(26*8+offes_fltregs)(sp)
681 sdc1 $f27,(27*8+offes_fltregs)(sp)
682 sdc1 $f28,(28*8+offes_fltregs)(sp)
683 sdc1 $f29,(29*8+offes_fltregs)(sp)
684 sdc1 $f30,(30*8+offes_fltregs)(sp)
685 sdc1 $f31,(31*8+offes_fltregs)(sp)
687 #else /* SIZEOF_VOID_P == 8 */
689 sdc1 $f0 ,( 0*8+offes_fltregs)(sp)
690 sdc1 $f2 ,( 2*8+offes_fltregs)(sp)
691 sdc1 $f4 ,( 4*8+offes_fltregs)(sp)
692 sdc1 $f6 ,( 6*8+offes_fltregs)(sp)
693 sdc1 $f8 ,( 8*8+offes_fltregs)(sp)
694 sdc1 $f10,(10*8+offes_fltregs)(sp)
695 sdc1 $f12,(12*8+offes_fltregs)(sp)
696 sdc1 $f14,(14*8+offes_fltregs)(sp)
697 sdc1 $f16,(16*8+offes_fltregs)(sp)
698 sdc1 $f18,(18*8+offes_fltregs)(sp)
699 sdc1 $f20,(20*8+offes_fltregs)(sp)
700 sdc1 $f22,(22*8+offes_fltregs)(sp)
701 sdc1 $f24,(24*8+offes_fltregs)(sp)
702 sdc1 $f26,(26*8+offes_fltregs)(sp)
703 sdc1 $f28,(28*8+offes_fltregs)(sp)
704 sdc1 $f30,(30*8+offes_fltregs)(sp)
706 #endif /* SIZEOF_VOID_P == 8 */
708 /* calculate sp of method */
709 aaddiu itmp1,sp,(REPLACEMENT_STACK_OFFSET + 2*8)
710 ast itmp1,(offes_sp)(sp)
713 ast pv,(offes_pv)(sp)
715 /* call replace_me */
716 ald a0,-(2*8)(itmp1) /* arg0: rplpoint * */
717 move a1,sp /* arg1: execution state */
718 jal replace_me /* call C function replace_me */
719 jal abort /* NEVER REACHED */
721 .end asm_replacement_out
723 /* asm_replacement_in **********************************************************
725 This code writes the given execution state and jumps to the replacement
728 This function never returns!
730 NOTE: itmp3 is not restored!
733 void asm_replacement_in(executionstate *es);
735 *******************************************************************************/
737 .ent asm_replacement_in
740 /* a0 == executionstate *es */
742 /* set new sp and pv */
743 ald sp,(offes_sp)(a0)
744 ald pv,(offes_pv)(a0)
746 /* copy registers from execution state */
748 ald $1 ,( 1*8+offes_intregs)(a0)
749 ald $2 ,( 2*8+offes_intregs)(a0)
750 ald $3 ,( 2*8+offes_intregs)(a0)
751 /* a0 is loaded below */
752 ald $5 ,( 5*8+offes_intregs)(a0)
753 ald $6 ,( 6*8+offes_intregs)(a0)
754 ald $7 ,( 7*8+offes_intregs)(a0)
755 ald $8 ,( 8*8+offes_intregs)(a0)
756 ald $9 ,( 9*8+offes_intregs)(a0)
757 ald $10,(10*8+offes_intregs)(a0)
758 ald $11,(11*8+offes_intregs)(a0)
759 ald $12,(12*8+offes_intregs)(a0)
760 ald $13,(13*8+offes_intregs)(a0)
761 ald $14,(14*8+offes_intregs)(a0)
762 ald $15,(15*8+offes_intregs)(a0)
763 ald $16,(16*8+offes_intregs)(a0)
764 ald $17,(17*8+offes_intregs)(a0)
765 ald $18,(18*8+offes_intregs)(a0)
766 ald $19,(19*8+offes_intregs)(a0)
767 ald $20,(20*8+offes_intregs)(a0)
768 ald $21,(21*8+offes_intregs)(a0)
769 ald $22,(22*8+offes_intregs)(a0)
770 ald $23,(23*8+offes_intregs)(a0)
771 ald $24,(24*8+offes_intregs)(a0)
772 ald $25,(25*8+offes_intregs)(a0)
773 ald $26,(26*8+offes_intregs)(a0)
774 ald $27,(27*8+offes_intregs)(a0)
775 ald $28,(28*8+offes_intregs)(a0)
778 ald $31,(31*8+offes_intregs)(a0)
780 #if SIZEOF_VOID_P == 8
782 ldc1 $f0 ,( 0*8+offes_fltregs)(a0)
783 ldc1 $f1 ,( 1*8+offes_fltregs)(a0)
784 ldc1 $f2 ,( 2*8+offes_fltregs)(a0)
785 ldc1 $f3 ,( 3*8+offes_fltregs)(a0)
786 ldc1 $f4 ,( 4*8+offes_fltregs)(a0)
787 ldc1 $f5 ,( 5*8+offes_fltregs)(a0)
788 ldc1 $f6 ,( 6*8+offes_fltregs)(a0)
789 ldc1 $f7 ,( 7*8+offes_fltregs)(a0)
790 ldc1 $f8 ,( 8*8+offes_fltregs)(a0)
791 ldc1 $f9 ,( 9*8+offes_fltregs)(a0)
792 ldc1 $f10,(10*8+offes_fltregs)(a0)
793 ldc1 $f11,(11*8+offes_fltregs)(a0)
794 ldc1 $f12,(12*8+offes_fltregs)(a0)
795 ldc1 $f13,(13*8+offes_fltregs)(a0)
796 ldc1 $f14,(14*8+offes_fltregs)(a0)
797 ldc1 $f15,(15*8+offes_fltregs)(a0)
798 ldc1 $f16,(16*8+offes_fltregs)(a0)
799 ldc1 $f17,(17*8+offes_fltregs)(a0)
800 ldc1 $f18,(18*8+offes_fltregs)(a0)
801 ldc1 $f19,(19*8+offes_fltregs)(a0)
802 ldc1 $f20,(20*8+offes_fltregs)(a0)
803 ldc1 $f21,(21*8+offes_fltregs)(a0)
804 ldc1 $f22,(22*8+offes_fltregs)(a0)
805 ldc1 $f23,(23*8+offes_fltregs)(a0)
806 ldc1 $f24,(24*8+offes_fltregs)(a0)
807 ldc1 $f25,(25*8+offes_fltregs)(a0)
808 ldc1 $f26,(26*8+offes_fltregs)(a0)
809 ldc1 $f27,(27*8+offes_fltregs)(a0)
810 ldc1 $f28,(28*8+offes_fltregs)(a0)
811 ldc1 $f29,(29*8+offes_fltregs)(a0)
812 ldc1 $f30,(30*8+offes_fltregs)(a0)
813 ldc1 $f31,(31*8+offes_fltregs)(a0)
815 #else /* SIZEOF_VOID_P == 8 */
817 ldc1 $f0 ,( 0*8+offes_fltregs)(a0)
818 ldc1 $f2 ,( 2*8+offes_fltregs)(a0)
819 ldc1 $f4 ,( 4*8+offes_fltregs)(a0)
820 ldc1 $f6 ,( 6*8+offes_fltregs)(a0)
821 ldc1 $f8 ,( 8*8+offes_fltregs)(a0)
822 ldc1 $f10,(10*8+offes_fltregs)(a0)
823 ldc1 $f12,(12*8+offes_fltregs)(a0)
824 ldc1 $f14,(14*8+offes_fltregs)(a0)
825 ldc1 $f16,(16*8+offes_fltregs)(a0)
826 ldc1 $f18,(18*8+offes_fltregs)(a0)
827 ldc1 $f20,(20*8+offes_fltregs)(a0)
828 ldc1 $f22,(22*8+offes_fltregs)(a0)
829 ldc1 $f24,(24*8+offes_fltregs)(a0)
830 ldc1 $f26,(26*8+offes_fltregs)(a0)
831 ldc1 $f28,(28*8+offes_fltregs)(a0)
832 ldc1 $f30,(30*8+offes_fltregs)(a0)
834 #endif /* SIZEOF_VOID_P == 8 */
838 ald itmp3,offes_pc(a0)
842 ald a0,(4*8+offes_intregs)(a0)
844 /* jump to new code */
848 .end asm_replacement_in
850 #endif /* defined(ENABLE_REPLACEMENT) */
853 .ent compare_and_swap
866 .end compare_and_swap
869 /* disable exec-stacks ********************************************************/
871 #if defined(__linux__) && defined(__ELF__)
872 .section .note.GNU-stack,"",%progbits
877 * These are local overrides for various environment variables in Emacs.
878 * Please do not remove this and leave it at the end of the file, where
879 * Emacs will automagically detect them.
880 * ---------------------------------------------------------------------
883 * indent-tabs-mode: t
887 * vim:noexpandtab:sw=4:ts=4: