Add M4,semaphore and exception utility.

Signed-off-by: snowwalf <zhj88523@gmail.com>