WIP: bring the kmem cache implementation across (its mostly the illumos implementation).

Next step slabs.