.text /* Switch from current_thread to next_thread. Make next_thread * the current_thread, and set next_thread to 0. * Use eax as a temporary register, which should be caller saved. */ /* Some useful notes: * - current_thread and next_thread are global variables, and there are * no arguments to the thread_switch() function. * - to load from / store to an address in assembler, use just the symbol: * mov foo,%eax // load contents of address 'foo' into eax * - why do you need a temporary register? * - why is it nice that 'sp' is the first field (offset 0) in struct thread? * - thread_create assumes that thread_switch stores 32 bytes (8 words) * of registers on the stack. Funny, pushal stores 8 registers... */ .globl thread_switch thread_switch: /* YOUR CODE HERE */ ret /* pop return address from stack */