Fix kmem race (#705)
Fix kmem race (#705)

A race is possible where thread 1 call kmem_free() and is preemted
right after vmem_free(). Then, thread 2 calls kmem_alloc() and
allocates the piece of address space just freed. Then, thread 1
marks the allocated addresses as invalid and unmaps them from the
kernel pmap.
By moving the call to vmem_free() to the very end, we make sure
that we 'own' the piece of address space until we're done with the
bookkeeping.
cahirwpz/mimiker,cahirwpz/wifire-os,cahirwpz/mimiker,cahirwpz/mimiker,cahirwpz/mimiker