(Revision 0 - 20 November 2000)
rem_sendq (sending_tcb, receiving_tcb, temp_reg)
on entry
sending_tcb points to a thread control block to
be removed from the doubly linked sendq headed by receiving_tcb
temp_reg is a register that can be used for
scratch purposes
overview rem_sendq removes sending_tcb from receiving_tcb's doubly linked sendq by replacing the forward pointer of whatever pointed to it with sending_tcb's forward pointer and the backward pointer of whatever pointed to it with sending_tcb's backward pointer. See Handout #12.
note: sndq_start and sndq_end
are head and tail pointers for a tcb's sendq
sndq_next
and sndq_prev are link fields when
this tcb when is in another tcb's sendq
rem_sendq (sending tcb, receiving tcb, temp reg) 0 ld AT, T_SNDQ_NEXT(sending_tcb) 1 bne AT, zero, 255f 2 ld AT, T_SNDQ_PREV(sending_tcb) 3 sd AT, T_SNDQ_END(receiving_tcb) 4 b 254f 5 255: ld temp_reg, T_SNDQ_PREV(sending_tcb) 6 sd temp_reg, T_SNDQ_PREV(AT) 7 254: ld AT, T_SNDQ_PREV(sending_tcb) 8 bne AT, zero, 255f 9 ld AT, T_SNDQ_NEXT(sending_tcb) 10 sd AT, T_SNDQ_START(receiving_tcb) 11 b 254f 12 255: ld temp_reg, T_SNDQ_NEXT(sending_tcb) 13 sd temp_reg, T_SNDQ_NEXT(AT)
| 0,2-4 | if this tcb is at the end of the list point the sendq's end pointer at whatever this tcb's back pointer pointed at and goto line 7 |
| 1,5,6 | else store this tcb's back pointer in the next tcb's back
pointer (this gets the tcb in front of it pointing at the one behind it) |
| 7,9-11 | if this tcb is at the front of the list point the sendq's start pointer at whatever this tcb's forward pointer pointed at and leave |
| 8,12,13 | else store this tcb's forward pointer in the previous tcb's
forward pointer (this gets the tcb behind it pointing at the one in front of it) |