Invariant measures of Hamiltonian systems with prescribed asymptotic Maslov index