xref: /netbsd/sys/arch/x86/include/bootspace.h (revision 3b797d78)
1 /*	$NetBSD: bootspace.h,v 1.1 2022/08/20 23:15:37 riastradh Exp $	*/
2 
3 /*
4  * Copyright (c) 1997 Charles D. Cranor and Washington University.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 /*
29  * Copyright (c) 2001 Wasabi Systems, Inc.
30  * All rights reserved.
31  *
32  * Written by Frank van der Linden for Wasabi Systems, Inc.
33  *
34  * Redistribution and use in source and binary forms, with or without
35  * modification, are permitted provided that the following conditions
36  * are met:
37  * 1. Redistributions of source code must retain the above copyright
38  *    notice, this list of conditions and the following disclaimer.
39  * 2. Redistributions in binary form must reproduce the above copyright
40  *    notice, this list of conditions and the following disclaimer in the
41  *    documentation and/or other materials provided with the distribution.
42  * 3. All advertising materials mentioning features or use of this software
43  *    must display the following acknowledgement:
44  *      This product includes software developed for the NetBSD Project by
45  *      Wasabi Systems, Inc.
46  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
47  *    or promote products derived from this software without specific prior
48  *    written permission.
49  *
50  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
51  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
52  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
53  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
54  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
55  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
56  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
57  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
58  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
59  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
60  * POSSIBILITY OF SUCH DAMAGE.
61  */
62 
63 #ifndef	_X86_BOOTSPACE_H_
64 #define	_X86_BOOTSPACE_H_
65 
66 #include <sys/types.h>
67 
68 #define BTSEG_NONE	0
69 #define BTSEG_TEXT	1
70 #define BTSEG_RODATA	2
71 #define BTSEG_DATA	3
72 #define BTSPACE_NSEGS	64
73 
74 struct bootspace {
75 	struct {
76 		vaddr_t va;
77 		paddr_t pa;
78 		size_t sz;
79 	} head;
80 
81 	/* Kernel segments. */
82 	struct {
83 		int type;
84 		vaddr_t va;
85 		paddr_t pa;
86 		size_t sz;
87 	} segs[BTSPACE_NSEGS];
88 
89 	/*
90 	 * The area used by the early kernel bootstrap. It contains the kernel
91 	 * symbols, the preloaded modules, the bootstrap tables, and the ISA I/O
92 	 * mem.
93 	 */
94 	struct {
95 		vaddr_t va;
96 		paddr_t pa;
97 		size_t sz;
98 	} boot;
99 
100 	/* A magic VA usable by the bootstrap code. */
101 	vaddr_t spareva;
102 
103 	/* Virtual address of the page directory. */
104 	vaddr_t pdir;
105 
106 	/* Area dedicated to kernel modules (amd64 only). */
107 	vaddr_t smodule;
108 	vaddr_t emodule;
109 };
110 
111 #endif	/* _X86_BOOTSPACE_H_ */
112