refactoring: move platform-specific code to platform module.

Signed-off-by: Kim Kulling <kim.kulling@googlemail.com>