kernelspace: start decomposing into submodules

This will make the code less tangled and make it easier to test.

Signed-off-by: David Scott <dave.scott@citrix.com>