1 /* src/vm/jit/powerpc/asmpart.S - Java-C interface functions for PowerPC
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.text; 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 8270 2007-08-08 13:57:12Z twisti $
35 #include "vm/jit/abi-asm.h"
36 #include "vm/jit/methodheader.h"
37 #include "vm/jit/powerpc/offsets.h"
45 /* export functions ***********************************************************/
47 .globl asm_vm_call_method
48 .globl asm_vm_call_method_int
49 .globl asm_vm_call_method_long
50 .globl asm_vm_call_method_float
51 .globl asm_vm_call_method_double
53 .globl asm_vm_call_method_exception_handler
54 .globl asm_vm_call_method_end
56 .globl asm_call_jit_compiler
58 .globl asm_handle_nat_exception
59 .globl asm_handle_exception
61 .globl asm_abstractmethoderror
63 #if defined(ENABLE_REPLACEMENT)
64 .globl asm_replacement_out
65 .globl asm_replacement_in
70 .globl asm_compare_and_swap
71 .globl asm_memory_barrier
73 .globl asm_criticalsections
74 .globl asm_getclassvalues_atomic
77 /* asm_vm_call_method **********************************************************
79 * This function calls a Java-method (which possibly needs compilation) *
80 * with up to 4 address parameters. *
82 * This functions calls the JIT-compiler which eventually translates the *
83 * method into machine code. *
86 * javaobject_header *asm_calljavamethod (methodinfo *m, *
87 * void *arg1, void *arg2, void *arg3, void *arg4); *
89 *******************************************************************************/
93 .long 0 /* catch type all */
94 .long 0 /* exception handler pc */
96 .long 0 /* start pc */
97 .long 1 /* extable size */
98 .long 0 /* line number table start */
99 .long 0 /* line number table size */
100 .long 0 /* fltsave */
101 .long 0 /* intsave */
104 .long 0 /* frame size */
105 .long 0 /* codeinfo pointer */
108 asm_vm_call_method_int:
109 asm_vm_call_method_long:
110 asm_vm_call_method_float:
111 asm_vm_call_method_double:
113 stw r0,LA_LR_OFFSET(sp)
114 stwu sp,-40*4(sp) /* keep stack 16-byte aligned */
116 stw s0,8*4(sp) /* save used callee saved registers */
117 stw a0,9*4(sp) /* save method PV */
119 #if defined(__DARWIN__)
120 stw itmp1,10*4(sp) /* register r11 is callee saved */
122 stw pv,11*4(sp) /* save PV register */
124 stw itmp3,12*4(sp) /* registers r14-r31 are callee saved */
125 stfd ftmp1,14*4(sp) /* registers f14-f31 are callee saved */
128 #if defined(__DARWIN__)
144 SAVE_TEMPORARY_REGISTERS(18) /* the offset has to be even */
147 mr t0,a1 /* address of data structure */
148 mr t1,a2 /* stack argument count */
150 mr s0,sp /* save SP */
152 lwz a0,0*8+4(t0) /* we are on big-endian */
170 #if defined(__DARWIN__)
179 beq L_asm_vm_call_method_stack_copy_done
181 slwi t2,t1,3 /* calculate stackframe size (* 8) */
183 sub sp,sp,t2 /* create stackframe */
184 mr t2,sp /* temporary stack pointer */
186 L_asm_vm_call_method_stack_copy_loop:
187 #if defined(__DARWIN__)
188 lwz t3,21*8+0(t0) /* load argument */
191 lwz t3,16*8+0(t0) /* load argument */
194 stw t3,0(t2) /* store argument on stack */
197 addi t0,t0,8 /* load address of next argument */
198 addi t2,t2,8 /* increase stack pointer */
199 addi t1,t1,-1 /* subtract 1 argument */
201 bgt L_asm_vm_call_method_stack_copy_loop
203 L_asm_vm_call_method_stack_copy_done:
204 addi mptr,s0,9*4 /* get address of PV */
205 lwz pv,0*4(mptr) /* load PV */
210 #if defined(__DARWIN__)
211 addi pv,itmp1,lo16(asm_vm_call_method - 1b)
213 addi pv,itmp1,(asm_vm_call_method - 1b)@l
216 L_asm_vm_call_method_return:
217 mr sp,s0 /* restore the SP */
219 lwz s0,8*4(sp) /* restore used callee saved registers*/
221 #if defined(__DARWIN__)
222 lwz itmp1,10*4(sp) /* register r11 is callee saved */
224 lwz pv,11*4(sp) /* save PV register */
227 lfd ftmp1,14*4(sp) /* registers f14-f31 are callee saved */
230 #if defined(__DARWIN__)
246 RESTORE_TEMPORARY_REGISTERS(18) /* the offset has to be even */
249 lwz r0,40*4+LA_LR_OFFSET(sp)
254 asm_vm_call_method_exception_handler:
256 bl builtin_throw_exception
257 b L_asm_vm_call_method_return
259 asm_vm_call_method_end:
263 /* asm_call_jit_compiler *******************************************************
265 Invokes the compiler for untranslated JavaVM methods.
267 *******************************************************************************/
269 asm_call_jit_compiler:
270 L_asm_call_jit_compiler: /* required for PIC code */
272 stw r0,LA_LR_OFFSET(sp) /* save return address */
273 stwu sp,-(LA_SIZE + 4*4 + INT_ARG_CNT*4 + FLT_ARG_CNT*8)(sp)
275 #if defined(__DARWIN__)
276 stw a0,LA_SIZE+(4+0)*4(sp)
277 stw a1,LA_SIZE+(4+1)*4(sp)
278 stw a2,LA_SIZE+(4+2)*4(sp)
279 stw a3,LA_SIZE+(4+3)*4(sp)
280 stw a4,LA_SIZE+(4+4)*4(sp)
281 stw a5,LA_SIZE+(4+5)*4(sp)
282 stw a6,LA_SIZE+(4+6)*4(sp)
283 stw a7,LA_SIZE+(4+7)*4(sp)
285 stfd fa0,LA_SIZE+(4+8)*4(sp)
286 stfd fa1,LA_SIZE+(4+10)*4(sp)
287 stfd fa2,LA_SIZE+(4+12)*4(sp)
288 stfd fa3,LA_SIZE+(4+14)*4(sp)
289 stfd fa4,LA_SIZE+(4+16)*4(sp)
290 stfd fa5,LA_SIZE+(4+18)*4(sp)
291 stfd fa6,LA_SIZE+(4+20)*4(sp)
292 stfd fa7,LA_SIZE+(4+22)*4(sp)
293 stfd fa8,LA_SIZE+(4+24)*4(sp)
294 stfd fa9,LA_SIZE+(4+26)*4(sp)
295 stfd fa10,LA_SIZE+(4+28)*4(sp)
296 stfd fa11,LA_SIZE+(4+30)*4(sp)
297 stfd fa12,LA_SIZE+(4+32)*4(sp)
299 SAVE_ARGUMENT_REGISTERS(LA_SIZE_IN_POINTERS)
304 addi a2,sp,(LA_SIZE + 4*4 + INT_ARG_CNT*4 + FLT_ARG_CNT*8)
305 lwz a3,(LA_SIZE + 4*4 + INT_ARG_CNT*4 + FLT_ARG_CNT*8)+LA_LR_OFFSET(sp)
307 mr pv,v0 /* move address to pv register */
309 #if defined(__DARWIN__)
310 lwz a0,LA_SIZE+(4+0)*4(sp)
311 lwz a1,LA_SIZE+(4+1)*4(sp)
312 lwz a2,LA_SIZE+(4+2)*4(sp)
313 lwz a3,LA_SIZE+(4+3)*4(sp)
314 lwz a4,LA_SIZE+(4+4)*4(sp)
315 lwz a5,LA_SIZE+(4+5)*4(sp)
316 lwz a6,LA_SIZE+(4+6)*4(sp)
317 lwz a7,LA_SIZE+(4+7)*4(sp)
319 lfd fa0,LA_SIZE+(4+8)*4(sp)
320 lfd fa1,LA_SIZE+(4+10)*4(sp)
321 lfd fa2,LA_SIZE+(4+12)*4(sp)
322 lfd fa3,LA_SIZE+(4+14)*4(sp)
323 lfd fa4,LA_SIZE+(4+16)*4(sp)
324 lfd fa5,LA_SIZE+(4+18)*4(sp)
325 lfd fa6,LA_SIZE+(4+20)*4(sp)
326 lfd fa7,LA_SIZE+(4+22)*4(sp)
327 lfd fa8,LA_SIZE+(4+24)*4(sp)
328 lfd fa9,LA_SIZE+(4+26)*4(sp)
329 lfd fa10,LA_SIZE+(4+28)*4(sp)
330 lfd fa11,LA_SIZE+(4+30)*4(sp)
331 lfd fa12,LA_SIZE+(4+32)*4(sp)
333 RESTORE_ARGUMENT_REGISTERS(LA_SIZE_IN_POINTERS)
336 lwz itmp1,(LA_SIZE + 4*4 + INT_ARG_CNT*4 + FLT_ARG_CNT*8)+LA_LR_OFFSET(sp)
339 addi sp,sp,(LA_SIZE + 4*4 + INT_ARG_CNT*4 + FLT_ARG_CNT*8)
341 mr. pv,pv /* test for exception */
342 beq L_asm_call_jit_compiler_exception
344 mtctr pv /* move method address to control reg */
345 bctr /* and call the Java method */
347 L_asm_call_jit_compiler_exception:
349 stw r0,LA_LR_OFFSET(sp)
350 stwu sp,-LA_SIZE_ALIGNED(sp) /* preserve linkage area */
351 bl exceptions_get_and_clear_exception
352 lwz xpc,LA_SIZE_ALIGNED+LA_LR_OFFSET(sp)
354 addi sp,sp,LA_SIZE_ALIGNED
356 mr xptr,v0 /* get exception */
357 addi xpc,xpc,-4 /* exception address is ra - 4 */
358 b L_asm_handle_nat_exception
361 /********************* function asm_handle_exception ***************************
363 * This function handles an exception. It does not use the usual calling *
364 * conventions. The exception pointer is passed in REG_ITMP1 and the *
365 * pc from the exception raising position is passed in REG_ITMP2. It searches *
366 * the local exception table for a handler. If no one is found, it unwinds *
367 * stacks and continues searching the callers. *
369 * void asm_handle_exception (exceptionptr, exceptionpc); *
371 *******************************************************************************/
373 asm_handle_nat_exception:
374 L_asm_handle_nat_exception: /* required for PIC code */
375 L_asm_handle_exception_stack_loop:
377 addi sp,sp,-(LA_SIZE+((4+6)*4)) /* allocate stack (+4 for darwin) */
378 stw xptr,LA_SIZE+(4+0)*4(sp) /* save exception pointer */
379 stw xpc,LA_SIZE+(4+1)*4(sp) /* save exception pc */
380 stw r0,LA_SIZE+(4+3)*4(sp) /* save return address */
382 stw itmp3,LA_SIZE+(4+4)*4(sp) /* save maybe-leaf flag (cleared) */
384 mr a0,r0 /* pass return address */
385 bl md_codegen_get_pv_from_pc /* get PV from RA */
386 stw v0,LA_SIZE+(4+2)*4(sp) /* save data segment pointer */
388 lwz a0,LA_SIZE+(4+0)*4(sp) /* pass xptr */
389 lwz a1,LA_SIZE+(4+1)*4(sp) /* pass xpc */
390 lwz a2,LA_SIZE+(4+2)*4(sp) /* pass PV (v0 == a0) */
391 addi a3,sp,LA_SIZE+((4+6)*4) /* pass Java SP */
393 b L_asm_handle_exception_continue
395 asm_handle_exception:
396 L_asm_handle_exception: /* required for PIC code */
397 addi sp,sp,-(ARG_CNT+TMP_CNT)*8 /* create maybe-leaf stackframe */
399 #if defined(__DARWIN__)
401 SAVE_ARGUMENT_REGISTERS(0) /* we save arg and temp registers in */
402 SAVE_TEMPORARY_REGISTERS(ARG_CNT) /* case this is a leaf method */
405 addi sp,sp,-(LA_SIZE+(4+6)*4) /* allocate stack */
406 stw xptr,LA_SIZE+(4+0)*4(sp) /* save xptr */
407 stw pv,LA_SIZE+(4+2)*4(sp) /* save PV */
408 mflr r0 /* save RA */
409 stw r0,LA_SIZE+(4+3)*4(sp)
410 li t0,1 /* set maybe-leaf flag */
411 stw t0,LA_SIZE+(4+4)*4(sp) /* save maybe-leaf flag */
413 mr a0,xptr /* pass exception pointer */
414 mr a1,xpc /* pass exception pc */
415 mr a2,pv /* pass data segment pointer */
416 addi a3,sp,LA_SIZE+(ARG_CNT+TMP_CNT)*8+(4+6)*4
418 L_asm_handle_exception_continue:
419 bl exceptions_handle_exception
422 beq L_asm_handle_exception_not_catched
424 mr xpc,v0 /* move handlerpc into xpc */
425 lwz xptr,LA_SIZE+(4+0)*4(sp) /* restore xptr */
426 lwz pv,LA_SIZE+(4+2)*4(sp) /* restore PV */
427 lwz r0,LA_SIZE+(4+3)*4(sp) /* restore RA */
429 lwz t0,LA_SIZE+(4+4)*4(sp) /* get maybe-leaf flag */
430 addi sp,sp,LA_SIZE+(4+6)*4 /* free stack frame */
433 beq L_asm_handle_exception_no_leaf
435 #if defined(__DARWIN__)
437 RESTORE_ARGUMENT_REGISTERS(0) /* if this is a leaf method, we have */
438 RESTORE_TEMPORARY_REGISTERS(ARG_CNT)/* to restore arg and temp registers */
441 addi sp,sp,(ARG_CNT+TMP_CNT)*8 /* remove maybe-leaf stackframe */
443 L_asm_handle_exception_no_leaf:
444 mtctr xpc /* jump to the handler */
447 L_asm_handle_exception_not_catched:
448 lwz xptr,LA_SIZE+(4+0)*4(sp) /* restore xptr */
449 lwz pv,LA_SIZE+(4+2)*4(sp) /* restore PV */
450 lwz r0,LA_SIZE+(4+3)*4(sp) /* restore RA */
452 lwz t0,LA_SIZE+(4+4)*4(sp) /* get maybe-leaf flag */
453 addi sp,sp,LA_SIZE+(4+6)*4 /* free stack frame */
456 beq L_asm_handle_exception_no_leaf_stack
458 addi sp,sp,(ARG_CNT+TMP_CNT)*8 /* remove maybe-leaf stackframe */
459 li t0,0 /* clear the maybe-leaf flag */
461 L_asm_handle_exception_no_leaf_stack:
462 lwz t1,FrameSize(pv) /* get frame size */
463 add t1,sp,t1 /* pointer to save area */
465 lwz t2,IsLeaf(pv) /* is leaf procedure */
467 bne L_asm_handle_exception_no_ra_restore
469 lwz r0,LA_LR_OFFSET(t1) /* restore ra */
472 L_asm_handle_exception_no_ra_restore:
473 mflr xpc /* the new xpc is ra */
474 mr t4,xpc /* save RA */
475 lwz t2,IntSave(pv) /* t2 = saved int register count */
478 mflr t3 /* t3 = current pc */
479 #if defined(__DARWIN__)
480 addi t3,t3,lo16(ex_int2-ex_int1)
482 addi t3,t3,(ex_int2-ex_int1)@l
484 slwi t2,t2,2 /* t2 = register count * 4 */
485 subf t3,t2,t3 /* t3 = IntSave - t2 */
501 subf t1,t2,t1 /* t1 = t1 - register count * 4 */
507 #if defined(__DARWIN__)
508 addi t3,t3,lo16(ex_flt2-ex_flt1)
510 addi t3,t3,(ex_flt2-ex_flt1)@l
512 slwi t2,t2,2 /* t2 = register count * 4 */
513 subf t3,t2,t3 /* t3 = FltSave - t2 */
529 mtlr t4 /* restore RA */
530 lwz t1,FrameSize(pv) /* get frame size */
531 add sp,sp,t1 /* unwind stack */
532 b L_asm_handle_exception_stack_loop
535 /* asm_abstractmethoderror *****************************************************
537 Creates and throws an AbstractMethodError.
539 *******************************************************************************/
541 asm_abstractmethoderror:
543 stw r0,LA_LR_OFFSET(sp)
544 stwu sp,-LA_SIZE_ALIGNED(sp) /* preserve linkage area */
545 addi a0,sp,LA_SIZE_ALIGNED /* pass java sp */
546 mr a1,r0 /* pass exception address */
547 bl exceptions_asm_new_abstractmethoderror
548 lwz r0,LA_SIZE_ALIGNED+LA_LR_OFFSET(sp)
549 mtlr r0 /* restore return address */
550 addi sp,sp,LA_SIZE_ALIGNED
552 mr xptr,v0 /* get exception pointer */
553 mr xpc,r0 /* we can't use r0 directly in addi */
554 addi xpc,xpc,-4 /* exception address is ra - 4 */
555 b L_asm_handle_nat_exception
558 #if defined(ENABLE_REPLACEMENT)
560 /* asm_replacement_out *********************************************************
562 This code is jumped to from the replacement-out stubs that are executed
563 when a thread reaches an activated replacement point.
565 The purpose of asm_replacement_out is to read out the parts of the
566 execution state that cannot be accessed from C code, store this state,
567 and then call the C function replace_me.
570 16 start of stack inside method to replace
571 0 rplpoint * info on the replacement point that was reached
573 NOTE: itmp3 has been clobbered by the replacement-out stub!
575 *******************************************************************************/
577 /* some room to accomodate changes of the stack frame size during replacement */
578 /* XXX we should find a cleaner solution here */
579 #define REPLACEMENT_ROOM 512
581 #define sizeexecutionstate_ALIGNED ((sizeexecutionstate + 15) & ~15)
584 /* create stack frame */
585 addi sp,sp,-(sizeexecutionstate_ALIGNED + REPLACEMENT_ROOM)
587 /* save link register */
590 /* save registers in execution state */
591 stw r0 ,( 0*4+offes_intregs)(sp)
592 stw r1 ,( 1*4+offes_intregs)(sp)
593 stw r2 ,( 2*4+offes_intregs)(sp)
594 stw r3 ,( 3*4+offes_intregs)(sp)
595 stw r4 ,( 4*4+offes_intregs)(sp)
596 stw r5 ,( 5*4+offes_intregs)(sp)
597 stw r6 ,( 6*4+offes_intregs)(sp)
598 stw r7 ,( 7*4+offes_intregs)(sp)
599 stw r8 ,( 8*4+offes_intregs)(sp)
600 stw r9 ,( 9*4+offes_intregs)(sp)
601 stw r10,(10*4+offes_intregs)(sp)
602 stw r11,(11*4+offes_intregs)(sp)
603 stw r12,(12*4+offes_intregs)(sp)
604 stw r13,(13*4+offes_intregs)(sp)
605 stw r14,(14*4+offes_intregs)(sp)
606 stw r15,(15*4+offes_intregs)(sp)
607 stw r16,(16*4+offes_intregs)(sp) /* link register stored as itmp3 */
608 stw r17,(17*4+offes_intregs)(sp)
609 stw r18,(18*4+offes_intregs)(sp)
610 stw r19,(19*4+offes_intregs)(sp)
611 stw r20,(20*4+offes_intregs)(sp)
612 stw r21,(21*4+offes_intregs)(sp)
613 stw r22,(22*4+offes_intregs)(sp)
614 stw r23,(23*4+offes_intregs)(sp)
615 stw r24,(24*4+offes_intregs)(sp)
616 stw r25,(25*4+offes_intregs)(sp)
617 stw r26,(26*4+offes_intregs)(sp)
618 stw r27,(27*4+offes_intregs)(sp)
619 stw r28,(28*4+offes_intregs)(sp)
620 stw r29,(29*4+offes_intregs)(sp)
621 stw r30,(30*4+offes_intregs)(sp)
622 stw r31,(31*4+offes_intregs)(sp)
624 stfd fr0 ,( 0*8+offes_fltregs)(sp)
625 stfd fr1 ,( 1*8+offes_fltregs)(sp)
626 stfd fr2 ,( 2*8+offes_fltregs)(sp)
627 stfd fr3 ,( 3*8+offes_fltregs)(sp)
628 stfd fr4 ,( 4*8+offes_fltregs)(sp)
629 stfd fr5 ,( 5*8+offes_fltregs)(sp)
630 stfd fr6 ,( 6*8+offes_fltregs)(sp)
631 stfd fr7 ,( 7*8+offes_fltregs)(sp)
632 stfd fr8 ,( 8*8+offes_fltregs)(sp)
633 stfd fr9 ,( 9*8+offes_fltregs)(sp)
634 stfd fr10,(10*8+offes_fltregs)(sp)
635 stfd fr11,(11*8+offes_fltregs)(sp)
636 stfd fr12,(12*8+offes_fltregs)(sp)
637 stfd fr13,(13*8+offes_fltregs)(sp)
638 stfd fr14,(14*8+offes_fltregs)(sp)
639 stfd fr15,(15*8+offes_fltregs)(sp)
640 stfd fr16,(16*8+offes_fltregs)(sp)
641 stfd fr17,(17*8+offes_fltregs)(sp)
642 stfd fr18,(18*8+offes_fltregs)(sp)
643 stfd fr19,(19*8+offes_fltregs)(sp)
644 stfd fr20,(20*8+offes_fltregs)(sp)
645 stfd fr21,(21*8+offes_fltregs)(sp)
646 stfd fr22,(22*8+offes_fltregs)(sp)
647 stfd fr23,(23*8+offes_fltregs)(sp)
648 stfd fr24,(24*8+offes_fltregs)(sp)
649 stfd fr25,(25*8+offes_fltregs)(sp)
650 stfd fr26,(26*8+offes_fltregs)(sp)
651 stfd fr27,(27*8+offes_fltregs)(sp)
652 stfd fr28,(28*8+offes_fltregs)(sp)
653 stfd fr29,(29*8+offes_fltregs)(sp)
654 stfd fr30,(30*8+offes_fltregs)(sp)
655 stfd fr31,(31*8+offes_fltregs)(sp)
657 /* calculate sp of method */
658 addi itmp1,sp,(sizeexecutionstate_ALIGNED + REPLACEMENT_ROOM + 4*4)
659 stw itmp1,(offes_sp)(sp)
662 stw pv,(offes_pv)(sp)
664 /* call replace_me */
665 lwz a0,-(4*4)(itmp1) /* arg0: rplpoint * */
666 mr a1,sp /* arg1: execution state */
667 addi sp,sp,-(LA_SIZE_ALIGNED)
668 b replace_me /* call C function replace_me */
670 /* asm_replacement_in **********************************************************
672 This code writes the given execution state and jumps to the replacement
675 This function never returns!
677 NOTE: itmp3 is not restored!
680 void asm_replacement_in(executionstate *es, replace_safestack_t *st);
682 *******************************************************************************/
685 /* a0 == executionstate *es */
686 /* a1 == replace_safestack_t *st */
689 mr s1,a1 /* replace_safestack_t *st */
690 mr s2,a0 /* executionstate *es == safe stack */
692 /* switch to the safe stack */
695 /* reserve linkage area */
696 addi sp,sp,-(LA_SIZE_ALIGNED)
698 /* call replace_build_execution_state(st) */
700 bl replace_build_execution_state
703 lwz sp,(offes_sp)(s2)
705 /* build stack frame */
706 addi sp,sp,-(sizeexecutionstate_ALIGNED)
708 /* call replace_free_safestack(st,& of allocated executionstate_t) */
711 addi sp,sp,-(LA_SIZE_ALIGNED) /* reserve linkage area */
712 bl replace_free_safestack
713 addi sp,sp,+(LA_SIZE_ALIGNED) /* tear down linkage area */
716 lwz pv,(offes_pv)(sp)
718 /* copy registers from execution state */
719 lwz r0 ,( 0*4+offes_intregs)(sp)
722 lwz a0 ,( 3*4+offes_intregs)(sp)
723 lwz r4 ,( 4*4+offes_intregs)(sp)
724 lwz r5 ,( 5*4+offes_intregs)(sp)
725 lwz r6 ,( 6*4+offes_intregs)(sp)
726 lwz r7 ,( 7*4+offes_intregs)(sp)
727 lwz r8 ,( 8*4+offes_intregs)(sp)
728 lwz r9 ,( 9*4+offes_intregs)(sp)
729 lwz r10,(10*4+offes_intregs)(sp)
730 lwz r11,(11*4+offes_intregs)(sp)
731 lwz r12,(12*4+offes_intregs)(sp)
733 lwz r14,(14*4+offes_intregs)(sp)
734 lwz r15,(15*4+offes_intregs)(sp)
735 lwz r16,(16*4+offes_intregs)(sp) /* itmp3, later to link register */
736 lwz r17,(17*4+offes_intregs)(sp)
737 lwz r18,(18*4+offes_intregs)(sp)
738 lwz r19,(19*4+offes_intregs)(sp)
739 lwz r20,(20*4+offes_intregs)(sp)
740 lwz r21,(21*4+offes_intregs)(sp)
741 lwz r22,(22*4+offes_intregs)(sp)
742 lwz r23,(23*4+offes_intregs)(sp)
743 lwz r24,(24*4+offes_intregs)(sp)
744 lwz r25,(25*4+offes_intregs)(sp)
745 lwz r26,(26*4+offes_intregs)(sp)
746 lwz r27,(27*4+offes_intregs)(sp)
747 lwz r28,(28*4+offes_intregs)(sp)
748 lwz r29,(29*4+offes_intregs)(sp)
749 lwz r30,(30*4+offes_intregs)(sp)
750 lwz r31,(31*4+offes_intregs)(sp)
752 lfd fr0 ,( 0*8+offes_fltregs)(sp)
753 lfd fr1 ,( 1*8+offes_fltregs)(sp)
754 lfd fr2 ,( 2*8+offes_fltregs)(sp)
755 lfd fr3 ,( 3*8+offes_fltregs)(sp)
756 lfd fr4 ,( 4*8+offes_fltregs)(sp)
757 lfd fr5 ,( 5*8+offes_fltregs)(sp)
758 lfd fr6 ,( 6*8+offes_fltregs)(sp)
759 lfd fr7 ,( 7*8+offes_fltregs)(sp)
760 lfd fr8 ,( 8*8+offes_fltregs)(sp)
761 lfd fr9 ,( 9*8+offes_fltregs)(sp)
762 lfd fr10,(10*8+offes_fltregs)(sp)
763 lfd fr11,(11*8+offes_fltregs)(sp)
764 lfd fr12,(12*8+offes_fltregs)(sp)
765 lfd fr13,(13*8+offes_fltregs)(sp)
766 lfd fr14,(14*8+offes_fltregs)(sp)
767 lfd fr15,(15*8+offes_fltregs)(sp)
768 lfd fr16,(16*8+offes_fltregs)(sp)
769 lfd fr17,(17*8+offes_fltregs)(sp)
770 lfd fr18,(18*8+offes_fltregs)(sp)
771 lfd fr19,(19*8+offes_fltregs)(sp)
772 lfd fr20,(20*8+offes_fltregs)(sp)
773 lfd fr21,(21*8+offes_fltregs)(sp)
774 lfd fr22,(22*8+offes_fltregs)(sp)
775 lfd fr23,(23*8+offes_fltregs)(sp)
776 lfd fr24,(24*8+offes_fltregs)(sp)
777 lfd fr25,(25*8+offes_fltregs)(sp)
778 lfd fr26,(26*8+offes_fltregs)(sp)
779 lfd fr27,(27*8+offes_fltregs)(sp)
780 lfd fr28,(28*8+offes_fltregs)(sp)
781 lfd fr29,(29*8+offes_fltregs)(sp)
782 lfd fr30,(30*8+offes_fltregs)(sp)
783 lfd fr31,(31*8+offes_fltregs)(sp)
785 /* restore link register */
791 lwz itmp3,offes_pc(sp)
793 /* remove stack frame */
795 addi sp,sp,+(sizeexecutionstate_ALIGNED)
797 /* jump to new code */
802 #endif /* defined(ENABLE_REPLACEMENT) */
804 /*********************************************************************/
832 /* asm_compare_and_swap ********************************************************
836 *******************************************************************************/
838 asm_compare_and_swap:
851 /* asm_memory_barrier **********************************************************
855 *******************************************************************************/
862 asm_getclassvalues_atomic:
865 lwz a3,offbaseval(a0)
866 lwz a4,offdiffval(a0)
867 lwz a5,offbaseval(a1)
869 stw a3,offcast_super_baseval(a2)
870 stw a4,offcast_super_diffval(a2)
871 stw a5,offcast_sub_baseval(a2)
876 asm_criticalsections:
877 #if defined(ENABLE_THREADS)
885 #if defined(__DARWIN__)
887 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
889 L_builtin_throw_exception$stub:
890 .indirect_symbol _builtin_throw_exception
892 bcl 20,31,L00$_builtin_throw_exception
893 L00$_builtin_throw_exception:
895 addis r11,r11,ha16(L_builtin_throw_exception$lazy_ptr - L00$_builtin_throw_exception)
897 lwzu r12,lo16(L_builtin_throw_exception$lazy_ptr - L00$_builtin_throw_exception)(r11)
902 L_builtin_throw_exception$lazy_ptr:
903 .indirect_symbol _builtin_throw_exception
904 .long dyld_stub_binding_helper
907 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
909 L_md_codegen_get_pv_from_pc$stub:
910 .indirect_symbol _md_codegen_get_pv_from_pc
912 bcl 20,31,L00$_md_codegen_get_pv_from_pc
913 L00$_md_codegen_get_pv_from_pc:
915 addis r11,r11,ha16(L_md_codegen_get_pv_from_pc$lazy_ptr - L00$_md_codegen_get_pv_from_pc)
917 lwzu r12,lo16(L_md_codegen_get_pv_from_pc$lazy_ptr - L00$_md_codegen_get_pv_from_pc)(r11)
922 L_md_codegen_get_pv_from_pc$lazy_ptr:
923 .indirect_symbol _md_codegen_get_pv_from_pc
924 .long dyld_stub_binding_helper
927 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
929 L_exceptions_handle_exception$stub:
930 .indirect_symbol _exceptions_handle_exception
932 bcl 20,31,L00$_exceptions_handle_exception
933 L00$_exceptions_handle_exception:
935 addis r11,r11,ha16(L_exceptions_handle_exception$lazy_ptr - L00$_exceptions_handle_exception)
937 lwzu r12,lo16(L_exceptions_handle_exception$lazy_ptr - L00$_exceptions_handle_exception)(r11)
942 L_exceptions_handle_exception$lazy_ptr:
943 .indirect_symbol _exceptions_handle_exception
944 .long dyld_stub_binding_helper
947 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
949 L_stacktrace_create_extern_stackframeinfo$stub:
950 .indirect_symbol _stacktrace_create_extern_stackframeinfo
952 bcl 20,31,L00$_stacktrace_create_extern_stackframeinfo
953 L00$_stacktrace_create_extern_stackframeinfo:
955 addis r11,r11,ha16(L_stacktrace_create_extern_stackframeinfo$lazy_ptr - L00$_stacktrace_create_extern_stackframeinfo)
957 lwzu r12,lo16(L_stacktrace_create_extern_stackframeinfo$lazy_ptr - L00$_stacktrace_create_extern_stackframeinfo)(r11)
962 L_stacktrace_create_extern_stackframeinfo$lazy_ptr:
963 .indirect_symbol _stacktrace_create_extern_stackframeinfo
964 .long dyld_stub_binding_helper
967 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
969 L_jit_asm_compile$stub:
970 .indirect_symbol _jit_asm_compile
972 bcl 20,31,L00$_jit_asm_compile
973 L00$_jit_asm_compile:
975 addis r11,r11,ha16(L_jit_asm_compile$lazy_ptr - L00$_jit_asm_compile)
977 lwzu r12,lo16(L_jit_asm_compile$lazy_ptr - L00$_jit_asm_compile)(r11)
982 L_jit_asm_compile$lazy_ptr:
983 .indirect_symbol _jit_asm_compile
984 .long dyld_stub_binding_helper
987 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
989 L_stacktrace_remove_stackframeinfo$stub:
990 .indirect_symbol _stacktrace_remove_stackframeinfo
992 bcl 20,31,L00$_stacktrace_remove_stackframeinfo
993 L00$_stacktrace_remove_stackframeinfo:
995 addis r11,r11,ha16(L_stacktrace_remove_stackframeinfo$lazy_ptr - L00$_stacktrace_remove_stackframeinfo)
997 lwzu r12,lo16(L_stacktrace_remove_stackframeinfo$lazy_ptr - L00$_stacktrace_remove_stackframeinfo)(r11)
1001 .lazy_symbol_pointer
1002 L_stacktrace_remove_stackframeinfo$lazy_ptr:
1003 .indirect_symbol _stacktrace_remove_stackframeinfo
1004 .long dyld_stub_binding_helper
1007 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1009 L_exceptions_get_and_clear_exception$stub:
1010 .indirect_symbol _exceptions_get_and_clear_exception
1012 bcl 20,31,L00$_exceptions_get_and_clear_exception
1013 L00$_exceptions_get_and_clear_exception:
1015 addis r11,r11,ha16(L_exceptions_get_and_clear_exception$lazy_ptr - L00$_exceptions_get_and_clear_exception)
1017 lwzu r12,lo16(L_exceptions_get_and_clear_exception$lazy_ptr - L00$_exceptions_get_and_clear_exception)(r11)
1021 .lazy_symbol_pointer
1022 L_exceptions_get_and_clear_exception$lazy_ptr:
1023 .indirect_symbol _exceptions_get_and_clear_exception
1024 .long dyld_stub_binding_helper
1027 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1029 L_exceptions_asm_new_abstractmethoderror$stub:
1030 .indirect_symbol _exceptions_asm_new_abstractmethoderror
1032 bcl 20,31,L00$_exceptions_asm_new_abstractmethoderror
1033 L00$_exceptions_asm_new_abstractmethoderror:
1035 addis r11,r11,ha16(L_exceptions_asm_new_abstractmethoderror$lazy_ptr - L00$_exceptions_asm_new_abstractmethoderror)
1037 lwzu r12,lo16(L_exceptions_asm_new_abstractmethoderror$lazy_ptr - L00$_exceptions_asm_new_abstractmethoderror)(r11)
1041 .lazy_symbol_pointer
1042 L_exceptions_asm_new_abstractmethoderror$lazy_ptr:
1043 .indirect_symbol _exceptions_asm_new_abstractmethoderror
1044 .long dyld_stub_binding_helper
1047 # if defined(ENABLE_REPLACEMENT)
1049 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1052 .indirect_symbol _replace_me
1054 bcl 20,31,L00$_replace_me
1057 addis r11,r11,ha16(L_replace_me$lazy_ptr - L00$_replace_me)
1059 lwzu r12,lo16(L_replace_me$lazy_ptr - L00$_replace_me)(r11)
1063 .lazy_symbol_pointer
1064 L_replace_me$lazy_ptr:
1065 .indirect_symbol _replace_me
1066 .long dyld_stub_binding_helper
1069 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1071 L_replace_build_execution_state$stub:
1072 .indirect_symbol _replace_build_execution_state
1074 bcl 20,31,L00$_replace_build_execution_state
1075 L00$_replace_build_execution_state:
1077 addis r11,r11,ha16(L_replace_build_execution_state$lazy_ptr - L00$_replace_build_execution_state)
1079 lwzu r12,lo16(L_replace_build_execution_state$lazy_ptr - L00$_replace_build_execution_state)(r11)
1083 .lazy_symbol_pointer
1084 L_replace_build_execution_state$lazy_ptr:
1085 .indirect_symbol _replace_build_execution_state
1086 .long dyld_stub_binding_helper
1089 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1091 L_replace_free_safestack$stub:
1092 .indirect_symbol _replace_free_safestack
1094 bcl 20,31,L00$_replace_free_safestack
1095 L00$_replace_free_safestack:
1097 addis r11,r11,ha16(L_replace_free_safestack$lazy_ptr - L00$_replace_free_safestack)
1099 lwzu r12,lo16(L_replace_free_safestack$lazy_ptr - L00$_replace_free_safestack)(r11)
1103 .lazy_symbol_pointer
1104 L_replace_free_safestack$lazy_ptr:
1105 .indirect_symbol _replace_free_safestack
1106 .long dyld_stub_binding_helper
1108 # endif /* ENABLE_REPLACEMENT */
1110 #endif /* defined(__DARWIN__) */
1113 /* disable exec-stacks ********************************************************/
1115 #if defined(__linux__) && defined(__ELF__)
1116 .section .note.GNU-stack,"",%progbits
1121 * These are local overrides for various environment variables in Emacs.
1122 * Please do not remove this and leave it at the end of the file, where
1123 * Emacs will automagically detect them.
1124 * ---------------------------------------------------------------------
1127 * indent-tabs-mode: t
1131 * vim:noexpandtab:sw=4:ts=4: