From 3049bc66602e7f5a72f395bb557f940be07288c9 Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 18 Jan 2008 16:26:09 +0000 Subject: [PATCH] Use the new information about per-cpu mappings. Gdb now can examine the interrupt stack. --- lib/libkvm/kvm_sparc64.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/libkvm/kvm_sparc64.c b/lib/libkvm/kvm_sparc64.c index 2c4aae1fd980..ffdabb6d026e 100644 --- a/lib/libkvm/kvm_sparc64.c +++ b/lib/libkvm/kvm_sparc64.c @@ -1,4 +1,4 @@ -/* $NetBSD: kvm_sparc64.c,v 1.12 2008/01/15 13:57:42 ad Exp $ */ +/* $NetBSD: kvm_sparc64.c,v 1.13 2008/01/18 16:26:09 martin Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)kvm_sparc.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: kvm_sparc64.c,v 1.12 2008/01/15 13:57:42 ad Exp $"); +__RCSID("$NetBSD: kvm_sparc64.c,v 1.13 2008/01/18 16:26:09 martin Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -119,7 +119,7 @@ _kvm_kvatop(kd, va, pa) if (va < kernbase) goto lose; - /* Handle the wired 4MB TTEs */ + /* Handle the wired 4MB TTEs and per-CPU mappings */ if (cpup->memsegoffset > sizeof(cpu_kcore_hdr_t) && cpup->newmagic == SPARC64_KCORE_NEWMAGIC) { /* @@ -135,6 +135,19 @@ _kvm_kvatop(kd, va, pa) return (int)(start+PAGE_SIZE_4M - va); } + if (cpup->numcpuinfos > 0) { + /* we have per-CPU mapping info */ + uint64_t start, base; + + base = cpup->cpubase - 32*1024; + if (va >= base && va < (base + cpup->percpusz)) { + start = va - base; + *pa = cpup->cpusp + + cpup->thiscpu*cpup->percpusz + + start; + return cpup->percpusz - start; + } + } } else { /* * old format: just a textbase/size and database/size