home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume44 / toy_os / part04 / four.2.a < prev    next >
Encoding:
Text File  |  1994-09-05  |  1.9 KB  |  103 lines

  1. ^    register names
  2.  R0     EQU    0
  3.  R1     EQU    1
  4.  R2     EQU    2
  5.  R3     EQU    3
  6.  R4     EQU    4
  7.  R5     EQU    5
  8.  R6     EQU    6
  9.  R7     EQU    7
  10.  R8     EQU    8
  11.  R9     EQU    9
  12.  R10    EQU    10
  13.  R11    EQU    11
  14.  R12    EQU    12
  15.  R13    EQU    13
  16.  R14    EQU    14
  17.  R15    EQU    15
  18. ^    SVC operations
  19.  DMPSYS EQU    1
  20.  FORK   EQU    2
  21.  WAIT   EQU    3
  22.  GETSEM EQU    4
  23.  P      EQU    5
  24.  V      EQU    6
  25.  KILL   EQU    7
  26. ^
  27. ^    This program checks to see that
  28. ^    code is shared properly.
  29. ^
  30.         MAPPED
  31.         ENTRY  START
  32.  START  SVC    R0,,0,GETSEM
  33.         SVC    R1,,0,GETSEM
  34.         SVC    R2,,0,GETSEM
  35.         SVC    R3,,0,GETSEM
  36. ^
  37. ^   First check to see that code
  38. ^    pages are shared among siblings.
  39. ^
  40.         SVC    R4,,SUB1,FORK
  41.         SVC    R5,,SUB2,FORK
  42.         SVC    R0,,,V
  43.         SVC    R2,,,P
  44.         SVC    ,,,DMPSYS
  45.         SVC    R3,,,V
  46.         SVC    R3,,,V
  47.         SVC    ,,,WAIT
  48. ^
  49. ^    Now check to see that code pages
  50. ^    are shared properly between parents
  51. ^    and offspring.
  52. ^
  53.         SVC    R4,,SUB3,FORK
  54.         SVC    R0,,,P
  55.         BRSUBR R15,,PAGE7
  56.         SVC    ,,,DMPSYS
  57.         SVC    R3,,,V
  58.         SVC    ,,,WAIT
  59. ^
  60. ^    Program should now terminate
  61. ^    with a HALT at octal location 44.
  62. ^
  63.         HALT
  64. ^
  65. ^    Process SUB1 and SUB2 both
  66. ^    access virtual page 5. Semaphores
  67. ^    are used to see that the accesses
  68. ^    occur in a particular order.
  69. ^
  70. ^
  71.  SUB1   SVC    R0,,,P
  72.         BRSUBR R15,,PAGE5
  73.         SVC    R1,,,V
  74.         SVC    R3,,,P
  75.         HALT
  76. ^
  77.  SUB2   SVC    R1,,,P
  78.         BRSUBR R15,,PAGE5
  79.         SVC    R2,,,V
  80.         SVC    R3,,,P
  81.         HALT
  82. ^
  83. ^
  84. ^    The main process and subprocess
  85. ^    SUB4 both access virtuyal page 7.
  86. ^
  87. ^
  88.  SUB3   SVC    R4,,SUB4,FORK
  89.         SVC    ,,,WAIT
  90.         HALT
  91. ^
  92.  SUB4   BRSUBR R15,,PAGE7
  93.         SVC    R0,,,V
  94.         SVC    R3,,,P
  95.         HALT
  96. ^
  97. ^
  98.         SETPC  240b
  99.  PAGE5  BR     ,R15
  100. ^
  101.         SETPC  340b
  102.  PAGE7  BR     ,R15
  103.