Separate curr_thread from curr_cpu

Previously curr_thread expanded to curr_cpu->thread. That could potentially
break horribly and result in getting the wrong curr_thread pointer. If a
thread was interrupted between the load of curr_cpu and the load of the
thread from there, and was then preempted and migrated, when it resumes
it would have the wrong CPU pointer and then would get the wrong thread
pointer from that.

Fixed by making curr_thread separate from curr_cpu (on amd64, curr_cpu is
at %gs:0, curr_thread is at %gs:8). curr_cpu->thread still exists for
things that need to see what thread is running on a different CPU, but it
is not used for the curr_thread macro.

Signed-off-by: Alex Smith <alex@alex-smith.me.uk>