Date: Mon, 18 Jul 2011 15:19:41 +0000 (UTC) From: Attilio Rao <attilio@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r224187 - in head: sys/amd64/amd64 sys/arm/arm sys/arm/sa11x0 sys/i386/i386 sys/ia64/ia64 sys/kern sys/mips/mips sys/powerpc/aim sys/powerpc/booke sys/sparc64/sparc64 sys/sys usr.bin/vm... Message-ID: <201107181519.p6IFJfOK028280@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: attilio Date: Mon Jul 18 15:19:40 2011 New Revision: 224187 URL: http://svn.freebsd.org/changeset/base/224187 Log: - 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) Modified: head/sys/amd64/amd64/genassym.c head/sys/amd64/amd64/intr_machdep.c head/sys/amd64/amd64/support.S head/sys/arm/arm/irq_dispatch.S head/sys/arm/sa11x0/sa11x0_irq.S head/sys/i386/i386/genassym.c head/sys/i386/i386/intr_machdep.c head/sys/i386/i386/support.s head/sys/ia64/ia64/locore.S head/sys/kern/kern_clock.c head/sys/kern/kern_intr.c head/sys/mips/mips/exception.S head/sys/powerpc/aim/locore32.S head/sys/powerpc/aim/locore64.S head/sys/powerpc/booke/locore.S head/sys/sparc64/sparc64/exception.S head/sys/sparc64/sparc64/intr_machdep.c head/sys/sys/interrupt.h head/usr.bin/vmstat/vmstat.c Modified: head/sys/amd64/amd64/genassym.c ============================================================================== --- head/sys/amd64/amd64/genassym.c Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/amd64/amd64/genassym.c Mon Jul 18 15:19:40 2011 (r224187) @@ -201,7 +201,6 @@ ASSYM(UC_EFLAGS, offsetof(ucontext_t, uc ASSYM(ENOENT, ENOENT); ASSYM(EFAULT, EFAULT); ASSYM(ENAMETOOLONG, ENAMETOOLONG); -ASSYM(MAXCPU, MAXCPU); ASSYM(MAXCOMLEN, MAXCOMLEN); ASSYM(MAXPATHLEN, MAXPATHLEN); ASSYM(PC_SIZEOF, sizeof(struct pcpu)); Modified: head/sys/amd64/amd64/intr_machdep.c ============================================================================== --- head/sys/amd64/amd64/intr_machdep.c Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/amd64/amd64/intr_machdep.c Mon Jul 18 15:19:40 2011 (r224187) @@ -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); Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/amd64/amd64/support.S Mon Jul 18 15:19:40 2011 (r224187) @@ -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 /* Modified: head/sys/arm/arm/irq_dispatch.S ============================================================================== --- head/sys/arm/arm/irq_dispatch.S Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/arm/arm/irq_dispatch.S Mon Jul 18 15:19:40 2011 (r224187) @@ -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): Modified: head/sys/arm/sa11x0/sa11x0_irq.S ============================================================================== --- head/sys/arm/sa11x0/sa11x0_irq.S Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/arm/sa11x0/sa11x0_irq.S Mon Jul 18 15:19:40 2011 (r224187) @@ -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 Modified: head/sys/i386/i386/genassym.c ============================================================================== --- head/sys/i386/i386/genassym.c Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/i386/i386/genassym.c Mon Jul 18 15:19:40 2011 (r224187) @@ -180,7 +180,6 @@ ASSYM(UC_GS, offsetof(ucontext_t, uc_mco ASSYM(ENOENT, ENOENT); ASSYM(EFAULT, EFAULT); ASSYM(ENAMETOOLONG, ENAMETOOLONG); -ASSYM(MAXCPU, MAXCPU); ASSYM(MAXCOMLEN, MAXCOMLEN); ASSYM(MAXPATHLEN, MAXPATHLEN); ASSYM(BOOTINFO_SIZE, sizeof(struct bootinfo)); Modified: head/sys/i386/i386/intr_machdep.c ============================================================================== --- head/sys/i386/i386/intr_machdep.c Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/i386/i386/intr_machdep.c Mon Jul 18 15:19:40 2011 (r224187) @@ -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); Modified: head/sys/i386/i386/support.s ============================================================================== --- head/sys/i386/i386/support.s Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/i386/i386/support.s Mon Jul 18 15:19:40 2011 (r224187) @@ -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 /* Modified: head/sys/ia64/ia64/locore.S ============================================================================== --- head/sys/ia64/ia64/locore.S Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/ia64/ia64/locore.S Mon Jul 18 15:19:40 2011 (r224187) @@ -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 Modified: head/sys/kern/kern_clock.c ============================================================================== --- head/sys/kern/kern_clock.c Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/kern/kern_clock.c Mon Jul 18 15:19:40 2011 (r224187) @@ -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) { Modified: head/sys/kern/kern_intr.c ============================================================================== --- head/sys/kern/kern_intr.c Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/kern/kern_intr.c Mon Jul 18 15:19:40 2011 (r224187) @@ -1869,8 +1869,7 @@ SYSINIT(start_softintr, SI_SUB_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, CT 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) Modified: head/sys/mips/mips/exception.S ============================================================================== --- head/sys/mips/mips/exception.S Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/mips/mips/exception.S Mon Jul 18 15:19:40 2011 (r224187) @@ -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 /* Modified: head/sys/powerpc/aim/locore32.S ============================================================================== --- head/sys/powerpc/aim/locore32.S Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/powerpc/aim/locore32.S Mon Jul 18 15:19:40 2011 (r224187) @@ -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 Modified: head/sys/powerpc/aim/locore64.S ============================================================================== --- head/sys/powerpc/aim/locore64.S Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/powerpc/aim/locore64.S Mon Jul 18 15:19:40 2011 (r224187) @@ -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 Modified: head/sys/powerpc/booke/locore.S ============================================================================== --- head/sys/powerpc/booke/locore.S Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/powerpc/booke/locore.S Mon Jul 18 15:19:40 2011 (r224187) @@ -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> Modified: head/sys/sparc64/sparc64/exception.S ============================================================================== --- head/sys/sparc64/sparc64/exception.S Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/sparc64/sparc64/exception.S Mon Jul 18 15:19:40 2011 (r224187) @@ -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 Modified: head/sys/sparc64/sparc64/intr_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/intr_machdep.c Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/sparc64/sparc64/intr_machdep.c Mon Jul 18 15:19:40 2011 (r224187) @@ -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); Modified: head/sys/sys/interrupt.h ============================================================================== --- head/sys/sys/interrupt.h Mon Jul 18 14:41:08 2011 (r224186) +++ head/sys/sys/interrupt.h Mon Jul 18 15:19:40 2011 (r224187) @@ -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); Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Mon Jul 18 14:41:08 2011 (r224186) +++ head/usr.bin/vmstat/vmstat.c Mon Jul 18 15:19:40 2011 (r224187) @@ -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()");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107181519.p6IFJfOK028280>