home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 52
/
Amiga_Dream_52.iso
/
RiscOS
/
APP
/
DEVS
/
LIB
/
THREAD.ZIP
/
Thread
/
ThreadLib
/
s
/
Library
Wrap
Text File
|
1997-01-28
|
3KB
|
185 lines
R0 RN 0
R1 RN 1
R2 RN 2
R3 RN 3
R4 RN 4
R5 RN 5
R6 RN 6
R7 RN 7
R8 RN 8
R9 RN 9
R10 RN 10
R11 RN 11
R12 RN 12
R13 RN 13
R14 RN 14
R15 RN 15
pc RN 15
lr RN 14
sp RN 13
INCLUDE ADFS::Holly.$.Libraries.ThreadLib.hdr.Tswis
AREA |threadlib$$CODE|, CODE, READONLY
IMPORT _kernel_current_stack_chunk
; extern _kernel_oserror *thread_initialise(char *name, unsigned type,
; task_handle *, thread_handle *);
EXPORT thread_initialise
thread_initialise
SWI Thread_Initialise
STR r0, [r2]
STR r1, [r3]
MOVVC r0, #0
MOVS pc, lr
;_kernel_oserror *thread_begin(char *name, int pri, void *arg,
; thread_func code, thread_handle *h)
EXPORT thread_begin
thread_begin
STMFD sp!, {r4, lr}
STMFD sp!, {r0-r3}
BL _kernel_current_stack_chunk
MOV lr, r0
LDMFD sp!, {r0-r3}
MOV r4, lr
SWI Thread_Begin
LDMFD sp!, {r4, lr}
LDMFD sp, {r1} ; Get next val. off stack
STR r0, [r1]
MOVVC r0, #0
MOVS pc, lr
;_kernel_oserror *thread_closedown(void)
EXPORT thread_closedown
thread_closedown
SWI Thread_CloseDown
MOVVC r0, #0
MOVS pc, lr
;_kernel_oserror *thread_zap(void)
EXPORT thread_zap
thread_zap
SWI Thread_Zap
MOVVC r0, #0
MOVS pc, lr
;_kernel_oserror *thread_get_context(thread_handle h, thread_context **context)
EXPORT thread_get_context
thread_get_context
SWI Thread_Context
STR r0, [r1]
MOVVC r0, #0
MOVS pc, lr
;_kernel_oserror *thread_sleep(int centiseconds)
EXPORT thread_sleep
thread_sleep
SWI Thread_Sleep
MOVVC r0, #0
MOVS pc, lr
;_kernel_oserror *thread_init_semaphore(thread_semaphore *s, int value)
EXPORT thread_init_semaphore
thread_init_semaphore
SWI Thread_Semaphore
MOVVC r0, #0
MOVS pc, lr
;_kernel_oserror *thread_signal(thread_semaphore *s)
EXPORT thread_signal
thread_signal
SWI Thread_Signal
MOVVC r0, #0
MOVS pc, lr
;_kernel_oserror *thread_on(void)
EXPORT thread_on
thread_on
SWI Thread_On
MOVVC r0, #0
MOVS pc, lr
;_kernel_oserror *thread_off(void)
EXPORT thread_off
thread_off
SWI Thread_Off
MOVVC r0, #0
MOVS pc, lr
;_kernel_oserror *thread_wait(thread_semaphore *s, int *ret)
EXPORT thread_wait
thread_wait
SWI Thread_Wait
MOVVC r0, #0
MOVS pc, lr
;_kernel_oserror *thread_send(thread_message *m)
EXPORT thread_send
thread_send
SWI Thread_Send
MOVVC r0, #0
MOVS pc, lr
;thread_message *thread_receive(int give_error)
EXPORT thread_receive
thread_receive
SWI Thread_Recieve
MOVVS r0, #0 ; if NULL not working!
MOVS pc, lr
;_kernel_oserror *thread_yield();
EXPORT thread_yield
thread_yield
SWI Thread_Yield
MOVVC r0, #0
MOVS pc, lr
;thread_handle *thread_self();
EXPORT thread_self
thread_self
SWI Thread_Self
MOVS pc, lr
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; This variable contains the address of the x$stack_overflow, as $ is an
; illegal character in \Cee. (I wonder if that was deliberate with SCL)
;
IMPORT |x$stack_overflow|
EXPORT SIMTEC_x_stack_overflow
SIMTEC_x_stack_overflow
DCD |x$stack_overflow|
;
; Call some code, at a given address. On entry, r0, r1, r2 as per callee,
; r3 is the address of the code to call. Return with r0 as resulting from
; callee.
;
EXPORT thread_branch_to
thread_branch_to
STMFD sp!, {lr} ; Preserve lr
MOV lr, pc ; Make new lr
MOV pc, r3 ; Call code
LDMFD sp!, {pc}^ ; Return to here
END