summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2011-04-04 22:37:31 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2011-04-04 22:37:31 +0000
commit3438915a9aa516e82982b1fd3545a3306c2d7cfe (patch)
tree485bf889dc34f3f94e7cda3387dca13ddb64e339
parentac3dbc2474783c1052bacd2f871f267c2a29f2aa (diff)
Make sure to clear the upper bits of the segment selectors in ddb_regs
before entering ddb for real, so that `show registers' displays (what passes for) sane values for them. Noticed & prodded by mlarkin@
-rw-r--r--sys/arch/i386/i386/db_interface.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/arch/i386/i386/db_interface.c b/sys/arch/i386/i386/db_interface.c
index 5d5590f42d6..97ed71f8295 100644
--- a/sys/arch/i386/i386/db_interface.c
+++ b/sys/arch/i386/i386/db_interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_interface.c,v 1.26 2010/04/01 19:48:50 kettenis Exp $ */
+/* $OpenBSD: db_interface.c,v 1.27 2011/04/04 22:37:30 miod Exp $ */
/* $NetBSD: db_interface.c,v 1.22 1996/05/03 19:42:00 christos Exp $ */
/*
@@ -136,6 +136,12 @@ kdb_trap(int type, int code, db_regs_t *regs)
ddb_regs.tf_esp = (int)&regs->tf_esp; /* kernel stack pointer */
__asm__("movw %%ss,%w0" : "=r" (ddb_regs.tf_ss));
}
+ ddb_regs.tf_cs &= 0xffff;
+ ddb_regs.tf_ds &= 0xffff;
+ ddb_regs.tf_es &= 0xffff;
+ ddb_regs.tf_fs &= 0xffff;
+ ddb_regs.tf_gs &= 0xffff;
+ ddb_regs.tf_ss &= 0xffff;
s = splhigh();
db_active++;