Move xcore utils to xcore.c

m6