1 /* -*- mode: asm; tab-width: 4 -*- */
2 /****************************** asmpart.c **************************************
4 * is an assembly language file, but called .c to fake the preprocessor. *
5 * It contains the Java-C interface functions for Alpha processors. *
7 * Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst *
9 * See file COPYRIGHT for information on usage and disclaimer of warranties *
11 * Authors: Andreas Krall EMAIL: cacao@complang.tuwien.ac.at *
12 * Reinhard Grafl EMAIL: cacao@complang.tuwien.ac.at *
14 * Last Change: 1998/11/01 *
16 *******************************************************************************/
85 /********************* exported functions and variables ***********************/
87 .globl has_no_x_instr_set
88 .globl synchronize_caches
89 .globl asm_calljavamethod
90 .globl asm_call_jit_compiler
91 .globl asm_dumpregistersandcall
92 .globl asm_handle_exception
93 .globl asm_handle_nat_exception
94 .globl asm_signal_exception
95 .globl asm_builtin_checkarraycast
96 .globl asm_builtin_aastore
97 .globl asm_builtin_monitorenter
98 .globl asm_builtin_monitorexit
99 .globl asm_builtin_idiv
100 .globl asm_builtin_irem
101 .globl asm_builtin_ldiv
102 .globl asm_builtin_lrem
103 .globl perform_alpha_threadswitch
104 .globl initialize_thread_stack
105 .globl asm_switchstackandcall
108 /*************************** imported variables *******************************/
113 /*************************** imported functions *******************************/
115 .globl compiler_compile
116 .globl builtin_monitorexit
117 .globl builtin_throw_exception
118 .globl builtin_trace_exception
119 .globl class_java_lang_Object
122 /*********************** function has_no_x_instr_set ***************************
124 * determines if the byte support instruction set (21164a and higher) *
127 *******************************************************************************/
129 .ent has_no_x_instr_set
132 .long 0x47e03c20 /* amask 1,v0 */
133 jmp zero,(ra) /* return */
135 .end has_no_x_instr_set
138 /********************* function synchronize_caches ****************************/
140 .ent synchronize_caches
143 call_pal PAL_imb /* synchronise instruction cache */
144 jmp zero,(ra) /* return */
146 .end synchronize_caches
149 /********************* function asm_calljavamethod *****************************
151 * This function calls a Java-method (which possibly needs compilation) *
152 * with up to 4 parameters. *
154 * This functions calls the JIT-compiler which eventually translates the *
155 * method into machine code. *
157 * An possibly throwed exception will be returned to the caller as function *
158 * return value, so the java method cannot return a fucntion value (this *
159 * function usually calls 'main' and '<clinit>' which do not return a *
163 * javaobject_header *asm_calljavamethod (methodinfo *m, *
164 * void *arg1, void *arg2, void *arg3, void *arg4); *
166 *******************************************************************************/
168 #define MethodPointer -8
169 #define FrameSize -12
174 #define ExTableSize -32
175 #define ExTableStart -32
177 #define ExEntrySize -32
180 #define ExHandlerPC -24
181 #define ExCatchType -32
183 .ent asm_calljavamethod
186 .ascii "calljavamethod\0\0"
189 .quad 0 /* catch type all */
190 .quad calljava_xhandler /* end pc */
191 .quad calljava_xhandler /* end pc */
192 .quad asm_calljavamethod /* start pc */
193 .long 1 /* extable size */
194 .long 0 /* fltsave */
195 .long 0 /* intsave */
198 .long 32 /* frame size */
199 .quad 0 /* method pointer (pointer to name) */
204 lda sp,-32(sp) /* allocate stack space */
205 stq gp,24(sp) /* save global pointer */
206 stq ra,0(sp) /* save return address */
208 stq a0,16(sp) /* save method pointer for compiler */
209 lda v0,16(sp) /* pass pointer to method pointer via v0*/
211 mov a1,a0 /* pass the remaining parameters */
216 lda $28,asm_call_jit_compiler /* fake virtual function call (2 instr) */
217 stq $28,8(sp) /* store function address */
218 mov sp,$28 /* set method pointer */
220 ldq pv,8($28) /* method call as in Java */
221 jmp ra,(pv) /* call JIT compiler */
223 lda pv,-64(ra) /* asm_calljavamethod-calljava_jit !!!!!*/
227 ldq ra,0(sp) /* restore return address */
228 ldq gp,24(sp) /* restore global pointer */
229 lda sp,32(sp) /* free stack space */
230 ldl v0,newcompiler /* load newcompiler flag */
231 subq v0,1,v0 /* negate for clearing v0 */
232 beq v0,calljava_ret /* if newcompiler skip ex copying */
233 mov $1,v0 /* pass exception to caller (C) */
239 ldq gp,24(sp) /* restore global pointer */
241 jsr ra,builtin_throw_exception
242 ldq ra,0(sp) /* restore return address */
243 lda sp,32(sp) /* free stack space */
245 .end asm_calljavamethod
248 /****************** function asm_call_jit_compiler *****************************
250 * invokes the compiler for untranslated JavaVM methods. *
252 * Register R0 contains a pointer to the method info structure (prepared *
253 * by createcompilerstub). Using the return address in R26 and the *
254 * offset in the LDA instruction or using the value in methodptr R28 the *
255 * patching address for storing the method address can be computed: *
257 * method address was either loaded using *
258 * M_LDQ (REG_PV, REG_PV, a) ; invokestatic/special ($27) *
259 * M_LDA (REG_PV, REG_RA, low) *
260 * M_LDAH(REG_PV, REG_RA, high) ; optional *
262 * M_LDQ (REG_PV, REG_METHODPTR, m) ; invokevirtual/interface ($28) *
263 * in the static case the method pointer can be computed using the *
264 * return address and the lda function following the jmp instruction *
266 *******************************************************************************/
269 .ent asm_call_jit_compiler
270 asm_call_jit_compiler:
273 ldl t8,-8(ra) /* load instruction LDQ PV,xxx($yy) */
274 srl t8,16,t8 /* shift right register number $yy */
275 and t8,31,t8 /* isolate register number */
276 subl t8,28,t8 /* test for REG_METHODPTR */
278 ldl t8,0(ra) /* load instruction LDA PV,xxx(RA) */
280 sra t8,48,t8 /* isolate offset */
281 addq t8,ra,$28 /* compute update address */
282 ldl t8,4(ra) /* load instruction LDAH PV,xxx(PV) */
283 srl t8,16,t8 /* isolate instruction code */
284 lda t8,-0x177b(t8) /* test for LDAH */
286 ldl t8,0(ra) /* load instruction LDA PV,xxx(RA) */
287 sll t8,16,t8 /* compute high offset */
288 addl t8,0,t8 /* sign extend high offset */
289 addq t8,$28,$28 /* compute update address */
291 lda sp,-14*8(sp) /* reserve stack space */
292 stq a0,0*8(sp) /* save all argument registers */
293 stq a1,1*8(sp) /* they could be used by method */
304 stq $28,12*8(sp) /* save method pointer */
305 stq ra,13*8(sp) /* save return address */
307 ldq a0,0(v0) /* pass 'methodinfo' pointer to */
308 jsr ra,compiler_compile /* compiler */
311 call_pal PAL_imb /* synchronise instruction cache */
313 ldq a0,0*8(sp) /* load argument registers */
325 ldq $28,12*8(sp) /* load method pointer */
326 ldq ra,13*8(sp) /* load return address */
327 lda sp,14*8(sp) /* deallocate stack area */
329 ldl t8,-8(ra) /* load instruction LDQ PV,xxx($yy) */
331 sra t8,48,t8 /* isolate offset */
333 addq t8,$28,t8 /* compute update address via method pointer*/
334 stq v0,0(t8) /* save new method address there */
336 mov v0,pv /* load method address into pv */
338 jmp zero,(pv) /* and call method. The method returns */
339 /* directly to the caller (ra). */
341 .end asm_call_jit_compiler
344 /****************** function asm_dumpregistersandcall **************************
346 * This funtion saves all callee saved registers and calls the function *
347 * which is passed as parameter. *
349 * This function is needed by the garbage collector, which needs to access *
350 * all registers which are stored on the stack. Unused registers are *
351 * cleared to avoid interferances with the GC. *
353 * void asm_dumpregistersandcall (functionptr f); *
355 *******************************************************************************/
357 .ent asm_dumpregistersandcall
358 asm_dumpregistersandcall:
359 lda sp,-16*8(sp) /* allocate stack */
360 stq ra,0(sp) /* save return address */
362 stq s0,1*8(sp) /* save all callee saved registers */
363 stq s1,2*8(sp) /* intialize the remaining registers */
378 clr v0 /* intialize the remaining registers */
423 mov a0,pv /* load function pointer */
424 jmp ra,(pv) /* and call function */
426 ldq ra,0(sp) /* load return address */
427 lda sp,16*8(sp) /* deallocate stack */
428 jmp zero,(ra) /* return */
430 .end asm_dumpregistersandcall
433 /********************* function asm_handle_exception ***************************
435 * This function handles an exception. It does not use the usual calling *
436 * conventions. The exception pointer is passed in REG_ITMP1 and the *
437 * pc from the exception raising position is passed in REG_ITMP2. It searches *
438 * the local exception table for a handler. If no one is found, it unwinds *
439 * stacks and continues searching the callers. *
441 * void asm_handle_exception (exceptionptr, exceptionpc); *
443 *******************************************************************************/
445 .ent asm_handle_nat_exception
446 asm_handle_nat_exception:
448 ldl t0,0(ra) /* load instruction LDA PV,xxx(RA) */
450 sra t0,48,t0 /* isolate offset */
451 addq t0,ra,pv /* compute update address */
452 ldl t0,4(ra) /* load instruction LDAH PV,xxx(PV) */
453 srl t0,16,t0 /* isolate instruction code */
454 lda t0,-0x177b(t0) /* test for LDAH */
455 bne t0,asm_handle_exception
456 ldl t0,0(ra) /* load instruction LDA PV,xxx(RA) */
457 sll t0,16,t0 /* compute high offset */
458 addl t0,0,t0 /* sign extend high offset */
459 addq t0,pv,pv /* compute update address */
461 .aent asm_handle_exception
462 asm_handle_exception:
464 lda sp,-18*8(sp) /* allocate stack */
465 stq t0,0*8(sp) /* save possible used registers */
466 stq t1,1*8(sp) /* also registers used by trace_exception */
484 lda t3,1(zero) /* set no unwind flag */
486 lda sp,-5*8(sp) /* allocate stack */
487 stq xptr,0*8(sp) /* save used register */
494 ldq a1,MethodPointer(pv)
497 br ra,ex_trace /* set ra for gp loading */
499 ldgp gp,0(ra) /* load gp */
500 jsr ra,builtin_trace_exception /* trace_exception(xptr,methodptr) */
502 ldq xptr,0*8(sp) /* restore used register */
507 lda sp,5*8(sp) /* deallocate stack */
509 ldl t0,ExTableSize(pv) /* t0 = exception table size */
510 beq t0,empty_table /* if empty table skip */
511 lda t1,ExTableStart(pv) /* t1 = start of exception table */
514 ldq t2,ExStartPC(t1) /* t2 = exception start pc */
515 cmple t2,xpc,t2 /* t2 = (startpc <= xpc) */
516 beq t2,ex_table_cont /* if (false) continue */
517 ldq t2,ExEndPC(t1) /* t2 = exception end pc */
518 cmplt xpc,t2,t2 /* t2 = (xpc < endpc) */
519 beq t2,ex_table_cont /* if (false) continue */
520 ldq a1,ExCatchType(t1) /* arg1 = exception catch type */
521 beq a1,ex_handle_it /* NULL catches everything */
523 ldq a0,offobjvftbl(xptr) /* a0 = vftblptr(xptr) */
524 ldq a1,offobjvftbl(a1) /* a1 = vftblptr(catchtype) class (not obj) */
525 ldl a0,offbaseval(a0) /* a0 = baseval(xptr) */
526 ldl v0,offbaseval(a1) /* a2 = baseval(catchtype) */
527 ldl a1,offdiffval(a1) /* a1 = diffval(catchtype) */
528 subl a0,v0,a0 /* a0 = baseval(xptr) - baseval(catchtype) */
529 cmpule a0,a1,v0 /* v0 = xptr is instanceof catchtype */
530 beq v0,ex_table_cont /* if (false) continue */
534 ldq xpc,ExHandlerPC(t1) /* xpc = exception handler pc */
536 beq t3,ex_jump /* if (!(no stack unwinding) skip */
538 ldq t0,0*8(sp) /* restore possible used registers */
539 ldq t1,1*8(sp) /* also registers used by trace_exception */
556 lda sp,18*8(sp) /* deallocate stack */
559 jmp zero,(xpc) /* jump to the handler */
562 lda t1,ExEntrySize(t1) /* next exception table entry */
563 subl t0,1,t0 /* decrement entry counter */
564 bgt t0,ex_table_loop /* if (t0 > 0) next entry */
567 beq t3,ex_already_cleared /* if here the first time, then */
568 lda sp,18*8(sp) /* deallocate stack and */
569 clr t3 /* clear the no unwind flag */
571 ldl t0,IsSync(pv) /* t0 = SyncOffset */
572 beq t0,no_monitor_exit /* if zero no monitorexit */
573 addq sp,t0,t0 /* add Offset to stackptr */
574 ldq a0,-8(t0) /* load monitorexit pointer */
576 lda sp,-7*8(sp) /* allocate stack */
577 stq t0,0*8(sp) /* save used register */
585 br ra,ex_mon_load /* set ra for gp loading */
587 ldgp gp,0(ra) /* load gp */
588 jsr ra,builtin_monitorexit/* builtin_monitorexit(objectptr) */
590 ldq t0,0*8(sp) /* restore used register */
597 lda sp,7*8(sp) /* deallocate stack */
600 ldl t0,FrameSize(pv) /* t0 = frame size */
601 addq sp,t0,sp /* unwind stack */
602 mov sp,t0 /* t0 = pointer to save area */
603 ldl t1,IsLeaf(pv) /* t1 = is leaf procedure */
604 bne t1,ex_no_restore /* if (leaf) skip */
605 ldq ra,-8(t0) /* restore ra */
606 lda t0,-8(t0) /* t0-- */
608 mov ra,xpc /* the new xpc is ra */
609 ldl t1,IntSave(pv) /* t1 = saved int register count */
610 br t2,ex_int1 /* t2 = current pc */
612 lda t2,44(t2) /* lda t2,ex_int2-ex_int1(t2) !!!!!!!!!!!!! */
613 negl t1,t1 /* negate register count */
614 s4addq t1,t2,t2 /* t2 = ex_int_sav - 4 * register count */
615 jmp zero,(t2) /* jump to save position */
624 s8addq t1,t0,t0 /* t0 = t0 - 8 * register count */
626 ldl t1,FltSave(pv) /* t1 = saved flt register count */
627 br t2,ex_flt1 /* t2 = current pc */
629 lda t2,48(t2) /* lda t2,ex_flt2-ex_flt1(t2) !!!!!!!!!!!!! */
630 negl t1,t1 /* negate register count */
631 s4addq t1,t2,t2 /* t2 = ex_flt_sav - 4 * register count */
632 jmp zero,(t2) /* jump to save position */
642 ldl t0,0(ra) /* load instruction LDA PV,xxx(RA) */
644 sra t0,48,t0 /* isolate offset */
645 addq t0,ra,pv /* compute update address */
646 ldl t0,4(ra) /* load instruction LDAH PV,xxx(PV) */
647 srl t0,16,t0 /* isolate instruction code */
648 lda t0,-0x177b(t0) /* test for LDAH */
650 ldl t0,0(ra) /* load instruction LDA PV,xxx(RA) */
651 sll t0,16,t0 /* compute high offset */
652 addl t0,0,t0 /* sign extend high offset */
653 addq t0,pv,pv /* compute update address */
656 .end asm_handle_exception
659 /********************* function asm_signal_exception ***************************
661 * This function handles an exception which was catched by a signal. *
663 * void asm_signal_exception (exceptionptr, signalcontext); *
665 *******************************************************************************/
667 #define sigctxstack 0*8 /* sigstack state to restore */
668 #define sigctxmask 1*8 /* signal mask to restore */
669 #define sigctxpc 2*8 /* pc at time of signal */
670 #define sigctxpsl 3*8 /* psl to retore */
671 #define sigctxr00 4*8 /* processor regs 0 to 31 */
672 #define sigctxr01 5*8
673 #define sigctxr02 6*8
674 #define sigctxr03 7*8
675 #define sigctxr04 8*8
676 #define sigctxr05 9*8
677 #define sigctxr06 10*8
678 #define sigctxr07 11*8
679 #define sigctxr08 12*8
680 #define sigctxr09 13*8
681 #define sigctxr10 14*8
682 #define sigctxr11 15*8
683 #define sigctxr12 16*8
684 #define sigctxr13 17*8
685 #define sigctxr14 18*8
686 #define sigctxr15 19*8
687 #define sigctxr16 20*8
688 #define sigctxr17 21*8
689 #define sigctxr18 22*8
690 #define sigctxr19 23*8
691 #define sigctxr20 24*8
692 #define sigctxr21 25*8
693 #define sigctxr22 26*8
694 #define sigctxr23 27*8
695 #define sigctxr24 28*8
696 #define sigctxr25 29*8
697 #define sigctxr26 30*8
698 #define sigctxr27 31*8
699 #define sigctxr28 32*8
700 #define sigctxr29 33*8
701 #define sigctxr30 34*8
702 #define sigctxr31 35*8
704 #define sigctxfpuse 36*8 /* fp has been used */
705 #define sigctxf00 37*8 /* fp regs 0 to 31 */
706 #define sigctxf01 38*8
707 #define sigctxf02 39*8
708 #define sigctxf03 40*8
709 #define sigctxf04 41*8
710 #define sigctxf05 42*8
711 #define sigctxf06 43*8
712 #define sigctxf07 44*8
713 #define sigctxf08 45*8
714 #define sigctxf09 46*8
715 #define sigctxf10 47*8
716 #define sigctxf11 48*8
717 #define sigctxf12 49*8
718 #define sigctxf13 50*8
719 #define sigctxf14 51*8
720 #define sigctxf15 52*8
721 #define sigctxf16 53*8
722 #define sigctxf17 54*8
723 #define sigctxf18 55*8
724 #define sigctxf19 56*8
725 #define sigctxf20 57*8
726 #define sigctxf21 58*8
727 #define sigctxf22 59*8
728 #define sigctxf23 60*8
729 #define sigctxf24 61*8
730 #define sigctxf25 62*8
731 #define sigctxf26 63*8
732 #define sigctxf27 64*8
733 #define sigctxf28 65*8
734 #define sigctxf29 66*8
735 #define sigctxf30 67*8
736 #define sigctxf31 68*8
738 #define sigctxhfpcr 69*8 /* floating point control register */
739 #define sigctxsfpcr 70*8 /* software fpcr */
741 .ent asm_signal_exception
742 asm_signal_exception:
747 ldq v0,sigctxr00(sp) /* restore possible used registers */
771 ldq t10,sigctxr24(sp)
775 br asm_handle_nat_exception
776 .end asm_signal_exception
779 /********************* function asm_builtin_monitorenter ***********************
781 * Does null check and calls monitorenter or throws an exception *
783 *******************************************************************************/
785 .ent asm_builtin_monitorenter
786 asm_builtin_monitorenter:
789 lda pv,builtin_monitorenter
790 beq a0,nb_monitorenter /* if (null) throw exception */
791 jmp zero,(pv) /* else call builtin_monitorenter */
794 ldq xptr,proto_java_lang_NullPointerException
795 lda xpc,-4(ra) /* faulting address is return adress - 4*/
796 br asm_handle_nat_exception
797 .end asm_builtin_monitorenter
800 /********************* function asm_builtin_monitorexit ************************
802 * Does null check and calls monitorexit or throws an exception *
804 *******************************************************************************/
806 .ent asm_builtin_monitorexit
807 asm_builtin_monitorexit:
810 lda pv,builtin_monitorexit
811 beq a0,nb_monitorexit /* if (null) throw exception */
812 jmp zero,(pv) /* else call builtin_monitorexit */
815 ldq xptr,proto_java_lang_NullPointerException
816 lda xpc,-4(ra) /* faulting address is return adress - 4*/
817 br asm_handle_nat_exception
818 .end asm_builtin_monitorenter
821 /************************ function asm_builtin_idiv ****************************
823 * Does null check and calls idiv or throws an exception *
825 *******************************************************************************/
827 .ent asm_builtin_idiv
832 beq a1,nb_idiv /* if (null) throw exception */
833 jmp zero,(pv) /* else call builtin_idiv */
836 ldq xptr,proto_java_lang_ArithmeticException
837 lda xpc,-4(ra) /* faulting address is return adress - 4*/
838 br asm_handle_nat_exception
839 .end asm_builtin_idiv
842 /************************ function asm_builtin_ldiv ****************************
844 * Does null check and calls ldiv or throws an exception *
846 *******************************************************************************/
848 .ent asm_builtin_ldiv
853 beq a1,nb_ldiv /* if (null) throw exception */
854 jmp zero,(pv) /* else call builtin_ldiv */
857 ldq xptr,proto_java_lang_ArithmeticException
858 lda xpc,-4(ra) /* faulting address is return adress - 4*/
859 br asm_handle_nat_exception
860 .end asm_builtin_ldiv
863 /************************ function asm_builtin_irem ****************************
865 * Does null check and calls irem or throws an exception *
867 *******************************************************************************/
869 .ent asm_builtin_irem
874 beq a1,nb_irem /* if (null) throw exception */
875 jmp zero,(pv) /* else call builtin_irem */
878 ldq xptr,proto_java_lang_ArithmeticException
879 lda xpc,-4(ra) /* faulting address is return adress - 4*/
880 br asm_handle_nat_exception
881 .end asm_builtin_irem
884 /************************ function asm_builtin_lrem ****************************
886 * Does null check and calls lrem or throws an exception *
888 *******************************************************************************/
890 .ent asm_builtin_lrem
895 beq a1,nb_lrem /* if (null) throw exception */
896 jmp zero,(pv) /* else call builtin_lrem */
899 ldq xptr,proto_java_lang_ArithmeticException
900 lda xpc,-4(ra) /* faulting address is return adress - 4*/
901 br asm_handle_nat_exception
902 .end asm_builtin_lrem
905 /******************* function asm_builtin_checkarraycast ***********************
907 * Does the cast check and eventually throws an exception *
909 *******************************************************************************/
911 .ent asm_builtin_checkarraycast
912 asm_builtin_checkarraycast:
915 lda sp,-16(sp) /* allocate stack space */
916 stq ra,0(sp) /* save return address */
917 stq a0,8(sp) /* save object pointer */
918 jsr ra,builtin_checkarraycast /* builtin_checkarraycast */
920 beq v0,nb_carray_throw /* if (false) throw exception */
921 ldq ra,0(sp) /* restore return address */
922 ldq v0,8(sp) /* return object pointer */
923 lda sp,16(sp) /* free stack space */
927 ldq xptr,proto_java_lang_ClassCastException
928 ldq ra,0(sp) /* restore return address */
929 lda sp,16(sp) /* free stack space */
930 lda xpc,-4(ra) /* faulting address is return adress - 4*/
931 br asm_handle_nat_exception
932 .end asm_builtin_checkarraycast
935 /******************* function asm_builtin_aastore ******************************
937 * Does the cast check and eventually throws an exception *
939 *******************************************************************************/
941 .ent asm_builtin_aastore
945 beq a0,nb_aastore_null /* if null pointer throw exception */
946 ldl t0,offarraysize(a0) /* load size */
947 lda sp,-24(sp) /* allocate stack space */
948 stq ra,0(sp) /* save return address */
949 s8addq a1,a0,t1 /* add index*8 to arrayref */
950 cmpult a1,t0,t0 /* do bound check */
951 beq t0,nb_aastore_bound /* if out of bounds throw exception */
952 mov a2,a1 /* object is second argument */
953 stq t1,8(sp) /* save store position */
954 stq a1,16(sp) /* save object */
955 jsr ra,builtin_canstore /* builtin_canstore(arrayref,object) */
957 ldq ra,0(sp) /* restore return address */
958 ldq a0,8(sp) /* restore store position */
959 ldq a1,16(sp) /* restore object */
960 lda sp,24(sp) /* free stack space */
961 beq v0,nb_aastore_throw /* if (false) throw exception */
962 stq a1,offobjarrdata(a0) /* store objectptr in array */
966 ldq xptr,proto_java_lang_NullPointerException
967 mov ra,xpc /* faulting address is return adress */
968 br asm_handle_nat_exception
971 ldq xptr,proto_java_lang_ArrayIndexOutOfBoundsException
972 lda sp,24(sp) /* free stack space */
973 mov ra,xpc /* faulting address is return adress */
974 br asm_handle_nat_exception
977 ldq xptr,proto_java_lang_ArrayStoreException
978 mov ra,xpc /* faulting address is return adress */
979 br asm_handle_nat_exception
981 .end asm_builtin_aastore
984 /********************** function initialize_thread_stack ***********************
986 * initialized a thread stack *
988 *******************************************************************************/
990 .ent initialize_thread_stack
991 initialize_thread_stack:
1012 .end initialize_thread_stack
1015 /******************* function perform_alpha_threadswitch ***********************
1017 * void perform_alpha_threadswitch (u1 **from, u1 **to, u1 **stackTop); *
1018 * performs a threadswitch *
1020 *******************************************************************************/
1022 .ent perform_alpha_threadswitch
1023 perform_alpha_threadswitch:
1064 .end perform_alpha_threadswitch
1067 /********************* function asm_switchstackandcall *************************
1069 * Switches to a new stack, calls a function and switches back. *
1070 * a0 new stack pointer *
1071 * a1 function pointer *
1073 *******************************************************************************/
1076 .ent asm_switchstackandcall
1077 asm_switchstackandcall:
1078 lda a0,-2*8(a0) /* allocate new stack */
1079 stq ra,0(a0) /* save return address */
1080 stq sp,1*8(a0) /* save old stack pointer */
1081 mov a0,sp /* switch to new stack */
1083 mov a1,pv /* load function pointer */
1084 jmp ra,(pv) /* and call funciton */
1086 ldq ra,0(sp) /* load return address */
1087 ldq sp,1*8(sp) /* switch to old stack */
1089 jmp zero,(ra) /* return */
1091 .end asm_switchstackandcall