Move kernel-specific communication code into glue