home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / RiscOS / APP / DEVS / LIB / THREAD.ZIP / Thread / ThreadLib / s / Library
Text File  |  1997-01-28  |  3KB  |  185 lines

  1. R0  RN 0
  2. R1  RN 1
  3. R2  RN 2
  4. R3  RN 3
  5. R4  RN 4
  6. R5  RN 5
  7. R6  RN 6
  8. R7  RN 7
  9. R8  RN 8
  10. R9  RN 9
  11. R10 RN 10
  12. R11 RN 11
  13. R12 RN 12
  14. R13 RN 13
  15. R14 RN 14
  16. R15 RN 15
  17.  
  18. pc  RN 15
  19. lr  RN 14
  20. sp  RN 13
  21.  
  22.     INCLUDE    ADFS::Holly.$.Libraries.ThreadLib.hdr.Tswis
  23.  
  24.     AREA    |threadlib$$CODE|, CODE, READONLY
  25.  
  26.     IMPORT    _kernel_current_stack_chunk
  27.  
  28. ; extern _kernel_oserror *thread_initialise(char *name, unsigned type,
  29. ;                        task_handle *, thread_handle *);
  30.  
  31.     EXPORT    thread_initialise
  32. thread_initialise
  33.     SWI    Thread_Initialise
  34.     STR    r0, [r2]
  35.     STR    r1, [r3]
  36.     MOVVC    r0, #0
  37.     MOVS    pc, lr
  38.  
  39. ;_kernel_oserror *thread_begin(char *name, int pri, void *arg,
  40. ;                  thread_func code, thread_handle *h)
  41.  
  42.     EXPORT thread_begin
  43. thread_begin
  44.     STMFD    sp!, {r4, lr}
  45.     STMFD    sp!, {r0-r3}
  46.     BL    _kernel_current_stack_chunk
  47.     MOV    lr, r0
  48.     LDMFD    sp!, {r0-r3}
  49.     MOV    r4, lr
  50.     SWI    Thread_Begin
  51.     LDMFD    sp!, {r4, lr}
  52.     LDMFD    sp, {r1}        ; Get next val. off stack
  53.     STR    r0, [r1]
  54.     MOVVC    r0, #0
  55.     MOVS    pc, lr
  56.  
  57. ;_kernel_oserror *thread_closedown(void)
  58.  
  59.     EXPORT    thread_closedown
  60. thread_closedown
  61.     SWI    Thread_CloseDown
  62.     MOVVC    r0, #0
  63.     MOVS    pc, lr
  64.  
  65. ;_kernel_oserror *thread_zap(void)
  66.  
  67.     EXPORT    thread_zap
  68. thread_zap
  69.     SWI    Thread_Zap
  70.     MOVVC    r0, #0
  71.     MOVS    pc, lr
  72.  
  73. ;_kernel_oserror *thread_get_context(thread_handle h, thread_context **context)
  74.  
  75.     EXPORT    thread_get_context
  76. thread_get_context
  77.     SWI    Thread_Context
  78.     STR    r0, [r1]
  79.     MOVVC    r0, #0
  80.     MOVS    pc, lr
  81.  
  82. ;_kernel_oserror *thread_sleep(int centiseconds)
  83.  
  84.     EXPORT    thread_sleep
  85. thread_sleep
  86.     SWI    Thread_Sleep
  87.     MOVVC    r0, #0
  88.     MOVS    pc, lr
  89.  
  90. ;_kernel_oserror *thread_init_semaphore(thread_semaphore *s, int value)
  91.  
  92.     EXPORT    thread_init_semaphore
  93. thread_init_semaphore
  94.     SWI    Thread_Semaphore
  95.     MOVVC    r0, #0
  96.     MOVS    pc, lr
  97.  
  98. ;_kernel_oserror *thread_signal(thread_semaphore *s)
  99.  
  100.     EXPORT    thread_signal
  101. thread_signal
  102.     SWI    Thread_Signal
  103.     MOVVC    r0, #0
  104.     MOVS    pc, lr
  105.  
  106. ;_kernel_oserror *thread_on(void)
  107.  
  108.     EXPORT    thread_on
  109. thread_on
  110.     SWI    Thread_On
  111.     MOVVC    r0, #0
  112.     MOVS    pc, lr
  113.  
  114. ;_kernel_oserror *thread_off(void)
  115.  
  116.     EXPORT    thread_off
  117. thread_off
  118.     SWI    Thread_Off
  119.     MOVVC    r0, #0
  120.     MOVS    pc, lr
  121.  
  122. ;_kernel_oserror *thread_wait(thread_semaphore *s, int *ret)
  123.  
  124.     EXPORT    thread_wait
  125. thread_wait
  126.     SWI    Thread_Wait
  127.     MOVVC    r0, #0
  128.     MOVS    pc, lr
  129.  
  130. ;_kernel_oserror *thread_send(thread_message *m)
  131.  
  132.     EXPORT    thread_send
  133. thread_send
  134.     SWI    Thread_Send
  135.     MOVVC    r0, #0
  136.     MOVS    pc, lr
  137.  
  138. ;thread_message *thread_receive(int give_error)
  139.  
  140.     EXPORT    thread_receive
  141. thread_receive
  142.     SWI    Thread_Recieve
  143.     MOVVS    r0, #0            ; if NULL not working!
  144.     MOVS    pc, lr
  145.  
  146. ;_kernel_oserror *thread_yield();
  147.  
  148.     EXPORT    thread_yield
  149. thread_yield
  150.     SWI    Thread_Yield
  151.     MOVVC    r0, #0
  152.     MOVS    pc, lr
  153.  
  154. ;thread_handle *thread_self();
  155.  
  156.     EXPORT    thread_self
  157. thread_self
  158.     SWI    Thread_Self
  159.     MOVS    pc, lr
  160.  
  161. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  162.  
  163. ;
  164. ; This variable contains the address of the x$stack_overflow, as $ is an
  165. ; illegal character in \Cee. (I wonder if that was deliberate with SCL)
  166. ;
  167.     IMPORT    |x$stack_overflow|
  168.     EXPORT    SIMTEC_x_stack_overflow
  169. SIMTEC_x_stack_overflow
  170.     DCD    |x$stack_overflow|
  171.  
  172. ;
  173. ; Call some code, at a given address. On entry, r0, r1, r2 as per callee,
  174. ; r3 is the address of the code to call. Return with r0 as resulting from
  175. ; callee.
  176. ;
  177.     EXPORT    thread_branch_to
  178. thread_branch_to
  179.     STMFD    sp!, {lr}                ; Preserve lr
  180.     MOV    lr, pc                    ; Make new lr
  181.     MOV    pc, r3                    ; Call code
  182.     LDMFD    sp!, {pc}^                ; Return to here
  183.  
  184.     END
  185.