1 /* src/vm/jit/alpha/asmpart.S - Java-C interface functions for alpha
3 Copyright (C) 1996-2005, 2006 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 Contact: cacao@cacaojvm.org
27 Authors: Andreas Krall
30 Changes: Joseph Wenninger
34 $Id: asmpart.S 4921 2006-05-15 14:24:36Z twisti $
41 #include "vm/jit/alpha/md-abi.h"
42 #include "vm/jit/alpha/md-asm.h"
43 #include "vm/jit/alpha/offsets.h"
45 #include "vm/jit/abi-asm.h"
46 #include "vm/jit/methodheader.h"
54 /* export functions ***********************************************************/
56 .globl asm_vm_call_method
57 .globl asm_vm_call_method_int
58 .globl asm_vm_call_method_long
59 .globl asm_vm_call_method_float
60 .globl asm_vm_call_method_double
61 .globl asm_vm_call_method_exception_handler
63 .globl asm_call_jit_compiler
64 .globl asm_handle_exception
65 .globl asm_handle_nat_exception
67 .globl asm_wrapper_patcher
69 .globl asm_replacement_out
70 .globl asm_replacement_in
72 .globl asm_perform_threadswitch
73 .globl asm_initialize_thread_stack
74 .globl asm_switchstackandcall
75 .globl asm_criticalsections
76 .globl asm_getclassvalues_atomic
82 /* asm_vm_call_method **********************************************************
84 * This function calls a Java-method (which possibly needs compilation) *
85 * with up to 4 address parameters. *
87 * This functions calls the JIT-compiler which eventually translates the *
88 * method into machine code. *
91 * javaobject_header *asm_calljavafunction (methodinfo *m, *
92 * void *arg1, void *arg2, void *arg3, void *arg4); *
94 *******************************************************************************/
96 .ent asm_vm_call_method
100 .quad 0 /* catch type all */
101 .quad 0 /* handler pc */
103 .quad 0 /* start pc */
104 .long 1 /* extable size */
105 .long 0 /* ALIGNMENT PADDING */
106 .quad 0 /* line number table start */
107 .quad 0 /* line number table size */
108 .long 0 /* ALIGNMENT PADDING */
109 .long 0 /* fltsave */
110 .long 1 /* intsave */
113 .long 0 /* frame size */
114 .quad 0 /* method pointer (pointer to name) */
117 asm_vm_call_method_int:
118 asm_vm_call_method_long:
119 asm_vm_call_method_float:
120 asm_vm_call_method_double:
122 lda sp,-5*8(sp) /* allocate stack space */
123 stq ra,0*8(sp) /* save return address */
124 stq gp,1*8(sp) /* save global pointer */
127 stq a0,4*8(sp) /* save method pointer for compiler */
129 mov a2,t0 /* pointer to arg block */
130 mov a1,s6 /* arg count */
132 ble s6,calljava_argsloaded
134 ldq a0,offvmargdata(t0)
135 ldt $f16,offvmargdata(t0)
136 ble s6,calljava_argsloaded
139 ldq a1,offvmargdata+sizevmarg*1(t0)
140 ldt $f17,offvmargdata+sizevmarg*1(t0)
141 ble s6,calljava_argsloaded
144 ldq a2,offvmargdata+sizevmarg*2(t0)
145 ldt $f18,offvmargdata+sizevmarg*2(t0)
146 ble s6,calljava_argsloaded
149 ldq a3,offvmargdata+sizevmarg*3(t0)
150 ldt $f19,offvmargdata+sizevmarg*3(t0)
151 ble s6,calljava_argsloaded
154 ldq a4,offvmargdata+sizevmarg*4(t0)
155 ldt $f20,offvmargdata+sizevmarg*4(t0)
156 ble s6,calljava_argsloaded
159 ldq a5,offvmargdata+sizevmarg*5(t0)
160 ldt $f21,offvmargdata+sizevmarg*5(t0)
163 ble s6,calljava_nocopy
169 ldq t3,offvmargdata+sizevmarg*6(t0)
174 bne t1,calljava_copyloop
177 ldq itmp1,4*8(t4) /* pass method pointer via itmp1 */
179 lda mptr,asm_call_jit_compiler/* fake virtual function call (2 instr) */
180 stq mptr,2*8(t4) /* store function address */
181 lda mptr,1*8(t4) /* set method pointer */
183 ldq pv,1*8(mptr) /* method call as in Java */
184 jmp ra,(pv) /* call JIT compiler */
186 lda pv,(asm_vm_call_method - calljava_jit2)(ra)
190 ldq ra,0*8(sp) /* restore return address */
191 ldq gp,1*8(sp) /* restore global pointer */
193 lda sp,5*8(sp) /* free stack space */
198 asm_vm_call_method_exception_handler:
200 ldq gp,1*8(sp) /* restore global pointer */
202 jsr ra,builtin_throw_exception
203 ldq ra,0*8(sp) /* restore return address */
205 lda sp,5*8(sp) /* free stack space */
208 .end asm_vm_call_method
211 /* asm_call_jit_compiler *******************************************************
213 Invokes the compiler for untranslated Java methods.
215 *******************************************************************************/
217 .ent asm_call_jit_compiler
219 asm_call_jit_compiler:
221 lda sp,-(ARG_CNT+2)*8(sp) /* +2: keep stack 16-byte aligned */
223 stq ra,0*8(sp) /* save return address */
225 SAVE_ARGUMENT_REGISTERS(1) /* save 6 int/6 float argument registers */
227 mov itmp1,a0 /* pass methodinfo pointer */
228 mov mptr,a1 /* pass method pointer */
229 lda a2,(ARG_CNT+2)*8(sp) /* pass java sp */
231 jsr ra,jit_asm_compile /* call jit compiler */
234 ldq ra,0*8(sp) /* load return address */
236 RESTORE_ARGUMENT_REGISTERS(1) /* restore 6 int/6 float argument registers */
238 lda sp,(ARG_CNT+2)*8(sp) /* remove stack frame */
240 beq pv,L_asm_call_jit_compiler_exception
242 jmp zero,(pv) /* and call method, the method returns */
243 /* directly to the caller (ra). */
245 L_asm_call_jit_compiler_exception:
246 #if defined(ENABLE_THREADS)
248 stq ra,0*8(sp) /* save return address (xpc) */
249 jsr ra,builtin_asm_get_exceptionptrptr
250 ldq ra,0*8(sp) /* restore return address (xpc) */
255 ldq xptr,0(v0) /* get the exception pointer */
256 stq zero,0(v0) /* clear the exception pointer */
259 br L_asm_handle_nat_exception
261 .end asm_call_jit_compiler
264 /* asm_handle_exception ********************************************************
266 This function handles an exception. It does not use the usual calling
267 conventions. The exception pointer is passed in REG_ITMP1 and the
268 pc from the exception raising position is passed in REG_ITMP2. It searches
269 the local exception table for a handler. If no one is found, it unwinds
270 stacks and continues searching the callers.
272 ATTENTION: itmp3 == gp!
274 *******************************************************************************/
276 .ent asm_handle_nat_exception
278 asm_handle_nat_exception:
279 L_asm_handle_nat_exception: /* required for PIC code */
280 ldl t0,0(ra) /* load instruction LDA PV,xxx(RA) */
282 sra t0,48,t0 /* isolate offset */
283 addq t0,ra,pv /* compute update address */
284 ldl t0,4(ra) /* load instruction LDAH PV,xxx(PV) */
285 srl t0,16,t0 /* isolate instruction code */
286 lda t0,-0x177b(t0) /* test for LDAH */
287 bne t0,L_asm_handle_exception
288 ldl t0,4(ra) /* load instruction LDAH PV,xxx(PV) */
289 sll t0,16,t0 /* compute high offset */
290 addl t0,0,t0 /* sign extend high offset */
291 addq t0,pv,pv /* compute update address */
293 .aent asm_handle_exception
295 asm_handle_exception:
296 L_asm_handle_exception: /* required for PIC code */
297 lda sp,-(ARG_CNT+TMP_CNT)*8(sp) /* create maybe-leaf stackframe */
299 SAVE_ARGUMENT_REGISTERS(0) /* we save arg and temp registers in */
300 SAVE_TEMPORARY_REGISTERS(ARG_CNT) /* case this is a leaf method */
302 lda a3,(ARG_CNT+TMP_CNT)*8(zero)/* prepare a3 for handle_exception */
303 lda a4,1(zero) /* set maybe-leaf flag */
305 L_asm_handle_exception_stack_loop:
306 lda sp,-5*8(sp) /* allocate stack */
307 stq xptr,0*8(sp) /* save exception pointer */
308 stq xpc,1*8(sp) /* save exception pc */
309 stq pv,2*8(sp) /* save data segment pointer */
310 stq ra,3*8(sp) /* save return address */
311 addq a3,sp,a3 /* calculate Java sp into a3... */
313 stq a4,4*8(sp) /* save maybe-leaf flag */
315 br ra,L_asm_handle_exception_load_gp /* set ra for gp loading */
316 L_asm_handle_exception_load_gp:
317 ldgp gp,0(ra) /* load gp */
319 mov xptr,a0 /* pass exception pointer */
320 mov xpc,a1 /* pass exception pc */
321 mov pv,a2 /* pass data segment pointer */
322 /* a3 is still set */
323 jsr ra,exceptions_handle_exception
325 beq v0,L_asm_handle_exception_not_catched
327 mov v0,xpc /* move handlerpc into xpc */
328 ldq xptr,0*8(sp) /* restore exception pointer */
329 ldq pv,2*8(sp) /* restore data segment pointer */
330 ldq ra,3*8(sp) /* restore return address */
331 ldq a4,4*8(sp) /* get maybe-leaf flag */
332 lda sp,5*8(sp) /* free stack frame */
334 beq a4,L_asm_handle_exception_no_leaf
336 RESTORE_ARGUMENT_REGISTERS(0) /* if this is a leaf method, we have */
337 RESTORE_TEMPORARY_REGISTERS(ARG_CNT)/* to restore arg and temp registers */
339 lda sp,(ARG_CNT+TMP_CNT)*8(sp) /* remove maybe-leaf stackframe */
341 L_asm_handle_exception_no_leaf:
342 jmp zero,(xpc) /* jump to the handler */
344 L_asm_handle_exception_not_catched:
345 ldq xptr,0*8(sp) /* restore exception pointer */
346 ldq pv,2*8(sp) /* restore data segment pointer */
347 ldq ra,3*8(sp) /* restore return address */
348 ldq a4,4*8(sp) /* get maybe-leaf flag */
351 beq a4,L_asm_handle_exception_no_leaf_stack
353 lda sp,(ARG_CNT+TMP_CNT)*8(sp) /* remove maybe-leaf stackframe */
354 mov zero,a4 /* clear the maybe-leaf flag */
356 L_asm_handle_exception_no_leaf_stack:
357 ldl t0,FrameSize(pv) /* get frame size */
358 addq t0,sp,t0 /* pointer to save area */
360 ldl t1,IsLeaf(pv) /* is leaf procedure */
361 bne t1,L_asm_handle_exception_no_ra_restore
363 ldq ra,-1*8(t0) /* restore ra */
364 subq t0,8,t0 /* t0-- */
366 L_asm_handle_exception_no_ra_restore:
367 mov ra,xpc /* the new xpc is ra */
368 ldl t1,IntSave(pv) /* t1 = saved int register count */
369 br t2,ex_int1 /* t2 = current pc */
371 lda t2,(ex_int2-ex_int1)(t2)
372 negl t1,t1 /* negate register count */
373 s4addq t1,t2,t2 /* t2 = IntSave - register count * 4 */
374 jmp zero,(t2) /* jump to save position */
385 s8addq t1,t0,t0 /* t0 = t0 - 8 * register count */
387 ldl t1,FltSave(pv) /* t1 = saved flt register count */
388 br t2,ex_flt1 /* t2 = current pc */
390 lda t2,(ex_flt2-ex_flt1)(t2)
391 negl t1,t1 /* negate register count */
392 s4addq t1,t2,t2 /* t2 = FltSave - 4 * register count */
393 jmp zero,(t2) /* jump to save position */
405 ldl t0,FrameSize(pv) /* get frame size */
406 addq sp,t0,sp /* unwind stack */
407 mov zero,a3 /* prepare a3 for handle_exception */
409 ldl t0,0(ra) /* load instruction LDA PV,xxx(RA) */
411 sra t0,48,t0 /* isolate offset */
412 addq t0,ra,pv /* compute update address */
413 ldl t0,4(ra) /* load instruction LDAH PV,xxx(PV) */
414 srl t0,16,t0 /* isolate instruction code */
415 lda t0,-0x177b(t0) /* test for LDAH */
416 bne t0,L_asm_handle_exception_stack_loop
417 ldl t0,4(ra) /* load instruction LDAH PV,xxx(RA) */
418 sll t0,16,t0 /* compute high offset */
419 addl t0,0,t0 /* sign extend high offset */
420 addq t0,pv,pv /* compute update address */
422 br L_asm_handle_exception_stack_loop
424 .end asm_handle_nat_exception
427 /* asm_wrapper_patcher *********************************************************
432 40 return address into JIT code (patch position)
433 32 pointer to virtual java_objectheader
434 24 machine code (which is patched back later)
435 16 unresolved class/method/field reference
436 8 data segment displacement from load instructions
437 0 patcher function pointer to call (pv afterwards)
439 ATTENTION: itmp3 == gp! But we don't need gp do call the patcher function.
441 *******************************************************************************/
443 .ent asm_wrapper_patcher
446 lda sp,-((2+12+27+4)*8+sizestackframeinfo)(sp) /* create stack frame */
448 SAVE_RETURN_REGISTERS(0) /* save 1 int/1 float return registers */
449 SAVE_ARGUMENT_REGISTERS(2) /* save 6 int/6 float argument registers */
450 SAVE_TEMPORARY_REGISTERS(14) /* save 11 int/16 float temporary registers */
452 stq itmp1,(2+12+27+0)*8(sp) /* save itmp1 */
453 stq itmp2,(2+12+27+1)*8(sp) /* save itmp2 */
454 stq ra,(2+12+27+2)*8(sp) /* save method return address (for leafs) */
455 stq pv,(2+12+27+3)*8(sp) /* save pv of calling java function */
457 br ra,L_asm_wrapper_patcher_load_gp
458 L_asm_wrapper_patcher_load_gp:
459 ldgp gp,0(ra) /* load gp (it's not set correctly in jit) */
461 lda a0,(2+12+27+4)*8(sp) /* create stackframe info */
462 mov pv,a1 /* pass java pv */
463 lda a2,((6+2+12+27+4)*8+sizestackframeinfo)(sp) /* pass java sp */
464 ldq a3,(2+12+27+2)*8(sp) /* this is correct for leafs */
465 ldq a4,((5+2+12+27+4)*8+sizestackframeinfo)(sp) /* pass xpc */
466 jsr ra,stacktrace_create_extern_stackframeinfo
469 lda a0,((0+2+12+27+4)*8+sizestackframeinfo)(sp) /* pass sp */
470 ldq pv,((0+2+12+27+4)*8+sizestackframeinfo)(sp) /* get function */
471 ldq itmp1,(2+12+27+3)*8(sp) /* save pv to the position of fp */
472 stq itmp1,((0+2+12+27+4)*8+sizestackframeinfo)(sp)
473 jmp ra,(pv) /* call the patcher function */
475 stq v0,((0+2+12+27+4)*8+sizestackframeinfo)(sp) /* save return value */
477 lda a0,(2+12+27+4)*8(sp) /* remove stackframe info */
478 jsr ra,stacktrace_remove_stackframeinfo
481 RESTORE_RETURN_REGISTERS(0) /* restore 1 int/1 float return registers */
482 RESTORE_ARGUMENT_REGISTERS(2) /* restore 6 int/6 float argument registers */
483 RESTORE_TEMPORARY_REGISTERS(14) /* restore 11 integer temporary registers */
485 ldq itmp1,(2+12+27+0)*8(sp) /* restore itmp1 */
486 ldq itmp2,(2+12+27+1)*8(sp) /* restore itmp2 */
487 ldq ra,(2+12+27+2)*8(sp) /* restore method return address (for leafs)*/
488 ldq pv,(2+12+27+3)*8(sp) /* restore pv of calling java function */
490 ldq itmp3,((0+2+12+27+4)*8+sizestackframeinfo)(sp) /* get return value*/
491 beq itmp3,L_asm_wrapper_patcher_exception
493 ldq itmp3,((5+2+12+27+4)*8+sizestackframeinfo)(sp)/* get RA to JIT */
494 lda sp,((6+2+12+27+4)*8+sizestackframeinfo)(sp) /* remove stack frame */
496 jmp zero,(itmp3) /* jump to new patched code */
498 L_asm_wrapper_patcher_exception:
499 ldq xpc,((5+2+12+27+4)*8+sizestackframeinfo)(sp) /* RA is xpc */
500 lda sp,((6+2+12+27+4)*8+sizestackframeinfo)(sp) /* remove stack frame */
502 br itmp1,L_asm_wrapper_patcher_exception_load_gp
503 L_asm_wrapper_patcher_exception_load_gp:
504 ldgp gp,0(itmp1) /* itmp3 == gp, load the current gp */
506 #if defined(ENABLE_THREADS)
508 stq xpc,0*8(sp) /* save return address (xpc) */
511 jsr ra,builtin_asm_get_exceptionptrptr
512 ldq xpc,0*8(sp) /* restore return address (xpc) */
519 ldq xptr,0(v0) /* get the exception pointer */
520 stq zero,0(v0) /* clear the exception pointer */
521 br L_asm_handle_exception/* we have the pv of the calling java func. */
523 .end asm_wrapper_patcher
526 /* asm_replacement_out *********************************************************
528 This code is jumped to from the replacement-out stubs that are executed
529 when a thread reaches an activated replacement point.
531 The purpose of asm_replacement_out is to read out the parts of the
532 execution state that cannot be accessed from C code, store this state,
533 and then call the C function replace_me.
536 16 start of stack inside method to replace
537 0 rplpoint * info on the replacement point that was reached
539 NOTE: itmp3 has been clobbered by the replacement-out stub!
541 *******************************************************************************/
543 /* some room to accomodate changes of the stack frame size during replacement */
544 /* XXX we should find a cleaner solution here */
545 #define REPLACEMENT_ROOM 512
547 #define REPLACEMENT_STACK_OFFSET ((sizeexecutionstate + REPLACEMENT_ROOM + 0xf) & ~0xf)
549 .ent asm_replacement_out
552 /* create stack frame */
553 lda sp,-(REPLACEMENT_STACK_OFFSET)(sp)
555 /* save registers in execution state */
556 stq $0 ,( 0*8+offes_intregs)(sp)
557 stq $1 ,( 1*8+offes_intregs)(sp)
558 stq $2 ,( 2*8+offes_intregs)(sp)
559 stq $3 ,( 3*8+offes_intregs)(sp)
560 stq $4 ,( 4*8+offes_intregs)(sp)
561 stq $5 ,( 5*8+offes_intregs)(sp)
562 stq $6 ,( 6*8+offes_intregs)(sp)
563 stq $7 ,( 7*8+offes_intregs)(sp)
564 stq $8 ,( 8*8+offes_intregs)(sp)
565 stq $9 ,( 9*8+offes_intregs)(sp)
566 stq $10,(10*8+offes_intregs)(sp)
567 stq $11,(11*8+offes_intregs)(sp)
568 stq $12,(12*8+offes_intregs)(sp)
569 stq $13,(13*8+offes_intregs)(sp)
570 stq $14,(14*8+offes_intregs)(sp)
571 stq $15,(15*8+offes_intregs)(sp)
572 stq $16,(16*8+offes_intregs)(sp)
573 stq $17,(17*8+offes_intregs)(sp)
574 stq $18,(18*8+offes_intregs)(sp)
575 stq $19,(19*8+offes_intregs)(sp)
576 stq $20,(20*8+offes_intregs)(sp)
577 stq $21,(21*8+offes_intregs)(sp)
578 stq $22,(22*8+offes_intregs)(sp)
579 stq $23,(23*8+offes_intregs)(sp)
580 stq $24,(24*8+offes_intregs)(sp)
581 stq $25,(25*8+offes_intregs)(sp)
582 stq $26,(26*8+offes_intregs)(sp)
583 stq $27,(27*8+offes_intregs)(sp)
584 stq $28,(28*8+offes_intregs)(sp)
585 stq $29,(29*8+offes_intregs)(sp)
586 stq $30,(30*8+offes_intregs)(sp)
587 stq $31,(31*8+offes_intregs)(sp)
589 stt $f0 ,( 0*8+offes_fltregs)(sp)
590 stt $f1 ,( 1*8+offes_fltregs)(sp)
591 stt $f2 ,( 2*8+offes_fltregs)(sp)
592 stt $f3 ,( 3*8+offes_fltregs)(sp)
593 stt $f4 ,( 4*8+offes_fltregs)(sp)
594 stt $f5 ,( 5*8+offes_fltregs)(sp)
595 stt $f6 ,( 6*8+offes_fltregs)(sp)
596 stt $f7 ,( 7*8+offes_fltregs)(sp)
597 stt $f8 ,( 8*8+offes_fltregs)(sp)
598 stt $f9 ,( 9*8+offes_fltregs)(sp)
599 stt $f10,(10*8+offes_fltregs)(sp)
600 stt $f11,(11*8+offes_fltregs)(sp)
601 stt $f12,(12*8+offes_fltregs)(sp)
602 stt $f13,(13*8+offes_fltregs)(sp)
603 stt $f14,(14*8+offes_fltregs)(sp)
604 stt $f15,(15*8+offes_fltregs)(sp)
605 stt $f16,(16*8+offes_fltregs)(sp)
606 stt $f17,(17*8+offes_fltregs)(sp)
607 stt $f18,(18*8+offes_fltregs)(sp)
608 stt $f19,(19*8+offes_fltregs)(sp)
609 stt $f20,(20*8+offes_fltregs)(sp)
610 stt $f21,(21*8+offes_fltregs)(sp)
611 stt $f22,(22*8+offes_fltregs)(sp)
612 stt $f23,(23*8+offes_fltregs)(sp)
613 stt $f24,(24*8+offes_fltregs)(sp)
614 stt $f25,(25*8+offes_fltregs)(sp)
615 stt $f26,(26*8+offes_fltregs)(sp)
616 stt $f27,(27*8+offes_fltregs)(sp)
617 stt $f28,(28*8+offes_fltregs)(sp)
618 stt $f29,(29*8+offes_fltregs)(sp)
619 stt $f30,(30*8+offes_fltregs)(sp)
620 stt $f31,(31*8+offes_fltregs)(sp)
622 /* calculate sp of method */
623 lda itmp1,(REPLACEMENT_STACK_OFFSET + 2*8)(sp)
624 stq itmp1,(offes_sp)(sp)
626 br ra,L_asm_replacement_out_load_gp
627 L_asm_replacement_out_load_gp:
628 ldgp gp,0(ra) /* load gp */
631 stq pv,(offes_pv)(sp)
633 /* call replace_me */
634 ldq a0,-(2*8)(itmp1) /* arg0: rplpoint * */
635 mov sp,a1 /* arg1: execution state */
636 jmp zero,replace_me /* call C function replace_me */
637 jmp zero,abort /* NEVER REACHED */
639 .end asm_replacement_out
641 /* asm_replacement_in **********************************************************
643 This code writes the given execution state and jumps to the replacement
646 This function never returns!
648 NOTE: itmp3 is not restored!
651 void asm_replacement_in(executionstate *es);
653 *******************************************************************************/
655 .ent asm_replacement_in
658 /* a0 == executionstate *es */
660 /* set new sp and pv */
661 ldq sp,(offes_sp)(a0)
662 ldq pv,(offes_pv)(a0)
664 /* copy registers from execution state */
665 ldq $0 ,( 0*8+offes_intregs)(a0)
666 ldq $1 ,( 1*8+offes_intregs)(a0)
667 ldq $2 ,( 2*8+offes_intregs)(a0)
668 ldq $3 ,( 3*8+offes_intregs)(a0)
669 ldq $4 ,( 4*8+offes_intregs)(a0)
670 ldq $5 ,( 5*8+offes_intregs)(a0)
671 ldq $6 ,( 6*8+offes_intregs)(a0)
672 ldq $7 ,( 7*8+offes_intregs)(a0)
673 ldq $8 ,( 8*8+offes_intregs)(a0)
674 ldq $9 ,( 9*8+offes_intregs)(a0)
675 ldq $10,(10*8+offes_intregs)(a0)
676 ldq $11,(11*8+offes_intregs)(a0)
677 ldq $12,(12*8+offes_intregs)(a0)
678 ldq $13,(13*8+offes_intregs)(a0)
679 ldq $14,(14*8+offes_intregs)(a0)
680 ldq $15,(15*8+offes_intregs)(a0)
681 /* a0 is loaded below */
682 ldq $17,(17*8+offes_intregs)(a0)
683 ldq $18,(18*8+offes_intregs)(a0)
684 ldq $19,(19*8+offes_intregs)(a0)
685 ldq $20,(20*8+offes_intregs)(a0)
686 ldq $21,(21*8+offes_intregs)(a0)
687 ldq $22,(22*8+offes_intregs)(a0)
688 ldq $23,(23*8+offes_intregs)(a0)
689 ldq $24,(24*8+offes_intregs)(a0)
690 ldq $25,(25*8+offes_intregs)(a0)
691 ldq $26,(26*8+offes_intregs)(a0)
693 ldq $28,(28*8+offes_intregs)(a0)
694 ldq $29,(29*8+offes_intregs)(a0)
698 ldt $f0 ,( 0*8+offes_fltregs)(a0)
699 ldt $f1 ,( 1*8+offes_fltregs)(a0)
700 ldt $f2 ,( 2*8+offes_fltregs)(a0)
701 ldt $f3 ,( 3*8+offes_fltregs)(a0)
702 ldt $f4 ,( 4*8+offes_fltregs)(a0)
703 ldt $f5 ,( 5*8+offes_fltregs)(a0)
704 ldt $f6 ,( 6*8+offes_fltregs)(a0)
705 ldt $f7 ,( 7*8+offes_fltregs)(a0)
706 ldt $f8 ,( 8*8+offes_fltregs)(a0)
707 ldt $f9 ,( 9*8+offes_fltregs)(a0)
708 ldt $f10,(10*8+offes_fltregs)(a0)
709 ldt $f11,(11*8+offes_fltregs)(a0)
710 ldt $f12,(12*8+offes_fltregs)(a0)
711 ldt $f13,(13*8+offes_fltregs)(a0)
712 ldt $f14,(14*8+offes_fltregs)(a0)
713 ldt $f15,(15*8+offes_fltregs)(a0)
714 ldt $f16,(16*8+offes_fltregs)(a0)
715 ldt $f17,(17*8+offes_fltregs)(a0)
716 ldt $f18,(18*8+offes_fltregs)(a0)
717 ldt $f19,(19*8+offes_fltregs)(a0)
718 ldt $f20,(20*8+offes_fltregs)(a0)
719 ldt $f21,(21*8+offes_fltregs)(a0)
720 ldt $f22,(22*8+offes_fltregs)(a0)
721 ldt $f23,(23*8+offes_fltregs)(a0)
722 ldt $f24,(24*8+offes_fltregs)(a0)
723 ldt $f25,(25*8+offes_fltregs)(a0)
724 ldt $f26,(26*8+offes_fltregs)(a0)
725 ldt $f27,(27*8+offes_fltregs)(a0)
726 ldt $f28,(28*8+offes_fltregs)(a0)
727 ldt $f29,(29*8+offes_fltregs)(a0)
728 ldt $f30,(30*8+offes_fltregs)(a0)
729 ldt $f31,(31*8+offes_fltregs)(a0)
733 ldq itmp3,offes_pc(a0)
737 ldq a0,(16*8+offes_intregs)(a0)
739 /* jump to new code */
743 .end asm_replacement_in
745 /******************* function asm_initialize_thread_stack **********************
747 * initialized a thread stack *
749 *******************************************************************************/
751 .ent asm_initialize_thread_stack
753 asm_initialize_thread_stack:
774 .end asm_initialize_thread_stack
777 /******************* function asm_perform_threadswitch *************************
779 * void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop); *
781 * performs a threadswitch *
783 *******************************************************************************/
785 .ent asm_perform_threadswitch
787 asm_perform_threadswitch:
828 .end asm_perform_threadswitch
831 /********************* function asm_switchstackandcall *************************
833 * void *asm_switchstackandcall (void *stack, void *func, void **stacktopsave, *
836 * Switches to a new stack, calls a function and switches back. *
837 * a0 new stack pointer *
838 * a1 function pointer *
839 * a2 pointer to variable where stack top should be stored *
840 * a3 pointer to user data, is passed to the function *
842 *******************************************************************************/
845 .ent asm_switchstackandcall
847 asm_switchstackandcall:
848 lda a0,-2*8(a0) /* allocate new stack */
849 stq ra,0(a0) /* save return address on new stack */
850 stq sp,1*8(a0) /* save old stack pointer on new stack */
851 stq sp,0(a2) /* save old stack pointer to variable */
852 mov a0,sp /* switch to new stack */
854 mov a1,pv /* load function pointer */
855 mov a3,a0 /* pass pointer */
856 jmp ra,(pv) /* and call function */
858 ldq ra,0(sp) /* load return address */
859 ldq sp,1*8(sp) /* switch to old stack */
861 jmp zero,(ra) /* return */
863 .end asm_switchstackandcall
866 .ent asm_getclassvalues_atomic
868 asm_getclassvalues_atomic:
871 ldl t0,offbaseval(a0)
872 ldl t1,offdiffval(a0)
873 ldl t2,offbaseval(a1)
875 stl t0,offcast_super_baseval(a2)
876 stl t1,offcast_super_diffval(a2)
877 stl t2,offcast_sub_baseval(a2)
880 .end asm_getclassvalues_atomic
885 asm_criticalsections:
886 #if defined(ENABLE_THREADS)
894 /* asm_md_init *****************************************************************
896 Initialize machine dependent stuff.
898 Determines if the byte support instruction set (21164a and higher)
901 *******************************************************************************/
906 .long 0x47e03c20 /* amask 1,v0 */
907 jmp zero,(ra) /* return */
912 /* asm_cacheflush **************************************************************
916 *******************************************************************************/
921 call_pal PAL_imb /* synchronize instruction cache */
927 /* Disable exec-stacks, required for Gentoo ***********************************/
929 #if defined(__GCC__) && defined(__ELF__)
930 .section .note.GNU-stack,"",@progbits
935 * These are local overrides for various environment variables in Emacs.
936 * Please do not remove this and leave it at the end of the file, where
937 * Emacs will automagically detect them.
938 * ---------------------------------------------------------------------
941 * indent-tabs-mode: t
945 * vim:noexpandtab:sw=4:ts=4: