Date: Mon, 16 Nov 2015 23:02:34 +0000 (UTC) From: Marius Strobl <marius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290957 - in head/sys: kern sparc64/include sparc64/sparc64 Message-ID: <201511162302.tAGN2YE7001284@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marius Date: Mon Nov 16 23:02:33 2015 New Revision: 290957 URL: https://svnweb.freebsd.org/changeset/base/290957 Log: - Unbreak dumpsys(9) on sparc64 after r276772 - While at it, arrange #ifndefs in kern_dump.c more intelligently; it's rather confusing to have multiple competing and/or unused functions in the kernel. Modified: head/sys/kern/kern_dump.c head/sys/sparc64/include/dump.h head/sys/sparc64/sparc64/dump_machdep.c Modified: head/sys/kern/kern_dump.c ============================================================================== --- head/sys/kern/kern_dump.c Mon Nov 16 22:50:23 2015 (r290956) +++ head/sys/kern/kern_dump.c Mon Nov 16 23:02:33 2015 (r290957) @@ -66,10 +66,10 @@ static size_t fragsz; struct dump_pa dump_map[DUMPSYS_MD_PA_NPAIRS]; +#if !defined(__powerpc__) && !defined(__sparc__) void dumpsys_gen_pa_init(void) { -#if !defined(__sparc__) && !defined(__powerpc__) int n, idx; bzero(dump_map, sizeof(dump_map)); @@ -80,8 +80,8 @@ dumpsys_gen_pa_init(void) dump_map[n].pa_start = dump_avail[idx]; dump_map[n].pa_size = dump_avail[idx + 1] - dump_avail[idx]; } -#endif } +#endif struct dump_pa * dumpsys_gen_pa_next(struct dump_pa *mdp) @@ -99,20 +99,24 @@ dumpsys_gen_pa_next(struct dump_pa *mdp) void dumpsys_gen_wbinv_all(void) { + } void dumpsys_gen_unmap_chunk(vm_paddr_t pa __unused, size_t chunk __unused, void *va __unused) { + } +#if !defined(__sparc__) int dumpsys_gen_write_aux_headers(struct dumperinfo *di) { return (0); } +#endif int dumpsys_buf_write(struct dumperinfo *di, char *ptr, size_t sz) @@ -233,6 +237,7 @@ dumpsys_foreach_chunk(dumpsys_callback_t return (seqnr); } +#if !defined(__sparc__) static off_t fileofs; static int @@ -391,3 +396,4 @@ dumpsys_generic(struct dumperinfo *di) printf("\n** DUMP FAILED (ERROR %d) **\n", error); return (error); } +#endif Modified: head/sys/sparc64/include/dump.h ============================================================================== --- head/sys/sparc64/include/dump.h Mon Nov 16 22:50:23 2015 (r290956) +++ head/sys/sparc64/include/dump.h Mon Nov 16 23:02:33 2015 (r290957) @@ -35,7 +35,6 @@ #define KERNELDUMP_ARCH_VERSION KERNELDUMP_SPARC64_VERSION #define EM_VALUE EM_SPARCV9 -void dumpsys_pa_init(void); int dumpsys(struct dumperinfo *); static inline struct dump_pa * @@ -60,13 +59,6 @@ dumpsys_unmap_chunk(vm_paddr_t pa, size_ } static inline int -dumpsys_write_aux_headers(struct dumperinfo *di) -{ - - return (dumpsys_gen_write_aux_headers(di)); -} - -static inline int minidumpsys(struct dumperinfo *di) { Modified: head/sys/sparc64/sparc64/dump_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/dump_machdep.c Mon Nov 16 22:50:23 2015 (r290956) +++ head/sys/sparc64/sparc64/dump_machdep.c Mon Nov 16 23:02:33 2015 (r290957) @@ -55,18 +55,6 @@ extern struct dump_pa dump_map[DUMPSYS_M int do_minidump = 0; void -dumpsys_pa_init(void) -{ - int i; - - memset(dump_map, 0, sizeof(dump_map)); - for (i = 0; i < sparc64_nmemreg; i++) { - dump_map[i].pa_start = sparc64_memreg[i].mr_start; - dump_map[i].pa_size = sparc64_memreg[i].mr_size; - } -} - -void dumpsys_map_chunk(vm_paddr_t pa, size_t chunk __unused, void **va) { @@ -89,16 +77,18 @@ int dumpsys(struct dumperinfo *di) { static struct kerneldumpheader kdh; - struct sparc64_dump_hdr hdr; vm_size_t size, totsize, hdrsize; int error, i, nreg; - /* Calculate dump size. */ + /* Set up dump_map and calculate dump size. */ size = 0; nreg = sparc64_nmemreg; - for (i = 0; i < sparc64_nmemreg; i++) - size += sparc64_memreg[i].mr_size; + memset(dump_map, 0, sizeof(dump_map)); + for (i = 0; i < nreg; i++) { + dump_map[i].pa_start = sparc64_memreg[i].mr_start; + size += dump_map[i].pa_size = sparc64_memreg[i].mr_size; + } /* Account for the header size. */ hdrsize = roundup2(sizeof(hdr) + sizeof(struct sparc64_dump_reg) * nreg, DEV_BSIZE); @@ -139,7 +129,7 @@ dumpsys(struct dumperinfo *di) fileofs = hdrsize; /* Now, write out the region descriptors. */ - for (i = 0; i < sparc64_nmemreg; i++) { + for (i = 0; i < nreg; i++) { error = reg_write(di, sparc64_memreg[i].mr_start, sparc64_memreg[i].mr_size); if (error != 0)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511162302.tAGN2YE7001284>