Module Name: src
Committed By: matt
Date: Tue Jul 26 02:58:05 UTC 2011
Modified Files:
src/lib/libkvm [matt-nb5-pq3]: kvm_powerpc.c
src/sys/arch/powerpc/include [matt-nb5-pq3]: kcore.h
Log Message:
Include the battable, not just the contents of the bat registers.
To generate a diff of this commit:
cvs rdiff -u -r1.8.20.1 -r1.8.20.2 src/lib/libkvm/kvm_powerpc.c
cvs rdiff -u -r1.5 -r1.5.104.1 src/sys/arch/powerpc/include/kcore.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libkvm/kvm_powerpc.c
diff -u src/lib/libkvm/kvm_powerpc.c:1.8.20.1 src/lib/libkvm/kvm_powerpc.c:1.8.20.2
--- src/lib/libkvm/kvm_powerpc.c:1.8.20.1 Fri Jan 7 03:20:10 2011
+++ src/lib/libkvm/kvm_powerpc.c Tue Jul 26 02:58:05 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_powerpc.c,v 1.8.20.1 2011/01/07 03:20:10 matt Exp $ */
+/* $NetBSD: kvm_powerpc.c,v 1.8.20.2 2011/07/26 02:58:05 matt Exp $ */
/*
* Copyright (c) 2005 Wasabi Systems, Inc.
@@ -83,13 +83,14 @@
#include "kvm_private.h"
#include <sys/kcore.h>
-#include <machine/kcore.h>
#include <powerpc/spr.h>
#include <powerpc/oea/spr.h>
#include <powerpc/oea/bat.h>
#include <powerpc/oea/pte.h>
+#include <machine/kcore.h>
+
static int _kvm_match_601bat(kvm_t *kd, u_long va, u_long *pa, int *off);
static int _kvm_match_bat(kvm_t *kd, u_long va, u_long *pa, int *off);
static int _kvm_match_sr(kvm_t *kd, u_long va, u_long *pa, int *off);
@@ -123,22 +124,19 @@
int *off;
{
cpu_kcore_hdr_t *cpu_kh;
+ struct bat *b;
u_long pgoff;
size_t size;
- int i, nbat;
cpu_kh = kd->cpu_data;
- nbat = 4;
- for (i=0 ; i<nbat ; i++) {
- if (!BAT601_VALID_P(cpu_kh->dbatu[i]))
- continue;
- if (BAT601_VA_MATCH_P(cpu_kh->dbatu[i], cpu_kh->dbatl[i], va)) {
- size = BAT601_SIZE(cpu_kh->dbatu[i] & BAT601_BSM);
- pgoff = va & (size-1);
- *pa = (cpu_kh->dbatl[i] & BAT601_PBN) + pgoff;
- *off = size - pgoff;
- return 1;
- }
+ b = &cpu_kh->battable[BAT_VA2IDX(va)];
+ if (BAT601_VALID_P(b->batu)
+ && BAT601_VA_MATCH_P(b->batu, b->batl, va)) {
+ size = BAT601_SIZE(b->batu & BAT601_BSM);
+ pgoff = va & (size-1);
+ *pa = (b->batl & BAT601_PBN) + pgoff;
+ *off = size - pgoff;
+ return 1;
}
return 0;
}
@@ -155,24 +153,23 @@
int *off;
{
cpu_kcore_hdr_t *cpu_kh;
+ struct bat *b;
u_long pgoff;
size_t size;
- int i, nbat;
cpu_kh = kd->cpu_data;
+
/*
* Assume that we're looking for data and check only the dbats.
*/
- nbat = 8;
- for (i=0 ; i<nbat ; i++) {
- if ( ((cpu_kh->dbatu[i] & BAT_Vs) != 0)
- && (BAT_VA_MATCH_P(cpu_kh->dbatu[i], va))) {
- size = BAT_SIZE(cpu_kh->dbatu[i] & BAT_BL);
- pgoff = va & (size-1);
- *pa = (cpu_kh->dbatl[i] & BAT_RPN) + pgoff;
- *off = size - pgoff;
- return 1;
- }
+ b = &cpu_kh->battable[BAT_VA2IDX(va)];
+
+ if ((b->batu & BAT_Vs) != 0 && (BAT_VA_MATCH_P(b->batu, va))) {
+ size = BAT_SIZE(b->batu & BAT_BL);
+ pgoff = va & (size-1);
+ *pa = (b->batl & BAT_RPN) + pgoff;
+ *off = size - pgoff;
+ return 1;
}
return 0;
}
Index: src/sys/arch/powerpc/include/kcore.h
diff -u src/sys/arch/powerpc/include/kcore.h:1.5 src/sys/arch/powerpc/include/kcore.h:1.5.104.1
--- src/sys/arch/powerpc/include/kcore.h:1.5 Sun Dec 11 12:18:43 2005
+++ src/sys/arch/powerpc/include/kcore.h Tue Jul 26 02:58:05 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: kcore.h,v 1.5 2005/12/11 12:18:43 christos Exp $ */
+/* $NetBSD: kcore.h,v 1.5.104.1 2011/07/26 02:58:05 matt Exp $ */
/*
* Copyright (c) 2005 Wasabi Systems, Inc.
@@ -38,6 +38,8 @@
#ifndef _POWERPC_KCORE_H_
#define _POWERPC_KCORE_H_
+#include <powerpc/oea/bat.h>
+
/*
* Support for 4xx/8xx/82xx/etc, will probably make this a union.
* The pad/pvr should be kept in the same place, though, so we can
@@ -48,11 +50,7 @@
uint32_t pvr; /* PVR */
register_t sdr1; /* SDR1 */
register_t sr[16]; /* Segment registers */
- register_t dbatl[8]; /* DBATL[] */
- register_t dbatu[8]; /* DBATU[] */
- register_t ibatl[8]; /* IBATL[] */
- register_t ibatu[8]; /* IBATU[] */
- register_t pad_reg; /* Pad for 32-bit systems */
+ struct bat battable[BAT_VA2IDX(0xffffffffU)+1];
} cpu_kcore_hdr_t;
#endif /* _POWERPC_KCORE_H_ */