]> xenbits.xensource.com Git - xen.git/commit
x86/svm: Alias the VMCB segment registers as an array
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 30 Jun 2017 12:24:19 +0000 (12:24 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 27 Jul 2017 15:25:15 +0000 (16:25 +0100)
commitc9d7c5e29e2560e7f2d0ca50109d005efb2e44f2
treeb875d014f02160c9ec0f8637b1f8eda3d0a15080
parentf0f1a778d4d5ebe27b981531048fe9cf030386fa
x86/svm: Alias the VMCB segment registers as an array

This allows svm_{get,set}_segment_register() to access the user segments by
array index, as the x86_seg_* constants match the hardware encoding.

While making this alteration, add some newlines for clarity, switch an int for
a bool, and make the functions fail safe in a release build, rather than
crashing Xen.

Bloat-o-meter reports some modest improvements:

  add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-130 (-130)
  function                                     old     new   delta
  svm_set_segment_register                     662     653      -9
  svm_get_segment_register                     409     288    -121

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
xen/arch/x86/hvm/svm/svm.c
xen/include/asm-x86/hvm/svm/vmcb.h