hammerhead: smem: split out shared memory initialization functionality