A functional large deviations principle for quadratic forms of Gaussian stationary processes