x86: introduce idle function

The idle function can dramatically reduce the cpu utilization.