SECD almost working

pmem_alloc() written again.