core/msg: fix, optimize and improve

fixes:
fix race conditions by reordering dINTs
prevent null pointer dereference by adding forgotten target check
add forgotten eINTs
replace printf with DEBUG
fix debug messages

optimizations:
optimize pid access
reorder msg_send switches

improvements:
add debug statements
add missing return value to msg_send_to_self documentation
Merge pull request #1285 from LudwigOrtmann/msg_fixup

core/msg: prevent null pointer dereference