Initial implementation

Initial implementation of the software watchdog.

The only thing I don't like so far is that critical sections operations are not tested. But they were carefully done so...