par_misc.e 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #
  2. mes 2,EM_WSIZE,EM_PSIZE
  3. exp $top_size
  4. #ifdef __sparc
  5. inp $top_size2
  6. pro $top_size, 0
  7. mes 11
  8. zer EM_PSIZE
  9. lal 0
  10. loi EM_PSIZE
  11. cal $top_size2
  12. asp 2*EM_PSIZE
  13. lfr EM_WSIZE
  14. ret EM_WSIZE
  15. end 0
  16. pro $top_size2, 3*EM_WSIZE+3*EM_PSIZE
  17. #else
  18. pro $top_size, 3*EM_WSIZE+3*EM_PSIZE
  19. #endif
  20. mes 11
  21. lal 0
  22. loi EM_PSIZE ; s_brk
  23. lor 1 ; s_brk SP
  24. sbs EM_PSIZE ; s_brk-SP
  25. ret EM_PSIZE ; return size of block to be saved
  26. end 3*EM_WSIZE+3*EM_PSIZE
  27. exp $top_save
  28. #ifdef __sparc
  29. inp $top_save2
  30. pro $top_save,0
  31. mes 11
  32. lal 0
  33. loi 2*EM_PSIZE
  34. cal $top_save2
  35. asp 2*EM_PSIZE
  36. lfr EM_WSIZE
  37. ret EM_WSIZE
  38. end 0
  39. pro $top_save2,0
  40. #else
  41. pro $top_save, 0
  42. #endif
  43. mes 11
  44. loe 0
  45. lae 4 ; load line number and file name
  46. loi EM_PSIZE
  47. lim ; ignore mask
  48. lor 0 ; LB
  49. lal 0
  50. loi EM_PSIZE ; size of block
  51. loc EM_PSIZE
  52. loc EM_WSIZE
  53. cuu
  54. dup EM_WSIZE
  55. stl 0 ; push & store size in 2 bytes
  56. lor 1 ; SP (the SP BEFORE pushing)
  57. lor 1 ; SP (address of stack top to save)
  58. lal EM_PSIZE ; area
  59. loi EM_PSIZE
  60. lol 0 ; size
  61. bls EM_WSIZE ; move whole block
  62. asp 3*EM_PSIZE+3*EM_WSIZE ; remove the lot from the stack
  63. loc 1
  64. ret EM_WSIZE ; return 1
  65. end 0
  66. sv
  67. bss EM_PSIZE, 0, 0
  68. exp $top_load
  69. #ifdef __sparc
  70. inp $top_load1
  71. pro $top_load,0
  72. lal 0
  73. loi EM_PSIZE
  74. cal $top_load1
  75. asp EM_PSIZE
  76. lfr EM_WSIZE
  77. ret EM_WSIZE
  78. end 0
  79. pro $top_load1, 0
  80. #else
  81. pro $top_load, 0
  82. #endif
  83. mes 11
  84. lal 0
  85. loi EM_PSIZE
  86. lae sv
  87. sti EM_PSIZE
  88. lxl 0
  89. 2
  90. dup EM_PSIZE
  91. adp -3*EM_PSIZE
  92. lal 0
  93. loi EM_PSIZE ; compare target SP with current LB to see if we must
  94. loi EM_PSIZE
  95. cmp ; find another LB first
  96. zgt *1
  97. dch ; just follow dynamic chain to make sure we find
  98. ; a legal one
  99. bra *2
  100. 1
  101. str 0
  102. lae sv
  103. loi EM_PSIZE
  104. loi EM_PSIZE
  105. str 1 ; restore SP
  106. asp -EM_PSIZE
  107. lae sv
  108. loi EM_PSIZE
  109. lor 1 ; SP (the SP AFTER, see above)
  110. adp EM_PSIZE
  111. lae sv
  112. loi EM_PSIZE
  113. lof EM_PSIZE ; size of block
  114. bls EM_WSIZE ; move block back (SP becomes the SP BEFORE again!)
  115. asp EM_WSIZE+EM_PSIZE ; drop size + SP
  116. str 0 ; LB
  117. sim ; ignore mask
  118. lae 4
  119. sti EM_PSIZE
  120. ste 0 ; line and file
  121. loc 0
  122. ret EM_WSIZE ; return 0
  123. end 0