Global structure of MHD modes in tokamaks