Extract malloc() and free() from semaphore spinlocked code
Merge branch 'master' into simple-sem

Conflicts:
	kernel/threads.c