x86emul: improve CR/DR access handling
authorJan Beulich <jbeulich@suse.com>
Fri, 13 Jan 2017 14:28:31 +0000 (15:28 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 13 Jan 2017 14:28:31 +0000 (15:28 +0100)
commit98be5ffc05e689e2131f175ed95b011a7270db67
tree6f7dc23aa61a533bb39ca8b0b880ad0225a4b0e5
parent199b1eaa79c0f828dab8598c5ba164efa7edac1a
x86emul: improve CR/DR access handling

- don't accept LOCK for DR accesses (it's undefined in the manuals)
- only accept LOCK for CR accesses when the respective feature flag is
  set (which would not normally be the case for Intel)
- add (rather than or) 8 when LOCK is present; real hardware #UDs
  when both REX.W and LOCK are present, implying that these would
  rather access hypothetical CR16...23
- eliminate explicit decode_register() calls
- streamline remaining read/write code

No further functional change, i.e. not addressing the missing exception
generation (#UD for invalid CR/DR encodings, #GP(0) for invalid write
values, #DB for DR accesses with DR7.GD set).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/x86_emulate/x86_emulate.c