locking: Move the semaphore core to kernel/locking/