[RFC PATCH 1/3] riscv: add a generic implementation for cleanup_before_linux()