Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: dump.h | |
5 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
7 | * | |
8 | * The above named program is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU General Public | |
10 | * License version 2 as published by the Free Software Foundation. | |
11 | * | |
12 | * The above named program is distributed in the hope that it will be | |
13 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public | |
18 | * License along with this work; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | * | |
21 | * ========== Copyright Header End ============================================ | |
22 | */ | |
23 | /* | |
24 | * Copyright (C) 2001, Sun Microsystems, Inc. | |
25 | */ | |
26 | #pragma ident "@(#)1.1 02/04/09 SMI dump.h" | |
27 | ||
28 | #ifndef _DUMP_H | |
29 | #define _DUMP_H | |
30 | ||
31 | #include <stdio.h> | |
32 | ||
33 | typedef struct { | |
34 | void *oldaddr; | |
35 | void *newaddr; | |
36 | unsigned int read:1; | |
37 | } dt_addrs_t; | |
38 | ||
39 | typedef struct { | |
40 | dt_addrs_t *addrs; | |
41 | int size; | |
42 | int next; | |
43 | } dumptab_t; | |
44 | ||
45 | // helper functions... | |
46 | void print_addr (FILE *f, void *vp); | |
47 | ||
48 | // dump table stuff | |
49 | void dumptab_init(dumptab_t *dtp); | |
50 | void dumptab_free(dumptab_t *dtp); | |
51 | void dumptab_reset(dumptab_t *dtp); | |
52 | dt_addrs_t* dumptab_lookup_old(dumptab_t *dtp, void *oldp); | |
53 | dt_addrs_t* dumptab_lookup_new(dumptab_t *dtp, void *newp); | |
54 | int dumptab_add(dumptab_t *dtp, void *oldp, void *newp); | |
55 | void print_dumptab(dumptab_t *dtp); | |
56 | ||
57 | extern dumptab_t dtab; | |
58 | ||
59 | // dump functions | |
60 | void dumpStructAddr (FILE *f, char *addr, const char *name, int size, int arrlen); | |
61 | void dumpDynArrDelm (FILE *f, const char *name, int idx, int total); | |
62 | void dumpScalar (FILE *f, const char *name, char *data, size_t size); | |
63 | void dumpPtrArr (FILE *f, const char *name, char *data, size_t size, size_t arr_size); | |
64 | void dumpArr (FILE *f, const char *name, unsigned char *data, size_t num, size_t size); | |
65 | void dumpString (FILE *f, const char *name, char *str); | |
66 | ||
67 | #define DUMPF_REQUIRED 0x1 | |
68 | #define DUMPF_STRING 0x2 | |
69 | #define DUMPF_PTR 0x4 | |
70 | #define DUMPF_NO_MALLOC 0x8 | |
71 | #define DUMPF_PTR_ARR 0x10 | |
72 | ||
73 | // restore stuff | |
74 | struct restore_map_t { | |
75 | const char *name; | |
76 | size_t offset; | |
77 | size_t size; | |
78 | size_t index; | |
79 | unsigned int flags; | |
80 | unsigned int read:1; | |
81 | }; | |
82 | ||
83 | // do you have to malloc these types? | |
84 | #define NO_MALLOC_archglobals_t 1 | |
85 | #define NO_MALLOC_Serial_state_t 1 | |
86 | #define NO_MALLOC_Simge_state_t 1 | |
87 | #define NO_MALLOC_Tlb_entry_t 0 | |
88 | #define NO_MALLOC_schizo_state_t 1 | |
89 | #define NO_MALLOC_block_t 0 | |
90 | #define NO_MALLOC_blk_cache_t 0 | |
91 | #define NO_MALLOC_partfile_t 0 | |
92 | #define NO_MALLOC_pcidisk_state_t 1 | |
93 | #define NO_MALLOC_pcidisk_lunit_t 1 | |
94 | #define NO_MALLOC_Tlb_line_t 0 | |
95 | #define NO_MALLOC_Spit_mmu_t 1 | |
96 | #define NO_MALLOC_brkpoint_info_t 0 | |
97 | #define NO_MALLOC_FcpuT 1 | |
98 | ||
99 | unsigned char * | |
100 | general_restore_type (char *dir, const char *filename, struct restore_map_t *map, unsigned char *rp, size_t size, int no_malloc); | |
101 | int dump_debugf_init (const char *fn); | |
102 | void dump_debugf_close (); | |
103 | ||
104 | #define DUMP_FNAME_SIZE 64 | |
105 | #define DUMP_DIRF_SIZE 272 | |
106 | ||
107 | #endif // _DUMP_H |