.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
.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)
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)
mov ra, t12
addq sp, 128, sp
jmp zero,(ra)
- .end perform_alpha_threadswitch
+ .end asm_perform_threadswitch
/********************* function asm_switchstackandcall *************************
.ent asm_switchstackandcall
asm_switchstackandcall:
- 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 */
+ 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 function */
+ 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
-/*
- * i386/threads.h
- * i386 threading information.
- *
- * Copyright (c) 1996 T. J. Wilkinson & Associates, London, UK.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
- *
- * See file COPYRIGHT for information on usage and disclaimer of warranties
- *
- * Written by Tim Wilkinson <tim@tjwassoc.demon.co.uk>, 1996.
- */
-
-#ifndef __alpha_threads_h
-#define __alpha_threads_h
-
-/**/
-/* Thread handling */
-/**/
+/****************************** threads.h **************************************
+
+ Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+
+ See file COPYRIGHT for information on usage and disclaimer of warranties
+
+ System dependent part of thread header file.
+
+ Authors: Mark Probst EMAIL: cacao@complang.tuwien.ac.at
+ Andreas Krall EMAIL: cacao@complang.tuwien.ac.at
+
+ Last Change: 1998/11/19
+
+*******************************************************************************/
+
+
+#ifndef __sysdep_threads_h
+#define __sysdep_threads_h
#include "../threads/thread.h"
-void perform_alpha_threadswitch (u1 **from, u1 **to, u1 **stackTop);
-u1* initialize_thread_stack (void *func, u1 *stack);
+/* Thread handling */
+
+/* prototypes */
+
+void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);
+u1* asm_initialize_thread_stack (void *func, u1 *stack);
void asm_switchstackandcall (void *stack, void *func, void **stacktopsave);
-#define THREADSTACKSIZE (32 * 1024)
+/* access macros */
-#define THREADSWITCH(to, from) perform_alpha_threadswitch(&(from)->restorePoint,\
- &(to)->restorePoint, &(from)->usedStackTop)
+#define THREADSTACKSIZE (32 * 1024)
-#define THREADINIT(to, func) (to)->restorePoint = \
- initialize_thread_stack((u1*)(func), \
- (to)->stackEnd)
+#define THREADSWITCH(to, from) asm_perform_threadswitch(&(from)->restorePoint,\
+ &(to)->restorePoint, &(from)->usedStackTop)
-#define THREADINFO(ee) \
- do { \
- (ee)->restorePoint = 0; \
- (ee)->flags = THREAD_FLAGS_NOSTACKALLOC;\
- } while(0)
+#define THREADINIT(to, func) (to)->restorePoint = \
+ asm_initialize_thread_stack((u1*)(func), \
+ (to)->stackEnd)
-/*
- void* ptr; \
- asm("addq $30,$31,%0" : "=r" (ptr)); \
- (ee)->stackEnd = ptr; \
- (ee)->stackBase = (ee)->stackEnd - threadStackSize;\
-*/
-
-/*
-#define THREADFRAMES(tid, cnt) \
- do { \
- void** ptr; \
- cnt = 0; \
- if (tid == currentThread) { \
- asm("movl %%ebp,%0" : "=r" (ptr));\
- } \
- else { \
- ptr = ((void***)tid->PrivateInfo->restorePoint)[2];\
- } \
- while (*ptr != 0) { \
- cnt++; \
- ptr = (void**)*ptr; \
- } \
- } while (0)
-*/
+#define THREADINFO(e) \
+ do { \
+ (e)->restorePoint = 0; \
+ (e)->flags = THREAD_FLAGS_NOSTACKALLOC; \
+ } while(0)
#endif
void removecompilerstub (u1 *stub) {}
void removenativestub (u1 *stub) {}
-void perform_alpha_threadswitch (u1 **from, u1 **to) {}
-u1* initialize_thread_stack (void *func, u1 *stack) { return NULL; }
+void asm_perform_threadswitch (u1 **from, u1 **to) {}
+u1* asm_initialize_thread_stack (void *func, u1 *stack) { return NULL; }
void asm_switchstackandcall () { }
java_objectheader *native_new_and_init (void *p) { return NULL; }
void removecompilerstub (u1 *stub) {}
void removenativestub (u1 *stub) {}
-void perform_alpha_threadswitch (u1 **from, u1 **to) {}
-u1* initialize_thread_stack (void *func, u1 *stack) { return NULL; }
+void asm_perform_threadswitch (u1 **from, u1 **to) {}
+u1* asm_initialize_thread_stack (void *func, u1 *stack) { return NULL; }
void asm_switchstackandcall () { }
java_objectheader *native_new_and_init (void *p) { return NULL; }