Backport em-dosbox runloop changes