p***@xen.org
2018-11-04 05:04:24 UTC
commit 2b3218eb6bf27d3b66885dde8ae05e4e7864370d
Author: Andrew Cooper <***@citrix.com>
AuthorDate: Mon May 28 15:16:37 2018 +0000
Commit: Andrew Cooper <***@citrix.com>
CommitDate: Tue Oct 30 13:26:21 2018 +0000
x86/emul: Unfold %cr4.de handling in x86emul_read_dr()
No functional change (as curr->arch.debugreg[5] is zero when DE is clear), but
this change simplifies the following patch.
Signed-off-by: Andrew Cooper <***@citrix.com>
Acked-by: Jan Beulich <***@suse.com>
Reviewed-by: Roger Pau Monné <***@citrix.com>
---
xen/arch/x86/x86_emulate.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/xen/arch/x86/x86_emulate.c b/xen/arch/x86/x86_emulate.c
index 532b7e04e1..e1153f76b2 100644
--- a/xen/arch/x86/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate.c
@@ -101,23 +101,29 @@ int x86emul_read_dr(unsigned int reg, unsigned long *val,
switch ( reg )
{
case 0 ... 3:
- case 6:
*val = curr->arch.debugreg[reg];
break;
+ case 4:
+ if ( curr->arch.pv.ctrlreg[4] & X86_CR4_DE )
+ goto ud_fault;
+
+ /* Fallthrough */
+ case 6:
+ *val = curr->arch.debugreg[6];
+ break;
+
+ case 5:
+ if ( curr->arch.pv.ctrlreg[4] & X86_CR4_DE )
+ goto ud_fault;
+
+ /* Fallthrough */
case 7:
*val = (curr->arch.debugreg[7] |
curr->arch.debugreg[5]);
break;
- case 4 ... 5:
- if ( !(curr->arch.pv.ctrlreg[4] & X86_CR4_DE) )
- {
- *val = curr->arch.debugreg[reg + 2];
- break;
- }
-
- /* Fallthrough */
+ ud_fault:
default:
if ( ctxt )
x86_emul_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC, ctxt);
--
generated by git-patchbot for /home/xen/git/xen.git#master
Author: Andrew Cooper <***@citrix.com>
AuthorDate: Mon May 28 15:16:37 2018 +0000
Commit: Andrew Cooper <***@citrix.com>
CommitDate: Tue Oct 30 13:26:21 2018 +0000
x86/emul: Unfold %cr4.de handling in x86emul_read_dr()
No functional change (as curr->arch.debugreg[5] is zero when DE is clear), but
this change simplifies the following patch.
Signed-off-by: Andrew Cooper <***@citrix.com>
Acked-by: Jan Beulich <***@suse.com>
Reviewed-by: Roger Pau Monné <***@citrix.com>
---
xen/arch/x86/x86_emulate.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/xen/arch/x86/x86_emulate.c b/xen/arch/x86/x86_emulate.c
index 532b7e04e1..e1153f76b2 100644
--- a/xen/arch/x86/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate.c
@@ -101,23 +101,29 @@ int x86emul_read_dr(unsigned int reg, unsigned long *val,
switch ( reg )
{
case 0 ... 3:
- case 6:
*val = curr->arch.debugreg[reg];
break;
+ case 4:
+ if ( curr->arch.pv.ctrlreg[4] & X86_CR4_DE )
+ goto ud_fault;
+
+ /* Fallthrough */
+ case 6:
+ *val = curr->arch.debugreg[6];
+ break;
+
+ case 5:
+ if ( curr->arch.pv.ctrlreg[4] & X86_CR4_DE )
+ goto ud_fault;
+
+ /* Fallthrough */
case 7:
*val = (curr->arch.debugreg[7] |
curr->arch.debugreg[5]);
break;
- case 4 ... 5:
- if ( !(curr->arch.pv.ctrlreg[4] & X86_CR4_DE) )
- {
- *val = curr->arch.debugreg[reg + 2];
- break;
- }
-
- /* Fallthrough */
+ ud_fault:
default:
if ( ctxt )
x86_emul_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC, ctxt);
--
generated by git-patchbot for /home/xen/git/xen.git#master