dumphdr.h revision ca3e8d88e8c867355e441fbc914c52e7416fc537
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DUMPHDR_H
#define _SYS_DUMPHDR_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* The dump header describes the contents of a crash dump. Two headers
* are written out: one at the beginning of the dump, and the other at
* the very end of the dump device. The terminal header is at a known
* location (end of device) so we can always find it. The initial header
* is redundant, but helps savecore(1M) determine whether the dump has been
* overwritten by swap activity. See dumpadm(1M) for dump configuration.
*/
#define DUMP_ERPTSIZE (P2ROUNDUP( \
(ERPT_DATA_SZ / 2) * \
(ERPT_EVCH_MAX + \
ERPT_MAX_ERRS * ERPT_HIWAT), \
DUMP_OFFSET)) /* ereport save area */
typedef struct dumphdr {
long dump_pageshift; /* log2(pagesize) */
long dump_pagesize; /* pagesize */
long dump_hashmask; /* page translation hash mask */
long dump_nvtop; /* number of vtop table entries */
} dumphdr_t;
/*
* Values for dump_flags
*/
/*
* Dump translation map hash table entry.
*/
typedef struct dump_map {
} dump_map_t;
/*
* Dump translation map hash function.
*/
(dhp)->dump_hashmask)
/*
* Encoding of the csize word used to provide meta information
* between dumpsys and savecore.
*
* tag size
* 1-4095 1..dump_maxcsize stream block
* 0 1..pagesize one lzjb page
* 0 0 marks end of data
*/
typedef uint32_t dumpcsize_t;
#define DUMP_MAX_TAG (0xfffU)
#define DUMP_MAX_CSIZE (0xfffffU)
#define DUMP_SET_CSIZE(w, v) \
#define DUMP_GET_CSIZE(w) ((w) & DUMP_MAX_CSIZE)
typedef struct dumpstreamhdr {
#define DUMP_STREAM_MAGIC "StrmHdr"
/* The number of helpers is limited by the number of stream tags. */
#define DUMP_MAX_NHELPER DUMP_MAX_TAG
/*
* The dump data header is placed after the dumphdr in the compressed
* image. It is not needed after savecore runs and the data pages have
* been decompressed.
*/
typedef struct dumpdatahdr {
#define DUMP_DATAHDR_VERSION 1
#ifdef _KERNEL
extern u_offset_t dumpvp_size;
extern int dump_conflags;
extern char *dumppath;
extern int dump_timeout;
extern int dump_timeleft;
extern int dump_ioerr;
extern int sync_timeout;
extern int sync_timeleft;
extern void dumpfini(void);
extern void dump_resize(void);
extern void dumpsys(void);
extern void dumpsys_helper(void);
extern void dump_messages(void);
extern void dump_ereports(void);
extern void dumpvp_write(const void *, size_t);
extern int dumpvp_resize(void);
extern int dump_plat_addr(void);
extern void dump_plat_pfn(void);
extern int dump_plat_data(void *);
/*
* Define a CPU count threshold that determines when to employ
* bzip2. The values are defined per-platform in dump_plat_mincpu, and
* and the old format dump is produced.
*/
extern uint_t dump_plat_mincpu;
#define DUMP_PLAT_SUN4U_MINCPU 51
#define DUMP_PLAT_SUN4U_OPL_MINCPU 8
#define DUMP_PLAT_SUN4V_MINCPU 128
#define DUMP_PLAT_X86_64_MINCPU 11
#define DUMP_PLAT_X86_32_MINCPU 0
/*
* Pages may be stolen at dump time. Prevent the pages from ever being
* allocated while dump is running.
*/
extern int dump_test_used(pfn_t);
extern int dump_check_used;
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DUMPHDR_H */