summaryrefslogtreecommitdiff
path: root/sys/arch/m68k/include/kcore.h
blob: 489ecf34f0f6e86309ca1ab62e7bb054a30107b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*	$NetBSD: kcore.h,v 1.7 2023/01/29 09:24:33 mlelstv Exp $	*/

/*-
 * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Gordon W. Ross, Jason R. Thorpe, and Leo Weppelman.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef _M68K_KCORE_H_
#define	_M68K_KCORE_H_

/*
 * Unified m68k kcore header descriptions.
 *
 * NOTE: We must have all possible m68k kcore types defined in this
 * file.  Otherwise, we require kernel sources for all m68k platforms
 * to build userland.
 *
 * We must provide STE/PTE bits in the kcore header for a couple
 * of reasons:
 *
 *	- different platforms may have the MMUs configured for different
 *	  page sizes
 *	- we may not have a specific platform's pte.h available to us
 *
 * These are on-disk structures; use fixed-sized types!
 *
 * The total size of the cpu_kcore_hdr should be <= DEV_BSIZE!
 */

/*
 * kcore information for Utah-derived pmaps
 */
#define	M68K_NPHYS_RAM_SEGS	8	/* XXX */
struct m68k_kcore_hdr {
	int32_t		mmutype;	/* MMU type */
	uint32_t	sg_v;		/* STE bits */
	uint32_t	sg_frame;
	uint32_t	sg_ishift;
	uint32_t	sg_pmask;
	uint32_t	sg40_shift1;
	uint32_t	sg40_mask2;
	uint32_t	sg40_shift2;
	uint32_t	sg40_mask3;
	uint32_t	sg40_shift3;
	uint32_t	sg40_addr1;
	uint32_t	sg40_addr2;
	uint32_t	pg_v;		/* PTE bits */
	uint32_t	pg_frame;
	uint32_t	sysseg_pa;	/* PA of Sysseg[] */
	uint32_t	reloc;		/* value added to relocate a symbol
					   before address translation is
					   enabled */
	uint32_t	relocend;	/* if kernbase < va < relocend, we
					   can do simple relocation to get
					   the physical address */
	phys_ram_seg_t	ram_segs[M68K_NPHYS_RAM_SEGS];
};

/*
 * kcore information for the sun2
 */
struct sun2_kcore_hdr {
	uint32_t	segshift;
	uint32_t	pg_frame;	/* PTE bits */
	uint32_t	pg_valid;
	uint8_t		ksegmap[512];	/* kernel segment map */
};

/*
 * kcore information for the sun3
 */
struct sun3_kcore_hdr {
	uint32_t	segshift;
	uint32_t	pg_frame;	/* PTE bits */
	uint32_t	pg_valid;
	uint8_t		ksegmap[256];	/* kernel segment map */
};

/*
 * kcore information for the sun3x; Motorola MMU, but a very
 * different pmap.
 */
#define	SUN3X_NPHYS_RAM_SEGS	4
struct sun3x_kcore_hdr {
	uint32_t	pg_frame;	/* PTE bits */
	uint32_t	pg_valid;
	uint32_t	contig_end;
	uint32_t	kernCbase;	/* VA of kernel level C page table */
	phys_ram_seg_t	ram_segs[SUN3X_NPHYS_RAM_SEGS];
};

/*
 * Catch-all header.  "un" is interpreted based on the contents of "name".
 */
struct cpu_kcore_hdr {
	char		name[16];	/* machine name */
	uint32_t	page_size;	/* hardware page size */
	uint32_t	kernbase;	/* start of KVA space */
	union {
		struct m68k_kcore_hdr _m68k;
		struct sun2_kcore_hdr _sun2;
		struct sun3_kcore_hdr _sun3;
		struct sun3x_kcore_hdr _sun3x;
	} un;
};

typedef struct cpu_kcore_hdr cpu_kcore_hdr_t;

#endif /* _M68K_KCORE_H_ */