kcore.h revision 1.6 1 1.6 tsutsui /* $NetBSD: kcore.h,v 1.6 2023/01/27 23:29:14 tsutsui Exp $ */
2 1.1 leo
3 1.2 thorpej /*-
4 1.2 thorpej * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
5 1.1 leo * All rights reserved.
6 1.1 leo *
7 1.2 thorpej * This code is derived from software contributed to The NetBSD Foundation
8 1.2 thorpej * by Gordon W. Ross, Jason R. Thorpe, and Leo Weppelman.
9 1.2 thorpej *
10 1.1 leo * Redistribution and use in source and binary forms, with or without
11 1.1 leo * modification, are permitted provided that the following conditions
12 1.1 leo * are met:
13 1.1 leo * 1. Redistributions of source code must retain the above copyright
14 1.1 leo * notice, this list of conditions and the following disclaimer.
15 1.1 leo * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 leo * notice, this list of conditions and the following disclaimer in the
17 1.1 leo * documentation and/or other materials provided with the distribution.
18 1.2 thorpej *
19 1.2 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.2 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.2 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.2 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.2 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.2 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.2 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.2 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.2 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.2 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.2 thorpej * POSSIBILITY OF SUCH DAMAGE.
30 1.1 leo */
31 1.1 leo
32 1.1 leo #ifndef _M68K_KCORE_H_
33 1.1 leo #define _M68K_KCORE_H_
34 1.1 leo
35 1.2 thorpej /*
36 1.2 thorpej * Unified m68k kcore header descriptions.
37 1.2 thorpej *
38 1.2 thorpej * NOTE: We must have all possible m68k kcore types defined in this
39 1.2 thorpej * file. Otherwise, we require kernel sources for all m68k platforms
40 1.2 thorpej * to build userland.
41 1.2 thorpej *
42 1.2 thorpej * We must provide STE/PTE bits in the kcore header for a couple
43 1.2 thorpej * of reasons:
44 1.2 thorpej *
45 1.2 thorpej * - different platforms may have the MMUs configured for different
46 1.2 thorpej * page sizes
47 1.2 thorpej * - we may not have a specific platform's pte.h available to us
48 1.2 thorpej *
49 1.2 thorpej * These are on-disk structures; use fixed-sized types!
50 1.2 thorpej *
51 1.2 thorpej * The total size of the cpu_kcore_hdr should be <= DEV_BSIZE!
52 1.2 thorpej */
53 1.2 thorpej
54 1.2 thorpej /*
55 1.2 thorpej * kcore information for Utah-derived pmaps
56 1.2 thorpej */
57 1.2 thorpej #define M68K_NPHYS_RAM_SEGS 8 /* XXX */
58 1.2 thorpej struct m68k_kcore_hdr {
59 1.2 thorpej int32_t mmutype; /* MMU type */
60 1.6 tsutsui uint32_t sg_v; /* STE bits */
61 1.6 tsutsui uint32_t sg_frame;
62 1.6 tsutsui uint32_t sg_ishift;
63 1.6 tsutsui uint32_t sg_pmask;
64 1.6 tsutsui uint32_t sg40_shift1;
65 1.6 tsutsui uint32_t sg40_mask2;
66 1.6 tsutsui uint32_t sg40_shift2;
67 1.6 tsutsui uint32_t sg40_mask3;
68 1.6 tsutsui uint32_t sg40_shift3;
69 1.6 tsutsui uint32_t sg40_addr1;
70 1.6 tsutsui uint32_t sg40_addr2;
71 1.6 tsutsui uint32_t pg_v; /* PTE bits */
72 1.6 tsutsui uint32_t pg_frame;
73 1.6 tsutsui uint32_t sysseg_pa; /* PA of Sysseg[] */
74 1.6 tsutsui uint32_t reloc; /* value added to relocate a symbol
75 1.2 thorpej before address translation is
76 1.2 thorpej enabled */
77 1.6 tsutsui uint32_t relocend; /* if kernbase < va < relocend, we
78 1.2 thorpej can do simple relocation to get
79 1.2 thorpej the physical address */
80 1.2 thorpej phys_ram_seg_t ram_segs[M68K_NPHYS_RAM_SEGS];
81 1.2 thorpej };
82 1.2 thorpej
83 1.2 thorpej /*
84 1.4 fredette * kcore information for the sun2
85 1.4 fredette */
86 1.4 fredette struct sun2_kcore_hdr {
87 1.6 tsutsui uint32_t segshift;
88 1.6 tsutsui uint32_t pg_frame; /* PTE bits */
89 1.6 tsutsui uint32_t pg_valid;
90 1.6 tsutsui uint8_t ksegmap[512]; /* kernel segment map */
91 1.4 fredette };
92 1.4 fredette
93 1.4 fredette /*
94 1.2 thorpej * kcore information for the sun3
95 1.2 thorpej */
96 1.2 thorpej struct sun3_kcore_hdr {
97 1.6 tsutsui uint32_t segshift;
98 1.6 tsutsui uint32_t pg_frame; /* PTE bits */
99 1.6 tsutsui uint32_t pg_valid;
100 1.6 tsutsui uint8_t ksegmap[256]; /* kernel segment map */
101 1.2 thorpej };
102 1.2 thorpej
103 1.2 thorpej /*
104 1.2 thorpej * kcore information for the sun3x; Motorola MMU, but a very
105 1.2 thorpej * different pmap.
106 1.2 thorpej */
107 1.2 thorpej #define SUN3X_NPHYS_RAM_SEGS 4
108 1.2 thorpej struct sun3x_kcore_hdr {
109 1.6 tsutsui uint32_t pg_frame; /* PTE bits */
110 1.6 tsutsui uint32_t pg_valid;
111 1.6 tsutsui uint32_t contig_end;
112 1.6 tsutsui uint32_t kernCbase; /* VA of kernel level C page table */
113 1.6 tsutsui pys_ram_seg_t ram_segs[SUN3X_NPHYS_RAM_SEGS];
114 1.2 thorpej };
115 1.2 thorpej
116 1.2 thorpej /*
117 1.2 thorpej * Catch-all header. "un" is interpreted based on the contents of "name".
118 1.2 thorpej */
119 1.2 thorpej struct cpu_kcore_hdr {
120 1.2 thorpej char name[16]; /* machine name */
121 1.6 tsutsui uint32_t page_size; /* hardware page size */
122 1.6 tsutsui uint32_t kernbase; /* start of KVA space */
123 1.2 thorpej union {
124 1.2 thorpej struct m68k_kcore_hdr _m68k;
125 1.4 fredette struct sun2_kcore_hdr _sun2;
126 1.2 thorpej struct sun3_kcore_hdr _sun3;
127 1.2 thorpej struct sun3x_kcore_hdr _sun3x;
128 1.2 thorpej } un;
129 1.2 thorpej };
130 1.1 leo
131 1.2 thorpej typedef struct cpu_kcore_hdr cpu_kcore_hdr_t;
132 1.1 leo
133 1.1 leo #endif /* _M68K_KCORE_H_ */
134