(Revision 0 - 5 November 2000)
overview continuation of system call #6 - if target tcb invalid, allocates and initializes target thread tcb
on entry a0,s4 target thread tid (tid of addressed thread in current task) a1,s4 target thread new ip a2,s5 target thread new sp a3,s6 target thread exception handler id a4,s7 target thread pager id t8 caller's tcb (high core address) s0 caller's tid s1 target thread tid s2 target thread tcb (lo core address)
| 14 | call tcb_frame_alloc
to allocate a new frame for the tcb and v0 ¬ new frame PA |
| 15-20 | call vm_tcb_insert with info to insert new TCB mapping into page table |
| 21-25 | if target tcb on a 4KB boundary (this is the case where the target tcb is at a lower address than its buddy's tcb) add 2KB to it to get buddy thread base tcb address and add one to target thread's tid to get buddy thread tid s3 <-- buddy thread tcb s8 <-- buddy thread tid |
| 21,22,26,27 | else if target tcb on a 2KB boundary (this is the case where the target tcb is at a higher address than its buddy's tcb) subtract 2KB to get buddy thread base tcb address and subtract one from target thread's tid to get buddy thread tid s3 <-- buddy thread tcb s8 <-- buddy thread tid |
| 28,29 | t3 <-- target thread stack base t2 <-- buddy thread stack base |
| 30-37 | initialize target and buddy's exception stack frames: ESP, EPC and initial SB |
| 38,39 | initialize most fields of target and buddy tcbs with nulls |
| 40-57 | initialize target and buddy tcb: thread state, PT pointer, pager and excepter tid, and asid |
| 58-61 | insert target and buddy tcbs into Present List (the list of
all valid tcbs grouped by task) (caller points to target who points to buddy who points to whoever caller formerly pointed to) |