summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2011-07-18 15:19:40 +0000
committerattilio <attilio@FreeBSD.org>2011-07-18 15:19:40 +0000
commit9a6ff5ad378cfaaa99c5162e2b0f6e4cb6a3c796 (patch)
tree3d2deee4220ced3fd75b40dbd48afd2ed84428f6
parent838b39dd924348287b3ed188b8a6b642390c9429 (diff)
downloadFreeBSD-src-9a6ff5ad378cfaaa99c5162e2b0f6e4cb6a3c796.zip
FreeBSD-src-9a6ff5ad378cfaaa99c5162e2b0f6e4cb6a3c796.tar.gz
- Remove the eintrcnt/eintrnames usage and introduce the concept of
sintrcnt/sintrnames which are symbols containing the size of the 2 tables. - For amd64/i386 remove the storage of intr* stuff from assembly files. This area can be widely improved by applying the same to other architectures and likely finding an unified approach among them and move the whole code to be MI. More work in this area is expected to happen fairly soon. No MFC is previewed for this patch. Tested by: pluknet Reviewed by: jhb Approved by: re (kib)
-rw-r--r--sys/amd64/amd64/genassym.c1
-rw-r--r--sys/amd64/amd64/intr_machdep.c5
-rw-r--r--sys/amd64/amd64/support.S12
-rw-r--r--sys/arm/arm/irq_dispatch.S10
-rw-r--r--sys/arm/sa11x0/sa11x0_irq.S13
-rw-r--r--sys/i386/i386/genassym.c1
-rw-r--r--sys/i386/i386/intr_machdep.c5
-rw-r--r--sys/i386/i386/support.s12
-rw-r--r--sys/ia64/ia64/locore.S7
-rw-r--r--sys/kern/kern_clock.c2
-rw-r--r--sys/kern/kern_intr.c11
-rw-r--r--sys/mips/mips/exception.S11
-rw-r--r--sys/powerpc/aim/locore32.S7
-rw-r--r--sys/powerpc/aim/locore64.S7
-rw-r--r--sys/powerpc/booke/locore.S7
-rw-r--r--sys/sparc64/sparc64/exception.S11
-rw-r--r--sys/sparc64/sparc64/intr_machdep.c2
-rw-r--r--sys/sys/interrupt.h4
-rw-r--r--usr.bin/vmstat/vmstat.c14
19 files changed, 70 insertions, 72 deletions
diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c
index aba790d..1c9abd5 100644
--- a/sys/amd64/amd64/genassym.c
+++ b/sys/amd64/amd64/genassym.c
@@ -201,7 +201,6 @@ ASSYM(UC_EFLAGS, offsetof(ucontext_t, uc_mcontext.mc_rflags));
ASSYM(ENOENT, ENOENT);
ASSYM(EFAULT, EFAULT);
ASSYM(ENAMETOOLONG, ENAMETOOLONG);
-ASSYM(MAXCPU, MAXCPU);
ASSYM(MAXCOMLEN, MAXCOMLEN);
ASSYM(MAXPATHLEN, MAXPATHLEN);
ASSYM(PC_SIZEOF, sizeof(struct pcpu));
diff --git a/sys/amd64/amd64/intr_machdep.c b/sys/amd64/amd64/intr_machdep.c
index 3a89531..b5822b6 100644
--- a/sys/amd64/amd64/intr_machdep.c
+++ b/sys/amd64/amd64/intr_machdep.c
@@ -80,6 +80,11 @@ static STAILQ_HEAD(, pic) pics;
static int assign_cpu;
#endif
+u_long intrcnt[INTRCNT_COUNT];
+char intrnames[INTRCNT_COUNT * (MAXCOMLEN + 1)];
+size_t sintrcnt = sizeof(intrcnt);
+size_t sintrnames = sizeof(intrnames);
+
static int intr_assign_cpu(void *arg, u_char cpu);
static void intr_disable_src(void *arg);
static void intr_init(void *__dummy);
diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S
index d3522ec..fed852c 100644
--- a/sys/amd64/amd64/support.S
+++ b/sys/amd64/amd64/support.S
@@ -38,18 +38,6 @@
#include "assym.s"
- .data
- ALIGN_DATA
- .globl intrcnt, eintrcnt
-intrcnt:
- .space INTRCNT_COUNT * 8
-eintrcnt:
-
- .globl intrnames, eintrnames
-intrnames:
- .space INTRCNT_COUNT * (MAXCOMLEN + 1)
-eintrnames:
-
.text
/*
diff --git a/sys/arm/arm/irq_dispatch.S b/sys/arm/arm/irq_dispatch.S
index 8624717..e357756 100644
--- a/sys/arm/arm/irq_dispatch.S
+++ b/sys/arm/arm/irq_dispatch.S
@@ -102,14 +102,16 @@ ASENTRY_NP(irq_entry)
.align 0
- .global _C_LABEL(intrnames), _C_LABEL(eintrnames)
- .global _C_LABEL(intrcnt), _C_LABEL(eintrcnt)
+ .global _C_LABEL(intrnames), _C_LABEL(sintrnames)
+ .global _C_LABEL(intrcnt), _C_LABEL(sintrcnt)
_C_LABEL(intrnames):
.space NIRQ * (MAXCOMLEN + 1)
-_C_LABEL(eintrnames):
_C_LABEL(intrcnt):
.space NIRQ * 4
-_C_LABEL(eintrcnt):
+_C_LABEL(sintrnames):
+ .word NIRQ * (MAXCOMLEN + 1)
+_C_LABEL(sintrcnt):
+ .word NIRQ * 4
.global _C_LABEL(current_intr_depth)
_C_LABEL(current_intr_depth):
diff --git a/sys/arm/sa11x0/sa11x0_irq.S b/sys/arm/sa11x0/sa11x0_irq.S
index 30f250c..3cc3d14 100644
--- a/sys/arm/sa11x0/sa11x0_irq.S
+++ b/sys/arm/sa11x0/sa11x0_irq.S
@@ -118,16 +118,11 @@ ENTRY(sa11x0_activateirqs)
mov r1, #0xffffffff
str r1, [r0, #(SAIPIC_MR)]
mov pc, lr
-#ifdef IRQSTATS
-Lintrcnt:
- .word _C_LABEL(intrcnt)
-#endif
- .global _C_LABEL(intrnames), _C_LABEL(eintrnames)
- .global _C_LABEL(eintrcnt)
+ .global _C_LABEL(intrnames), _C_LABEL(sintrnames)
_C_LABEL(intrnames):
-_C_LABEL(eintrnames):
-_C_LABEL(eintrcnt):
+_C_LABEL(sintrnames):
+ .word 0
.globl _C_LABEL(intrcnt), _C_LABEL(sintrcnt)
@@ -135,4 +130,4 @@ _C_LABEL(intrcnt):
.space ICU_LEN*4 /* XXX Should be linked to number of interrupts */
_C_LABEL(sintrcnt):
- .space 32*4
+ .word ICU_LEN*4
diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c
index 5ae9002..9acc4f4 100644
--- a/sys/i386/i386/genassym.c
+++ b/sys/i386/i386/genassym.c
@@ -180,7 +180,6 @@ ASSYM(UC_GS, offsetof(ucontext_t, uc_mcontext.mc_gs));
ASSYM(ENOENT, ENOENT);
ASSYM(EFAULT, EFAULT);
ASSYM(ENAMETOOLONG, ENAMETOOLONG);
-ASSYM(MAXCPU, MAXCPU);
ASSYM(MAXCOMLEN, MAXCOMLEN);
ASSYM(MAXPATHLEN, MAXPATHLEN);
ASSYM(BOOTINFO_SIZE, sizeof(struct bootinfo));
diff --git a/sys/i386/i386/intr_machdep.c b/sys/i386/i386/intr_machdep.c
index 56529f7..eb6bfa1 100644
--- a/sys/i386/i386/intr_machdep.c
+++ b/sys/i386/i386/intr_machdep.c
@@ -71,6 +71,11 @@ static STAILQ_HEAD(, pic) pics;
static int assign_cpu;
#endif
+u_long intrcnt[INTRCNT_COUNT];
+char intrnames[INTRCNT_COUNT * (MAXCOMLEN + 1)];
+size_t sintrcnt = sizeof(intrcnt);
+size_t sintrnames = sizeof(intrnames);
+
static int intr_assign_cpu(void *arg, u_char cpu);
static void intr_disable_src(void *arg);
static void intr_init(void *__dummy);
diff --git a/sys/i386/i386/support.s b/sys/i386/i386/support.s
index 0c55f6f..29a258c 100644
--- a/sys/i386/i386/support.s
+++ b/sys/i386/i386/support.s
@@ -41,18 +41,6 @@
#define IDXSHIFT 10
- .data
- ALIGN_DATA
- .globl intrcnt, eintrcnt
-intrcnt:
- .space INTRCNT_COUNT * 4
-eintrcnt:
-
- .globl intrnames, eintrnames
-intrnames:
- .space INTRCNT_COUNT * (MAXCOMLEN + 1)
-eintrnames:
-
.text
/*
diff --git a/sys/ia64/ia64/locore.S b/sys/ia64/ia64/locore.S
index b2d0969..d4c1190 100644
--- a/sys/ia64/ia64/locore.S
+++ b/sys/ia64/ia64/locore.S
@@ -206,11 +206,14 @@ intr_n = 1
.byte 0
intr_n = intr_n + 1
.endr
-EXPORT(eintrnames)
+EXPORT(sintrnames)
+ .word INTRCNT_COUNT * INTRNAME_LEN
+
.align 8
EXPORT(intrcnt)
.fill INTRCNT_COUNT, 8, 0
-EXPORT(eintrcnt)
+EXPORT(sintrcnt)
+ .word INTRCNT_COUNT
.text
// in0: image base
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index f3f49ca..681b645 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -842,7 +842,7 @@ watchdog_fire(void)
curintr = intrcnt;
curname = intrnames;
inttotal = 0;
- nintr = eintrcnt - intrcnt;
+ nintr = sintrcnt;
printf("interrupt total\n");
while (--nintr >= 0) {
diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c
index 9cde590..b9ed881 100644
--- a/sys/kern/kern_intr.c
+++ b/sys/kern/kern_intr.c
@@ -1869,8 +1869,7 @@ SYSINIT(start_softintr, SI_SUB_SOFTINTR, SI_ORDER_FIRST, start_softintr,
static int
sysctl_intrnames(SYSCTL_HANDLER_ARGS)
{
- return (sysctl_handle_opaque(oidp, intrnames, eintrnames - intrnames,
- req));
+ return (sysctl_handle_opaque(oidp, intrnames, sintrnames, req));
}
SYSCTL_PROC(_hw, OID_AUTO, intrnames, CTLTYPE_OPAQUE | CTLFLAG_RD,
@@ -1879,8 +1878,7 @@ SYSCTL_PROC(_hw, OID_AUTO, intrnames, CTLTYPE_OPAQUE | CTLFLAG_RD,
static int
sysctl_intrcnt(SYSCTL_HANDLER_ARGS)
{
- return (sysctl_handle_opaque(oidp, intrcnt,
- (char *)eintrcnt - (char *)intrcnt, req));
+ return (sysctl_handle_opaque(oidp, intrcnt, sintrcnt, req));
}
SYSCTL_PROC(_hw, OID_AUTO, intrcnt, CTLTYPE_OPAQUE | CTLFLAG_RD,
@@ -1894,9 +1892,12 @@ DB_SHOW_COMMAND(intrcnt, db_show_intrcnt)
{
u_long *i;
char *cp;
+ u_int j;
cp = intrnames;
- for (i = intrcnt; i != eintrcnt && !db_pager_quit; i++) {
+ j = 0;
+ for (i = intrcnt; j < (sintrcnt / sizeof(u_long)) && !db_pager_quit;
+ i++, j++) {
if (*cp == '\0')
break;
if (*i != 0)
diff --git a/sys/mips/mips/exception.S b/sys/mips/mips/exception.S
index 7b64462..ed7554b 100644
--- a/sys/mips/mips/exception.S
+++ b/sys/mips/mips/exception.S
@@ -1134,16 +1134,19 @@ END(MipsFPTrap)
*/
.data
.globl intrcnt
- .globl eintrcnt
+ .globl sintrcnt
.globl intrnames
- .globl eintrnames
+ .globl sintrnames
intrnames:
.space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
-eintrnames:
+sintrnames:
+ .word INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
+
.align 4
intrcnt:
.space INTRCNT_COUNT * 4 * 2
-eintrcnt:
+sintrcnt:
+ .word INTRCNT_COUNT * 4 * 2
/*
diff --git a/sys/powerpc/aim/locore32.S b/sys/powerpc/aim/locore32.S
index d0a3778..ed74af2 100644
--- a/sys/powerpc/aim/locore32.S
+++ b/sys/powerpc/aim/locore32.S
@@ -90,11 +90,14 @@ GLOBAL(esym)
#define INTRCNT_COUNT 256 /* max(HROWPIC_IRQMAX,OPENPIC_IRQMAX) */
GLOBAL(intrnames)
.space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
-GLOBAL(eintrnames)
+GLOBAL(sintrnames)
+ .word INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
+
.align 4
GLOBAL(intrcnt)
.space INTRCNT_COUNT * 4 * 2
-GLOBAL(eintrcnt)
+GLOBAL(sintrcnt)
+ .word INTRCNT_COUNT * 4 * 2
.text
.globl btext
diff --git a/sys/powerpc/aim/locore64.S b/sys/powerpc/aim/locore64.S
index 5af5e3a..9a54b79 100644
--- a/sys/powerpc/aim/locore64.S
+++ b/sys/powerpc/aim/locore64.S
@@ -90,11 +90,14 @@ GLOBAL(esym)
#define INTRCNT_COUNT 256 /* max(HROWPIC_IRQMAX,OPENPIC_IRQMAX) */
GLOBAL(intrnames)
.space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
-GLOBAL(eintrnames)
+GLOBAL(sintrnames)
+ .word INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
+
.align 4
GLOBAL(intrcnt)
.space INTRCNT_COUNT * 4 * 2
-GLOBAL(eintrcnt)
+GLOBAL(sintrcnt)
+ .word INTRCNT_COUNT * 4 * 2
.text
.globl btext
diff --git a/sys/powerpc/booke/locore.S b/sys/powerpc/booke/locore.S
index de7effc..216962d 100644
--- a/sys/powerpc/booke/locore.S
+++ b/sys/powerpc/booke/locore.S
@@ -789,10 +789,13 @@ GLOBAL(kernload)
.long 0
GLOBAL(intrnames)
.space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
-GLOBAL(eintrnames)
+GLOBAL(sintrnames)
+ .word INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
+
.align 4
GLOBAL(intrcnt)
.space INTRCNT_COUNT * 4 * 2
-GLOBAL(eintrcnt)
+GLOBAL(sintrcnt)
+ .word INTRCNT_COUNT * 4 * 2
#include <powerpc/booke/trap_subr.S>
diff --git a/sys/sparc64/sparc64/exception.S b/sys/sparc64/sparc64/exception.S
index 5ef50a3..fa2f2d5 100644
--- a/sys/sparc64/sparc64/exception.S
+++ b/sys/sparc64/sparc64/exception.S
@@ -371,14 +371,17 @@ END(rsf_fatal)
.data
_ALIGN_DATA
- .globl intrnames, eintrnames
+ .globl intrnames, sintrnames
intrnames:
.space IV_MAX * (MAXCOMLEN + 1)
-eintrnames:
- .globl intrcnt, eintrcnt
+sintrnames:
+ .word IV_MAX * (MAXCOMLEN + 1)
+
+ .globl intrcnt, sintrcnt
intrcnt:
.space IV_MAX * 8
-eintrcnt:
+sintrcnt:
+ .word IV_MAX * 8
.text
diff --git a/sys/sparc64/sparc64/intr_machdep.c b/sys/sparc64/sparc64/intr_machdep.c
index 112ddab..9a7e92f 100644
--- a/sys/sparc64/sparc64/intr_machdep.c
+++ b/sys/sparc64/sparc64/intr_machdep.c
@@ -171,7 +171,7 @@ static int
intrcnt_setname(const char *name, int index)
{
- if (intrnames + (MAXCOMLEN + 1) * index >= eintrnames)
+ if ((MAXCOMLEN + 1) * index >= sintrnames)
return (E2BIG);
snprintf(intrnames + (MAXCOMLEN + 1) * index, MAXCOMLEN + 1, "%-*s",
MAXCOMLEN, name);
diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h
index fb253ae..3dace82 100644
--- a/sys/sys/interrupt.h
+++ b/sys/sys/interrupt.h
@@ -149,10 +149,10 @@ extern struct intr_event *clk_intr_event;
extern void *vm_ih;
/* Counts and names for statistics (defined in MD code). */
-extern u_long eintrcnt[]; /* end of intrcnt[] */
-extern char eintrnames[]; /* end of intrnames[] */
extern u_long intrcnt[]; /* counts for for each device and stray */
extern char intrnames[]; /* string table containing device names */
+extern size_t sintrcnt; /* size of intrcnt table */
+extern size_t sintrnames; /* size of intrnames table */
#ifdef DDB
void db_dump_intr_event(struct intr_event *ie, int handlers);
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c
index d31fdb5..39e71fa 100644
--- a/usr.bin/vmstat/vmstat.c
+++ b/usr.bin/vmstat/vmstat.c
@@ -90,12 +90,12 @@ static struct nlist namelist[] = {
{ "_nchstats" },
#define X_INTRNAMES 5
{ "_intrnames" },
-#define X_EINTRNAMES 6
- { "_eintrnames" },
+#define X_SINTRNAMES 6
+ { "_sintrnames" },
#define X_INTRCNT 7
{ "_intrcnt" },
-#define X_EINTRCNT 8
- { "_eintrcnt" },
+#define X_SINTRCNT 8
+ { "_sintrcnt" },
#define X_KMEMSTATS 9
{ "_kmemstatistics" },
#define X_KMEMZONES 10
@@ -1153,10 +1153,8 @@ dointr(void)
uptime = getuptime();
if (kd != NULL) {
- intrcntlen = namelist[X_EINTRCNT].n_value -
- namelist[X_INTRCNT].n_value;
- inamlen = namelist[X_EINTRNAMES].n_value -
- namelist[X_INTRNAMES].n_value;
+ intrcntlen = namelist[X_SINTRCNT].n_value;
+ inamlen = namelist[X_SINTRNAMES].n_value;
if ((intrcnt = malloc(intrcntlen)) == NULL ||
(intrname = malloc(inamlen)) == NULL)
err(1, "malloc()");
OpenPOWER on IntegriCloud