;; this test does the following ;; allocates two capabilities ;; starts two threads ;; initializes the capabilities, verifies them ;; sends the capabilities to these two threads ;; the threads side-effect them with exchanges ;; the parent thread migrates to the daughter threads ;; the daughter threads once again side effect the capabilities ;; the parent threads verify these side effects ;; the daughter threads re-migrate the capability back to the parent thread ;; the parent verifies access. ;; so do the daughters main: ALLOCATEC 2, q10 ALLOCATEC 4, q11 MMS q20, q21 MMS q22, q23 MOVE @q10, q20 MOVE @q11, q22 MOVECL 0, q20 ; initialize cap 1 MOVECL 10, q21 MOVECL 1, q20 MOVECL 11, q21 MOVECL 0, q22 ; initialize cap 2 MOVECL 100, q23 MOVECL 1, q22 MOVECL 101, q23 MOVECL 2, q22 MOVECL 102, q23 MOVECL 3, q22 MOVECL 103, q23 SPAWNLBC remote2, q0 ; each on a different node SPAWNLBC remote4, q1 MML q30, q31 MML q32, q33 MOVE @q10, q30 MOVE @q11, q32 ; check the initialization... MOVECL 0, @q30 ; expect 10 PRINTQ q31 MOVECL 1, @q30 ; expect 11 PRINTQ q31 MOVECL 0, @q32 PRINTQ q33 ; expect 100 MOVECL 1, @q32 PRINTQ q33 ; expect 101 MOVECL 2, @q32 PRINTQ q33 ; expect 102 MOVECL 3, @q32 PRINTQ q33 ; expect 103 MAPQC q40, q0, @q0 ; map to destination threads MAPQC q41, q0, @q1 MOVE @q10, q40 ; send the capabilities MOVE @q11, q41 PROCID q40 PROCID q41 CONSUME q5 ; interlock, wait for destination to finish its thing CONSUME q5 MIGRATE @q10, @q0 ; send data to the users... MIGRATE @q11, @q1 ; now test to see how we handle the moved data, in flight and there... NOP NOP NOP NOP NOP NOP NOP NOP MOVECL 0, @q30 ; expect 20 PRINTQ q31 MOVECL 1, @q30 ; expect 21 PRINTQ q31 MOVECL 0, @q32 ; data should be in flight by this point... PRINTQ q33 ; expect 30 MOVECL 1, @q32 PRINTQ q33 ; expect 31 MOVECL 2, @q32 PRINTQ q33 ; expect 32 MOVECL 3, @q32 PRINTQ q33 ; expect 33 MML q50, q51 ; test re-establishment of a load queue MOVE @q10, q50 MOVECL 0, q50 PRINTQ q51 ; expect 20 MOVECL 1, q50 PRINTQ q51 ; expect 21 MOVECL 0, q40 ; signal my waiters to go... MOVECL 0, q41 CONSUME q5 ; wait for my data to migrate back.... CONSUME q5 ; at this point, data has gone away and come back...and been modified... MOVECL 0, @q30 ; expect 50 PRINTQ q31 MOVECL 1, @q30 ; expect 51 PRINTQ q31 MOVECL 0, @q32 PRINTQ q33 ; expect 60 MOVECL 1, @q32 PRINTQ q33 ; expect 61 MOVECL 2, @q32 PRINTQ q33 ; expect 62 MOVECL 3, @q32 PRINTQ q33 ; expect 63 HALT remote2: MOVE q0, q10 ; capability of memory MOVE q0, q11 ; caller's procID MAPQC q40, q5, @q11 ; map back EXCH q20, q21, q22 MOVE @q10, q20 MOVECL 0, q20 MOVECL 20, q21 PRINTQ q22 ; expect 10 MOVECL 1, q20 MOVECL 21, q21 PRINTQ q22 ; expect 11 MOVECL 1, q40 ; signal that I'm done CONSUME q0 ; wait till I'm signalled to go again MOVECL 0, q20 MOVECL 50, q21 PRINTQ q22 ; expect 20 MOVECL 1, q20 MOVECL 51, q21 PRINTQ q22 ; expect 21 MIGRATE @q10, @q11 ; send it back... NOP NOP NOP NOP MOVECL 1, q40 ; signal that I'm done MML q60, q61 MOVE @q10, q60 MOVECL 0, q60 PRINTQ q61 ; expect 50 MOVECL 1, q60 PRINTQ q61 ; expect 51 HALT remote4: MOVE q0, q10 ; capability of memory MOVE q0, q11 ; caller's procID MAPQC q40, q5, @q11 ; map back EXCH q20, q21, q22 MOVE @q10, q20 MOVECL 0, q20 MOVECL 30, q21 PRINTQ q22 ; expect 100 MOVECL 1, q20 MOVECL 31, q21 PRINTQ q22 ; expect 101 MOVECL 2, q20 MOVECL 32, q21 PRINTQ q22 ; expect 102 MOVECL 3, q20 MOVECL 33, q21 PRINTQ q22 ; expect 103 MOVECL 1, q40 ; signal that I'm done CONSUME q0 ; wait till I'm signalled to go again MOVECL 0, q20 MOVECL 60, q21 PRINTQ q22 ; expect 30 MOVECL 1, q20 MOVECL 61, q21 PRINTQ q22 ; expect 31 MOVECL 2, q20 MOVECL 62, q21 PRINTQ q22 ; expect 32 MOVECL 3, q20 MOVECL 63, q21 PRINTQ q22 ; expect 33 MIGRATE @q10, @q11 ; send it back... NOP NOP NOP NOP MOVECL 1, q40 MML q60, q61 MOVE @q10, q60 MOVECL 0, q60 PRINTQ q61 ; expect 60 MOVECL 1, q60 PRINTQ q61 ; expect 61 MOVECL 2, q60 PRINTQ q61 ; expect 62 MOVECL 3, q60 PRINTQ q61 ; expect 63 HALT