We introduce a scheme for the calculation of band offsets and defect energy levels at semiconductor-oxide interfaces. Our scheme is based on the use of realistic atomistic models of the interface structure and of hybrid functionals for the evaluation of the electronic structure. This scheme is herein applied to the technologically relevant Si-SiO2-HfO2 stack. Calculated band offsets show a very good agreement with experimental values. In particular, we focus on the energy levels of the oxygen vacancy defect and the interstitial hydrogen impurity. The defect levels are aligned with respect to the interface band structure and determined for varying location in the dielectric stack. The most stable charge states are identified as the Fermi level sweeps through the silicon band gap.