Fixes warning in pthread.c

Reworks the code slightly to just cast to a uthread right away, instead of
casting or otherwise mucking around each time it is used.
x86: fixes lock debug issues with the new core_id

When spinlock debugging, we would do a core_id_early call and get gibberish
back.  This was because core_id_ready was set (it was being set once the LAPIC
was available, and not when the segmentation stuff was available).  Instead,
we'd get a garbage address and fault enough to reboot the machine.

The fix is to not start using core_id too early.

In doing so, we also expose an issue with the lock debugger being used.  The
older LAPIC styles were ready earlier than smp_boot (in vm_init()).  Now,
core_id isn't ready til the smp boot is mostly done.  In the meantime, the
non-zero cores will think they are core 0, which means all of them share a
pcpui->lock_depth.  Those cores are running concurrently, and the
pcpui->lock_depth isn't protected in any way.  Eventually, we'd screw up the
lock depth.  The fix there is to just not debug locks for a little while.