a couple more prerelease fixes
[cacao.git] / alpha / asmpart.c
index d14e67f6a956c8a09dcf15373195a234540c2867..a6ce31b909b81159865fd011d9bc0d8fe392a0ec 100644 (file)
@@ -99,8 +99,8 @@
        .globl asm_builtin_irem
        .globl asm_builtin_ldiv
        .globl asm_builtin_lrem
-       .globl perform_alpha_threadswitch
-       .globl initialize_thread_stack
+       .globl asm_perform_threadswitch
+       .globl asm_initialize_thread_stack
        .globl asm_switchstackandcall
 
 
@@ -186,7 +186,7 @@ call_name:
 
        .align  3
        .quad   0                         /* catch type all                       */
-       .quad   calljava_xhandler         /* end pc                               */
+       .quad   calljava_xhandler         /* handler pc                           */
        .quad   calljava_xhandler         /* end pc                               */
        .quad   asm_calljavamethod        /* start pc                             */
        .long   1                         /* extable size                         */
@@ -569,7 +569,7 @@ empty_table:
 ex_already_cleared:
        ldl     t0,IsSync(pv)         /* t0 = SyncOffset                          */
        beq     t0,no_monitor_exit    /* if zero no monitorexit                   */
-       addq    sp,t0,t0              /* add Offset to stackptr                   */
+       addq    sp,t0,t0              /* add stackptr to Offset                   */
        ldq     a0,-8(t0)             /* load monitorexit pointer                 */
 
        lda     sp,-7*8(sp)           /* allocate stack                           */
@@ -652,7 +652,7 @@ ex_flt2:
        addq    t0,pv,pv              /* compute update address                   */
        br      ex_stack_loop
 
-       .end    asm_handle_exception
+       .end    asm_handle_nat_exception
 
 
 /********************* function asm_builtin_monitorenter ***********************
@@ -694,7 +694,7 @@ nb_monitorexit:
        ldq     xptr,proto_java_lang_NullPointerException
        lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
        br      asm_handle_nat_exception
-       .end    asm_builtin_monitorenter
+       .end    asm_builtin_monitorexit
 
 
 /************************ function asm_builtin_idiv ****************************
@@ -860,14 +860,14 @@ nb_aastore_throw:
        .end    asm_builtin_aastore
 
 
-/********************** function initialize_thread_stack ***********************
+/******************* function asm_initialize_thread_stack **********************
 *                                                                              *
 *   initialized a thread stack                                                 *
 *                                                                              *
 *******************************************************************************/
 
-       .ent    initialize_thread_stack
-initialize_thread_stack:
+       .ent    asm_initialize_thread_stack
+asm_initialize_thread_stack:
 
        lda     a1,-128(a1)
        stq     zero, 0(a1)
@@ -888,21 +888,21 @@ initialize_thread_stack:
        stq     a0, 120(a1)
        mov     a1, v0
        jmp     zero,(ra)
-       .end    initialize_thread_stack
+       .end    asm_initialize_thread_stack
 
 
-/******************* function perform_alpha_threadswitch ***********************
+/******************* function asm_perform_threadswitch *************************
 *                                                                              *
-*   void perform_alpha_threadswitch (u1 **from, u1 **to, u1 **stackTop);       *
+*   void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);         *
 *                                                                              *
 *   performs a threadswitch                                                    *
 *                                                                              *
 *******************************************************************************/
 
-       .ent    perform_alpha_threadswitch
-perform_alpha_threadswitch:
+       .ent    asm_perform_threadswitch
+asm_perform_threadswitch:
 
-       subq    sp,128,sp                                 
+       subq    sp,128,sp
        stq     s0, 0(sp)
        stq     s1, 8(sp)
        stq     s2, 16(sp)
@@ -938,36 +938,38 @@ perform_alpha_threadswitch:
        ldt     sf6, 104(sp)
        ldt     sf7, 112(sp)
        ldq     ra, 120(sp)
-       mov     ra, t12
+       mov     ra, pv
        addq    sp, 128, sp
        jmp     zero,(ra)
-       .end    perform_alpha_threadswitch
+       .end    asm_perform_threadswitch
 
 
 /********************* function asm_switchstackandcall *************************
 *                                                                              *
-*   void asm_switchstackandcall (void *stack, void *func);                     *
+*  void asm_switchstackandcall (void *stack, void *func, void **stacktopsave); *
 *                                                                              *
 *   Switches to a new stack, calls a function and switches back.               *
 *       a0      new stack pointer                                              *
 *       a1      function pointer                                               *
+*              a2              pointer to variable where stack top should be stored           *
 *                                                                              *
 *******************************************************************************/
 
 
        .ent    asm_switchstackandcall
 asm_switchstackandcall:
-       lda     a0,-2*8(a0)             /* allocate new stack                                 */
-       stq     ra,0(a0)                /* save return address                                */
-       stq     sp,1*8(a0)              /* save old stack pointer                             */
-       mov     a0,sp                   /* switch to new stack                                */
+       lda     a0,-2*8(a0)     /* allocate new stack                                 */
+       stq     ra,0(a0)        /* save return address on new stack                   */
+       stq     sp,1*8(a0)      /* save old stack pointer on new stack                */
+       stq sp,0(a2)        /* save old stack pointer to variable                 */
+       mov     a0,sp           /* switch to new stack                                */
        
-       mov     a1,pv                   /* load function pointer                              */
-       jmp     ra,(pv)                 /* and call funciton                                  */
+       mov     a1,pv           /* load function pointer                              */
+       jmp     ra,(pv)         /* and call function                                  */
 
-       ldq     ra,0(sp)                /* load return address                                */
-       ldq     sp,1*8(sp)              /* switch to old stack                                */
+       ldq     ra,0(sp)        /* load return address                                */
+       ldq     sp,1*8(sp)      /* switch to old stack                                */
 
-       jmp     zero,(ra)               /* return                                             */
+       jmp     zero,(ra)       /* return                                             */
 
        .end    asm_switchstackandcall