Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86 Error out if the higher 32 bits of DR6 and DR7 ...
details: https://anonhg.NetBSD.org/src/rev/3dab8a3bcaa5
branches: trunk
changeset: 447485:3dab8a3bcaa5
user: maxv <maxv%NetBSD.org@localhost>
date: Sun Jan 13 10:01:07 2019 +0000
description:
Error out if the higher 32 bits of DR6 and DR7 are set. MOV DR would
fault otherwise.
diffstat:
sys/arch/x86/include/dbregs.h | 5 +++--
sys/arch/x86/x86/dbregs.c | 8 +++++++-
2 files changed, 10 insertions(+), 3 deletions(-)
diffs (55 lines):
diff -r caa8dd3b06ba -r 3dab8a3bcaa5 sys/arch/x86/include/dbregs.h
--- a/sys/arch/x86/include/dbregs.h Sun Jan 13 06:59:15 2019 +0000
+++ b/sys/arch/x86/include/dbregs.h Sun Jan 13 10:01:07 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dbregs.h,v 1.7 2018/09/27 13:04:22 maxv Exp $ */
+/* $NetBSD: dbregs.h,v 1.8 2019/01/13 10:01:07 maxv Exp $ */
/*
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -45,6 +45,7 @@
#define X86_DR6_DEBUG_REGISTER_ACCESS_DETECTED __BIT(13)
#define X86_DR6_SINGLE_STEP __BIT(14)
#define X86_DR6_TASK_SWITCH __BIT(15)
+#define X86_DR6_MBZ __BITS(32, 63)
/*
* CPU Debug Control Register (DR7)
@@ -67,7 +68,6 @@
#define X86_DR7_GLOBAL_EXACT_BREAKPOINT __BIT(9)
#define X86_DR7_RESTRICTED_TRANSACTIONAL_MEMORY __BIT(11)
#define X86_DR7_GENERAL_DETECT_ENABLE __BIT(13)
-
#define X86_DR7_DR0_CONDITION_MASK __BITS(16, 17)
#define X86_DR7_DR0_LENGTH_MASK __BITS(18, 19)
#define X86_DR7_DR1_CONDITION_MASK __BITS(20, 21)
@@ -76,6 +76,7 @@
#define X86_DR7_DR2_LENGTH_MASK __BITS(26, 27)
#define X86_DR7_DR3_CONDITION_MASK __BITS(28, 29)
#define X86_DR7_DR3_LENGTH_MASK __BITS(30, 31)
+#define X86_DR7_MBZ __BITS(32, 63)
/*
* X86_DR7_CONDITION_IO_READWRITE is currently unused. It requires DE
diff -r caa8dd3b06ba -r 3dab8a3bcaa5 sys/arch/x86/x86/dbregs.c
--- a/sys/arch/x86/x86/dbregs.c Sun Jan 13 06:59:15 2019 +0000
+++ b/sys/arch/x86/x86/dbregs.c Sun Jan 13 10:01:07 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dbregs.c,v 1.12 2018/09/27 13:04:21 maxv Exp $ */
+/* $NetBSD: dbregs.c,v 1.13 2019/01/13 10:01:07 maxv Exp $ */
/*
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -256,6 +256,12 @@
return EINVAL;
}
+ if (regs->dr[6] & X86_DR6_MBZ) {
+ return EINVAL;
+ }
+ if (regs->dr[7] & X86_DR7_MBZ) {
+ return EINVAL;
+ }
if (regs->dr[7] & X86_DR7_GENERAL_DETECT_ENABLE) {
return EINVAL;
}
Home |
Main Index |
Thread Index |
Old Index