my computer used to do that.
it gets past the xp loading screen and the testing and all of a sudden you hear the fans and the cd drive running, WHOA it just restarted!! lol
you have either a horribe terrible virus or..somethings wrong with the file system or what not..
my suggestion to you is to just recover or reformat.
http://www.computerhope.com/boot.htm
get a boot disc there maybe it'll help