Note that I am not sure about 100% correctness, I am just coding Intel specs ... Code review and massive testing still required.