vax.s 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * QuickThreads -- Threads-building toolkit.
  3. * Copyright (c) 1993 by David Keppel
  4. *
  5. * Permission to use, copy, modify and distribute this software and
  6. * its documentation for any purpose and without fee is hereby
  7. * granted, provided that the above copyright notice and this notice
  8. * appear in all copies. This software is provided as a
  9. * proof-of-concept and for demonstration purposes; there is no
  10. * representation about the suitability of this software for any
  11. * purpose.
  12. */
  13. .text
  14. .globl _qt_abort
  15. .globl _qt_block
  16. .globl _qt_blocki
  17. .globl _qt_start
  18. .globl _qt_vstart
  19. /*
  20. // Calls to these routines have the signature
  21. //
  22. // void *block (func, arg1, arg2, newsp)
  23. //
  24. // Since the prologue saves 5 registers, nargs, pc, fp, ap, mask, and
  25. // a condition handler (at sp+0), the first argument is 40=4*10 bytes
  26. // offset from the stack pointer.
  27. */
  28. _qt_block:
  29. _qt_blocki:
  30. _qt_abort:
  31. .word 0x7c0 /* Callee-save mask: 5 registers. */
  32. movl 56(sp),r1 /* Get stack pointer of new thread. */
  33. movl 52(sp),-(r1) /* Push arg2 */
  34. movl 48(sp),-(r1) /* Push arg1 */
  35. movl sp,-(r1) /* Push arg0 */
  36. movl 44(sp),r0 /* Get helper to call. */
  37. movl r1,sp /* Move to new thread's stack. */
  38. addl3 sp,$12,fp /* .. including the frame pointer. */
  39. calls $3,(r0) /* Call helper. */
  40. ret
  41. _qt_start:
  42. movl (sp)+,r0 /* Get `only'. */
  43. calls $3,(r0) /* Call `only'. */
  44. calls $0,_qt_error /* `only' erroniously returned. */
  45. _qt_vstart:
  46. movl (sp)+,r10 /* Get `pt'. */
  47. movl (sp)+,r9 /* Get `startup'. */
  48. movl (sp)+,r8 /* Get `vuserf'. */
  49. movl (sp)+,r7 /* Get `cleanup'. */
  50. pushl r10 /* Push `qt'. */
  51. calls $1,(r9) /* Call `startup', pop `qt' on return. */
  52. calls (sp)+,(r8) /* Call user's function. */
  53. pushl r0 /* Push `vuserf_retval'. */
  54. pushl r10 /* Push `qt'. */
  55. calls $2,(r7) /* Call `cleanup', never return. */
  56. calls $0,_qt_error /* `cleanup' erroniously returned. */