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