diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c index aba790d0bd5e..1c9abd5ab1b1 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 3a8953153ff8..b5822b6f4f35 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 d3522ec52e0b..fed852c77b00 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 862471761b4d..e3577565ed32 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 30f250cfc25e..3cc3d14f7c3b 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 5ae90029fba9..9acc4f4e2726 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 56529f7b5b03..eb6bfa1b9e4a 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 0c55f6f6b733..29a258cc0be7 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 b2d096953c66..d4c1190f5d83 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 f3f49cafa8e1..681b64504db7 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 9cde5903f475..b9ed881224b5 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 7b64462fdf55..ed7554bc7c03 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 d0a377816691..ed74af2fc710 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 5af5e3a53ef2..9a54b79a4cdd 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 de7effc64f31..216962d09e3d 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 diff --git a/sys/sparc64/sparc64/exception.S b/sys/sparc64/sparc64/exception.S index 5ef50a373bfb..fa2f2d5cfd47 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 112ddabc0217..9a7e92fa6a21 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 fb253ae7a37b..3dace82ed3b4 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 d31fdb54502e..39e71fab8d3b 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()");