| @@ -1,96 +1,96 @@ | | | @@ -1,96 +1,96 @@ |
1 | /* $NetBSD: vmparam.h,v 1.23 2020/06/27 02:51:23 rin Exp $ */ | | 1 | /* $NetBSD: vmparam.h,v 1.24 2020/07/06 08:26:10 rin Exp $ */ |
2 | | | 2 | |
3 | #ifndef _POWERPC_VMPARAM_H_ | | 3 | #ifndef _POWERPC_VMPARAM_H_ |
4 | #define _POWERPC_VMPARAM_H_ | | 4 | #define _POWERPC_VMPARAM_H_ |
5 | | | 5 | |
6 | #ifdef _KERNEL_OPT | | 6 | #ifdef _KERNEL_OPT |
7 | #include "opt_modular.h" | | 7 | #include "opt_modular.h" |
8 | #include "opt_ppcarch.h" | | 8 | #include "opt_ppcarch.h" |
9 | #include "opt_uvm.h" | | 9 | #include "opt_uvm.h" |
10 | #endif | | 10 | #endif |
11 | | | 11 | |
12 | /* | | 12 | /* |
13 | * These are common for BOOKE, IBM4XX, and OEA | | 13 | * These are common for BOOKE, IBM4XX, and OEA |
14 | */ | | 14 | */ |
15 | #define VM_FREELIST_DEFAULT 0 | | 15 | #define VM_FREELIST_DEFAULT 0 |
16 | #define VM_FREELIST_FIRST256 1 | | 16 | #define VM_FREELIST_FIRST256 1 |
17 | #define VM_FREELIST_FIRST16 2 | | 17 | #define VM_FREELIST_FIRST16 2 |
18 | #define VM_NFREELIST 3 | | 18 | #define VM_NFREELIST 3 |
19 | | | 19 | |
20 | #define VM_PHYSSEG_MAX 16 | | 20 | #define VM_PHYSSEG_MAX 16 |
21 | | | 21 | |
22 | /* | | 22 | /* |
23 | * The address to which unspecified mapping requests default | | 23 | * The address to which unspecified mapping requests default |
24 | * Put the stack in its own segment and start mmaping at the | | 24 | * Put the stack in its own segment and start mmaping at the |
25 | * top of the next lower segment. | | 25 | * top of the next lower segment. |
26 | */ | | 26 | */ |
27 | #define __USE_TOPDOWN_VM | | 27 | #define __USE_TOPDOWN_VM |
28 | #define VM_DEFAULT_ADDRESS_BOTTOMUP(da, sz) \ | | 28 | #define VM_DEFAULT_ADDRESS_BOTTOMUP(da, sz) \ |
29 | round_page((vaddr_t)(da) + (vsize_t)maxdmap) | | 29 | round_page((vaddr_t)(da) + (vsize_t)maxdmap) |
30 | | | 30 | |
31 | #if defined(MODULAR) || defined(_MODULE) || !defined(_KERNEL) | | 31 | #if defined(MODULAR) || defined(_MODULE) || !defined(_KERNEL) |
32 | /* | | 32 | /* |
33 | * If we are a module or a modular kernel, then we need to defined the range | | 33 | * If we are a module or a modular kernel, then we need to defined the range |
34 | * of our varible page sizes since BOOKE and OEA use 4KB pages while IBM4XX | | 34 | * of our varible page sizes since BOOKE and OEA use 4KB pages while IBM4XX |
35 | * use 16KB pages. | | 35 | * use 16KB pages. |
36 | * This is also required for userland by jemalloc. | | 36 | * This is also required for userland by jemalloc. |
37 | */ | | 37 | */ |
38 | #define MIN_PAGE_SHIFT 12 /* BOOKE/OEA */ | | 38 | #define MIN_PAGE_SHIFT 12 /* BOOKE/OEA */ |
39 | #define MAX_PAGE_SHIFT 14 /* IBM4XX */ | | 39 | #define MAX_PAGE_SHIFT 14 /* IBM4XX */ |
40 | #define MIN_PAGE_SIZE (1 << MIN_PAGE_SHIFT) | | 40 | #define MIN_PAGE_SIZE (1 << MIN_PAGE_SHIFT) |
41 | #define MAX_PAGE_SIZE (1 << MAX_PAGE_SHIFT) | | 41 | #define MAX_PAGE_SIZE (1 << MAX_PAGE_SHIFT) |
42 | #endif /* MODULAR || _MODULE || !_KERNEL */ | | 42 | #endif /* MODULAR || _MODULE || !_KERNEL */ |
43 | | | 43 | |
44 | #if defined(_MODULE) | | 44 | #if defined(_MODULE) |
45 | #if defined(_RUMPKERNEL) | | 45 | #if defined(_RUMPKERNEL) |
46 | /* | | 46 | /* |
47 | * Safe definitions for RUMP kernels | | 47 | * Safe definitions for RUMP kernels |
48 | */ | | 48 | */ |
49 | #define VM_MAXUSER_ADDRESS 0x7fff8000 | | 49 | #define VM_MAXUSER_ADDRESS 0x7fff8000 |
50 | #define VM_MIN_ADDRESS 0x00000000 | | 50 | #define VM_MIN_ADDRESS 0x00000000 |
51 | #define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS | | 51 | #define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS |
52 | #define MAXDSIZ (1024*1024*1024) | | 52 | #define MAXDSIZ (1024*1024*1024) |
53 | #define MAXSSIZ (32*1024*1024) | | 53 | #define MAXSSIZ (32*1024*1024) |
54 | #define MAXTSIZ (256*1024*1024) | | 54 | #define MAXTSIZ (256*1024*1024) |
55 | #else /* !_RUMPKERNEL */ | | 55 | #else /* !_RUMPKERNEL */ |
56 | /* | | 56 | /* |
57 | * Some modules need some of the constants but those vary between the variants | | 57 | * Some modules need some of the constants but those vary between the variants |
58 | * so those constants are exported as linker symbols so they don't take up any | | 58 | * so those constants are exported as linker symbols so they don't take up any |
59 | * space but also avoid an extra load to put into a register. | | 59 | * space but also avoid an extra load to put into a register. |
60 | */ | | 60 | */ |
61 | extern const char __USRSTACK; /* let the linker resolve it */ | | 61 | extern const char __USRSTACK; /* let the linker resolve it */ |
62 | | | 62 | |
63 | #define USRSTACK ((vaddr_t)(uintptr_t)&__USRSTACK) | | 63 | #define USRSTACK ((vaddr_t)(uintptr_t)&__USRSTACK) |
64 | #endif /* !_RUMPKERNEL */ | | 64 | #endif /* !_RUMPKERNEL */ |
65 | | | 65 | |
66 | #else /* !_MODULE */ | | 66 | #else /* !_MODULE */ |
67 | | | 67 | |
68 | #if defined(PPC_BOOKE) | | 68 | #if defined(PPC_BOOKE) |
69 | #include <powerpc/booke/vmparam.h> | | 69 | #include <powerpc/booke/vmparam.h> |
70 | #elif defined(PPC_IBM4XX) | | 70 | #elif defined(PPC_IBM4XX) |
71 | #include <powerpc/ibm4xx/vmparam.h> | | 71 | #include <powerpc/ibm4xx/vmparam.h> |
72 | #elif defined(PPC_OEA) || defined (PPC_OEA64) || defined (PPC_OEA64_BRIDGE) | | 72 | #elif defined(PPC_OEA) || defined (PPC_OEA64) || defined (PPC_OEA64_BRIDGE) |
73 | #include <powerpc/oea/vmparam.h> | | 73 | #include <powerpc/oea/vmparam.h> |
74 | #elif defined(_KERNEL) | | 74 | #elif defined(_KERNEL) |
75 | #error unknown PPC variant | | 75 | #error unknown PPC variant |
76 | #endif | | 76 | #endif |
77 | | | 77 | |
78 | #endif /* !_MODULE */ | | 78 | #endif /* !_MODULE */ |
79 | | | 79 | |
80 | #if defined(MODULAR) || defined(_MODULAR) | | 80 | #if defined(MODULAR) || defined(_MODULE) |
81 | /* | | 81 | /* |
82 | * If we are a module or support modules, we need to define a compatible | | 82 | * If we are a module or support modules, we need to define a compatible |
83 | * pmap_physseg since IBM4XX uses one. This will waste a tiny of space | | 83 | * pmap_physseg since IBM4XX uses one. This will waste a tiny of space |
84 | * but is needed for compatibility. | | 84 | * but is needed for compatibility. |
85 | */ | | 85 | */ |
86 | #ifndef __HAVE_PMAP_PHYSSEG | | 86 | #ifndef __HAVE_PMAP_PHYSSEG |
87 | #define __HAVE_PMAP_PHYSSEG | | 87 | #define __HAVE_PMAP_PHYSSEG |
88 | struct pmap_physseg { | | 88 | struct pmap_physseg { |
89 | uintptr_t pmseg_dummy[2]; | | 89 | uintptr_t pmseg_dummy[2]; |
90 | }; | | 90 | }; |
91 | #endif | | 91 | #endif |
92 | | | 92 | |
93 | __CTASSERT(sizeof(struct pmap_physseg) == sizeof(uintptr_t) * 2); | | 93 | __CTASSERT(sizeof(struct pmap_physseg) == sizeof(uintptr_t) * 2); |
94 | #endif /* MODULAR || _MODULE */ | | 94 | #endif /* MODULAR || _MODULE */ |
95 | | | 95 | |
96 | #endif /* !_POWERPC_VMPARAM_H_ */ | | 96 | #endif /* !_POWERPC_VMPARAM_H_ */ |