Refactor core halted logic.

Although current behaviour for handling the core halting is
simple, it will become more complex as handling of semi-hosting
is supported.

Although the curretn logic for core halting is simplen logic for core halting is simple