17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5ae115bc7Smrj * Common Development and Distribution License (the "License"). 6ae115bc7Smrj * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*e7cbe64fSgw25295 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_DUMPHDR_H 277c478bd9Sstevel@tonic-gate #define _SYS_DUMPHDR_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #include <sys/types.h> 327c478bd9Sstevel@tonic-gate #include <sys/param.h> 337c478bd9Sstevel@tonic-gate #include <sys/utsname.h> 347c478bd9Sstevel@tonic-gate #include <sys/log.h> 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #ifdef __cplusplus 377c478bd9Sstevel@tonic-gate extern "C" { 387c478bd9Sstevel@tonic-gate #endif 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate /* 417c478bd9Sstevel@tonic-gate * The dump header describes the contents of a crash dump. Two headers 427c478bd9Sstevel@tonic-gate * are written out: one at the beginning of the dump, and the other at 437c478bd9Sstevel@tonic-gate * the very end of the dump device. The terminal header is at a known 447c478bd9Sstevel@tonic-gate * location (end of device) so we can always find it. The initial header 457c478bd9Sstevel@tonic-gate * is redundant, but helps savecore(1M) determine whether the dump has been 467c478bd9Sstevel@tonic-gate * overwritten by swap activity. See dumpadm(1M) for dump configuration. 477c478bd9Sstevel@tonic-gate */ 487c478bd9Sstevel@tonic-gate #define DUMP_MAGIC 0xdefec8edU /* dump magic number */ 497c478bd9Sstevel@tonic-gate #define DUMP_VERSION 9 /* version of this dumphdr */ 507c478bd9Sstevel@tonic-gate #define DUMP_WORDSIZE (sizeof (long) * NBBY) /* word size (32 or 64) */ 517c478bd9Sstevel@tonic-gate #define DUMP_PANICSIZE 200 /* Max panic string copied */ 527c478bd9Sstevel@tonic-gate #define DUMP_COMPRESS_RATIO 2 /* conservative; usually 2.5+ */ 537c478bd9Sstevel@tonic-gate #define DUMP_OFFSET 65536 /* pad at start/end of dev */ 547c478bd9Sstevel@tonic-gate #define DUMP_LOGSIZE (2 * LOG_HIWAT) /* /dev/log message save area */ 557c478bd9Sstevel@tonic-gate #define DUMP_ERPTSIZE (P2ROUNDUP( \ 567c478bd9Sstevel@tonic-gate (ERPT_DATA_SZ / 2) * \ 577c478bd9Sstevel@tonic-gate (ERPT_EVCH_MAX + \ 587c478bd9Sstevel@tonic-gate ERPT_MAX_ERRS * ERPT_HIWAT), \ 597c478bd9Sstevel@tonic-gate DUMP_OFFSET)) /* ereport save area */ 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate typedef struct dumphdr { 627c478bd9Sstevel@tonic-gate uint32_t dump_magic; /* magic number */ 637c478bd9Sstevel@tonic-gate uint32_t dump_version; /* version number */ 647c478bd9Sstevel@tonic-gate uint32_t dump_flags; /* flags; see below */ 657c478bd9Sstevel@tonic-gate uint32_t dump_wordsize; /* 32 or 64 */ 667c478bd9Sstevel@tonic-gate offset_t dump_start; /* starting offset on dump device */ 677c478bd9Sstevel@tonic-gate offset_t dump_ksyms; /* offset of compressed symbol table */ 687c478bd9Sstevel@tonic-gate offset_t dump_pfn; /* offset of pfn table for all pages */ 697c478bd9Sstevel@tonic-gate offset_t dump_map; /* offset of page translation map */ 707c478bd9Sstevel@tonic-gate offset_t dump_data; /* offset of actual dump data */ 717c478bd9Sstevel@tonic-gate struct utsname dump_utsname; /* copy of utsname structure */ 727c478bd9Sstevel@tonic-gate char dump_platform[SYS_NMLN]; /* platform name (uname -i) */ 737c478bd9Sstevel@tonic-gate char dump_panicstring[DUMP_PANICSIZE]; /* copy of panicstr */ 747c478bd9Sstevel@tonic-gate time_t dump_crashtime; /* time of crash */ 757c478bd9Sstevel@tonic-gate long dump_pageshift; /* log2(pagesize) */ 767c478bd9Sstevel@tonic-gate long dump_pagesize; /* pagesize */ 777c478bd9Sstevel@tonic-gate long dump_hashmask; /* page translation hash mask */ 787c478bd9Sstevel@tonic-gate long dump_nvtop; /* number of vtop table entries */ 797c478bd9Sstevel@tonic-gate pgcnt_t dump_npages; /* number of data pages */ 807c478bd9Sstevel@tonic-gate size_t dump_ksyms_size; /* kernel symbol table size */ 817c478bd9Sstevel@tonic-gate size_t dump_ksyms_csize; /* compressed symbol table size */ 827c478bd9Sstevel@tonic-gate } dumphdr_t; 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate /* 857c478bd9Sstevel@tonic-gate * Values for dump_flags 867c478bd9Sstevel@tonic-gate */ 877c478bd9Sstevel@tonic-gate #define DF_VALID 0x00000001 /* Dump is valid (savecore clears) */ 887c478bd9Sstevel@tonic-gate #define DF_COMPLETE 0x00000002 /* All pages present as configured */ 897c478bd9Sstevel@tonic-gate #define DF_LIVE 0x00000004 /* Dump was taken on a live system */ 907c478bd9Sstevel@tonic-gate #define DF_KERNEL 0x00010000 /* Contains kernel pages only */ 917c478bd9Sstevel@tonic-gate #define DF_ALL 0x00020000 /* Contains all pages */ 927c478bd9Sstevel@tonic-gate #define DF_CURPROC 0x00040000 /* Contains kernel + cur proc pages */ 937c478bd9Sstevel@tonic-gate #define DF_CONTENT 0xffff0000 /* The set of all dump content flags */ 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate /* 967c478bd9Sstevel@tonic-gate * Dump translation map hash table entry. 977c478bd9Sstevel@tonic-gate */ 987c478bd9Sstevel@tonic-gate typedef struct dump_map { 997c478bd9Sstevel@tonic-gate offset_t dm_first; 1007c478bd9Sstevel@tonic-gate offset_t dm_next; 1017c478bd9Sstevel@tonic-gate offset_t dm_data; 1027c478bd9Sstevel@tonic-gate struct as *dm_as; 1037c478bd9Sstevel@tonic-gate uintptr_t dm_va; 1047c478bd9Sstevel@tonic-gate } dump_map_t; 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate /* 1077c478bd9Sstevel@tonic-gate * Dump translation map hash function. 1087c478bd9Sstevel@tonic-gate */ 1097c478bd9Sstevel@tonic-gate #define DUMP_HASH(dhp, as, va) \ 1107c478bd9Sstevel@tonic-gate ((((uintptr_t)(as) >> 3) + ((va) >> (dhp)->dump_pageshift)) & \ 1117c478bd9Sstevel@tonic-gate (dhp)->dump_hashmask) 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate #ifdef _KERNEL 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate extern kmutex_t dump_lock; 1167c478bd9Sstevel@tonic-gate extern struct vnode *dumpvp; 1177c478bd9Sstevel@tonic-gate extern u_offset_t dumpvp_size; 1187c478bd9Sstevel@tonic-gate extern struct dumphdr *dumphdr; 1197c478bd9Sstevel@tonic-gate extern int dump_conflags; 1207c478bd9Sstevel@tonic-gate extern char *dumppath; 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gate extern int dump_timeout; 1237c478bd9Sstevel@tonic-gate extern int dump_timeleft; 124843e1988Sjohnlev extern int dump_ioerr; 1257c478bd9Sstevel@tonic-gate extern int sync_timeout; 1267c478bd9Sstevel@tonic-gate extern int sync_timeleft; 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gate extern int dumpinit(struct vnode *, char *, int); 1297c478bd9Sstevel@tonic-gate extern void dumpfini(void); 1307c478bd9Sstevel@tonic-gate extern void dump_resize(void); 1317c478bd9Sstevel@tonic-gate extern void dump_page(pfn_t); 1327c478bd9Sstevel@tonic-gate extern void dump_addpage(struct as *, void *, pfn_t); 1337c478bd9Sstevel@tonic-gate extern void dumpsys(void); 1347c478bd9Sstevel@tonic-gate extern void dump_messages(void); 1357c478bd9Sstevel@tonic-gate extern void dump_ereports(void); 1367c478bd9Sstevel@tonic-gate extern void dumpvp_write(const void *, size_t); 137*e7cbe64fSgw25295 extern int dumpvp_resize(void); 138ae115bc7Smrj extern int dump_plat_addr(void); 139ae115bc7Smrj extern void dump_plat_pfn(void); 140ae115bc7Smrj extern int dump_plat_data(void *); 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1457c478bd9Sstevel@tonic-gate } 1467c478bd9Sstevel@tonic-gate #endif 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate #endif /* _SYS_DUMPHDR_H */ 149