Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86 Export x86_dbregs_{save/restore}, will be used ...
details: https://anonhg.NetBSD.org/src/rev/c5c528e4da07
branches: trunk
changeset: 433677:c5c528e4da07
user: maxv <maxv%NetBSD.org@localhost>
date: Thu Sep 27 13:04:21 2018 +0000
description:
Export x86_dbregs_{save/restore}, will be used outside. Reproduce some
internal dbregs logic in them.
diffstat:
sys/arch/x86/include/dbregs.h | 6 +++++-
sys/arch/x86/x86/dbregs.c | 14 +++++++++++---
2 files changed, 16 insertions(+), 4 deletions(-)
diffs (63 lines):
diff -r e68223ad4b75 -r c5c528e4da07 sys/arch/x86/include/dbregs.h
--- a/sys/arch/x86/include/dbregs.h Thu Sep 27 07:09:29 2018 +0000
+++ b/sys/arch/x86/include/dbregs.h Thu Sep 27 13:04:21 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dbregs.h,v 1.6 2018/07/26 09:29:08 maxv Exp $ */
+/* $NetBSD: dbregs.h,v 1.7 2018/09/27 13:04:22 maxv Exp $ */
/*
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -110,6 +110,10 @@
void x86_dbregs_clear(struct lwp *);
void x86_dbregs_abandon(struct lwp *);
void x86_dbregs_read(struct lwp *, struct dbreg *);
+
+void x86_dbregs_save(struct lwp *);
+void x86_dbregs_restore(struct lwp *);
+
void x86_dbregs_store_dr6(struct lwp *);
int x86_dbregs_user_trap(void);
int x86_dbregs_validate(const struct dbreg *);
diff -r e68223ad4b75 -r c5c528e4da07 sys/arch/x86/x86/dbregs.c
--- a/sys/arch/x86/x86/dbregs.c Thu Sep 27 07:09:29 2018 +0000
+++ b/sys/arch/x86/x86/dbregs.c Thu Sep 27 13:04:21 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dbregs.c,v 1.11 2018/07/26 09:29:08 maxv Exp $ */
+/* $NetBSD: dbregs.c,v 1.12 2018/09/27 13:04:21 maxv Exp $ */
/*
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -144,11 +144,15 @@
memcpy(regs, pcb->pcb_dbregs, sizeof(*regs));
}
-static void
+void
x86_dbregs_save(struct lwp *l)
{
struct pcb *pcb = lwp_getpcb(l);
+ if (!(pcb->pcb_flags & PCB_DBREGS)) {
+ return;
+ }
+
KASSERT(pcb->pcb_dbregs != NULL);
pcb->pcb_dbregs->dr[0] = rdr0();
@@ -160,11 +164,15 @@
pcb->pcb_dbregs->dr[7] = rdr7();
}
-static void
+void
x86_dbregs_restore(struct lwp *l)
{
struct pcb *pcb = lwp_getpcb(l);
+ if (!(pcb->pcb_flags & PCB_DBREGS)) {
+ return;
+ }
+
KASSERT(pcb->pcb_dbregs != NULL);
ldr0(pcb->pcb_dbregs->dr[0]);
Home |
Main Index |
Thread Index |
Old Index