MSM: Add memory.c from 2.6.38
MSM: Fix compile of memory.c