diff options
author | aiju <devnull@localhost> | 2017-06-12 22:58:25 +0000 |
---|---|---|
committer | aiju <devnull@localhost> | 2017-06-12 22:58:25 +0000 |
commit | dea6bc51bcb43f5a8330b7786c0f593e8c460b7e (patch) | |
tree | 8c02ae26a5e8b1ad142a2d7f0b4aa927ccf30a66 /sys/src/9/pc/trap.c | |
parent | 89f71fa9ed166c06a23937544b453f65fb224456 (diff) |
pc/pc64: debugexc: ignore exception if in kernel mode and can't get hold of up->debug
Diffstat (limited to 'sys/src/9/pc/trap.c')
-rw-r--r-- | sys/src/9/pc/trap.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/src/9/pc/trap.c b/sys/src/9/pc/trap.c index b7877563d..fbc80024d 100644 --- a/sys/src/9/pc/trap.c +++ b/sys/src/9/pc/trap.c @@ -629,7 +629,7 @@ dumpstack(void) } static void -debugexc(Ureg *, void *) +debugexc(Ureg *ureg, void *) { u32int dr6, m; char buf[ERRMAX]; @@ -640,12 +640,16 @@ debugexc(Ureg *, void *) if(up == nil) panic("kernel debug exception dr6=%#.8ux", dr6); putdr6(up->dr[6]); + if(userureg(ureg)) + qlock(&up->debug); + else if(!canqlock(&up->debug)) + return; m = up->dr[7]; m = (m >> 4 | m >> 3) & 8 | (m >> 3 | m >> 2) & 4 | (m >> 2 | m >> 1) & 2 | (m >> 1 | m) & 1; m &= dr6; if(m == 0){ sprint(buf, "sys: debug exception dr6=%#.8ux", dr6); - postnote(up, 1, buf, NDebug); + postnote(up, 0, buf, NDebug); }else{ p = buf; e = buf + sizeof(buf); @@ -653,8 +657,9 @@ debugexc(Ureg *, void *) for(i = 0; i < 4; i++) if((m & 1<<i) != 0) p = seprint(p, e, "%d%s", i, (m >> i + 1 != 0) ? "," : ""); - postnote(up, 1, buf, NDebug); + postnote(up, 0, buf, NDebug); } + qunlock(&up->debug); } static void |