L 5.3   The Thread_switch_fast macro

(Revision 1 - 16 November  2000)

 

 

thread_switch_fast (stcb, dtcb, &kernel_vars)

on entry t1 points to kernel_vars

0 free up sp (sp used as a temp reg after l0 until l6 or l13)
1-4 get destination asid and page table pointer
if valid asid - put asid in C0_EntryHI and goto 12
12-15 for valid asid
save destination page table pointer (12)  
load new sp (13)    ( thread context switch really happens here)
compute and save new frame pointer (fp)  (14,15)
5-9 for invalid asid
save destination page table pointer  (5)  
load new sp  (6)     (thread context switch really happens here)
compute and save new frame pointer (fp)  (7,9)
gets an asid and (presumably) stores it in C0_ENTRYHI (8)
10,11,16 leave - note takes less time to leave in common case of already having and asid

key point:
for a thread context switch
    change address space
    change context - sp and tcb
for a fast thread switch
    do this fast
    do little else