diff options
author | Jake Burkholder <jake@FreeBSD.org> | 2001-10-20 16:17:04 +0000 |
---|---|---|
committer | Jake Burkholder <jake@FreeBSD.org> | 2001-10-20 16:17:04 +0000 |
commit | 6ef2d9a02df8e4b33853fa0d326ae28552b2b4e4 (patch) | |
tree | c55dc007e890858684e1c882664952fca43c3ea2 /sys/sparc64/include | |
parent | d37e05e1c47f3a7b8953f139f19ade8941ae9995 (diff) |
Parameterize the size of the kernel virtual address space on KVA_PAGES.
Don't use a hard coded address constant for the virtual address of the
kernel tsb. Allocate kernel virtual address space for the kernel tsb
at runtime.
Remove unused parameter to pmap_bootstrap.
Adapt pmap.c to use KVA_PAGES.
Map the message buffer too.
Add some traces.
Implement pmap_protect.
Notes
Notes:
svn path=/head/; revision=85241
Diffstat (limited to 'sys/sparc64/include')
-rw-r--r-- | sys/sparc64/include/pmap.h | 4 | ||||
-rw-r--r-- | sys/sparc64/include/tsb.h | 18 | ||||
-rw-r--r-- | sys/sparc64/include/vmparam.h | 46 |
3 files changed, 53 insertions, 15 deletions
diff --git a/sys/sparc64/include/pmap.h b/sys/sparc64/include/pmap.h index 90cf94f3dcde..33fa7588992a 100644 --- a/sys/sparc64/include/pmap.h +++ b/sys/sparc64/include/pmap.h @@ -64,7 +64,7 @@ struct pmap { struct pmap_statistics pm_stats; }; -void pmap_bootstrap(vm_offset_t skpa, vm_offset_t ekva); +void pmap_bootstrap(vm_offset_t ekva); vm_offset_t pmap_kextract(vm_offset_t va); void pmap_kenter_flags(vm_offset_t va, vm_offset_t pa, u_long flags); @@ -77,6 +77,8 @@ extern vm_offset_t phys_avail[]; extern vm_offset_t virtual_avail; extern vm_offset_t virtual_end; +extern vm_offset_t msgbuf_phys; + static __inline int pmap_track_modified(vm_offset_t va) { diff --git a/sys/sparc64/include/tsb.h b/sys/sparc64/include/tsb.h index ec1b1d1c202c..32e8a9884870 100644 --- a/sys/sparc64/include/tsb.h +++ b/sys/sparc64/include/tsb.h @@ -32,8 +32,7 @@ #ifndef _MACHINE_TSB_H_ #define _MACHINE_TSB_H_ -#define TSB_KERNEL_MIN_ADDRESS (0xa0000000) -#define TSB_USER_MIN_ADDRESS (0xb0000000) +#define TSB_USER_MIN_ADDRESS (UPT_MIN_ADDRESS) #define TSB_MASK_WIDTH (6) @@ -59,10 +58,11 @@ #define TSB_DEPTH (7) -#define TSB_KERNEL_PAGES (1) -#define TSB_KERNEL_SIZE (TSB_KERNEL_PAGES * PAGE_SIZE_4M) -#define TSB_KERNEL_MASK ((TSB_KERNEL_SIZE >> STTE_SHIFT) - 1) +#define TSB_KERNEL_MASK \ + (((KVA_PAGES * PAGE_SIZE_4M) >> STTE_SHIFT) - 1) +#define TSB_KERNEL_VA_MASK (TSB_KERNEL_MASK << STTE_SHIFT) +extern struct stte *tsb_kernel; extern vm_offset_t tsb_kernel_phys; static __inline struct stte * @@ -128,7 +128,7 @@ tsb_stte_vtophys(pmap_t pm, struct stte *stp) va = (vm_offset_t)stp; if (pm == kernel_pmap) - return (tsb_kernel_phys + (va - TSB_KERNEL_MIN_ADDRESS)); + return (tsb_kernel_phys + (va - (vm_offset_t)tsb_kernel)); if (trunc_page(va) == TSB_USER_MIN_ADDRESS) data = pm->pm_stte.st_tte.tte_data; @@ -154,11 +154,7 @@ tsb_vtobucket(vm_offset_t va, u_int level) static __inline struct stte * tsb_kvpntostte(vm_offset_t vpn) { - struct stte *stp; - - stp = (struct stte *)(TSB_KERNEL_MIN_ADDRESS + - ((vpn & TSB_KERNEL_MASK) << STTE_SHIFT)); - return (stp); + return (&tsb_kernel[vpn & TSB_KERNEL_MASK]); } static __inline struct stte * diff --git a/sys/sparc64/include/vmparam.h b/sys/sparc64/include/vmparam.h index 2b3c2449e732..fd2bae466a7d 100644 --- a/sys/sparc64/include/vmparam.h +++ b/sys/sparc64/include/vmparam.h @@ -90,10 +90,50 @@ #define VM_KMEM_SIZE (12*1024*1024) #endif -#define VM_MIN_KERNEL_ADDRESS (0xc0000000) -#define VM_MAX_KERNEL_ADDRESS (0xffffe000) +/* + * Number of 4 meg pages to use for the kernel tsb. + */ +#ifndef KVA_PAGES +#define KVA_PAGES (1) +#endif + +/* + * Range of kernel virtual addresses. max = min + range. + */ +#define KVA_RANGE \ + ((KVA_PAGES * PAGE_SIZE_4M) << (PAGE_SHIFT - STTE_SHIFT)) + +/* + * Lowest kernel virtual address, where the kernel is loaded. + * + * If we are using less than 4 super pages for the kernel tsb, the address + * space is less than 4 gigabytes, so put it at the end of the first 4 + * gigbytes. This allows the kernel and the firmware mappings to be mapped + * with a single contiguous tsb. Otherwise start at 0, we'll cover them + * anyway. + * + * ie: + * kva_pages = 1 + * vm_max_kernel_address 0xffffe000 + * openfirmware 0xf0000000 + * kernbase 0xc0000000 + * kva_pages = 8 + * vm_max_kernel_address 0x1ffffe000 + * openfirmware 0xf0000000 + * kernbase 0x0 + * + * There are at least 4 pages of dynamic linker junk before kernel text begins, + * so starting at zero is fairly safe. + */ +#if KVA_PAGES < 4 +#define VM_MIN_KERNEL_ADDRESS ((1UL << 32) - KVA_RANGE) +#else +#define VM_MIN_KERNEL_ADDRESS (0) +#endif -#define KERNBASE (0xc0000000) +#define VM_MAX_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + KVA_RANGE - PAGE_SIZE) +#define UPT_MIN_ADDRESS (VM_MIN_KERNEL_ADDRESS + KVA_RANGE) +#define KERNBASE (VM_MIN_KERNEL_ADDRESS) /* * Initial pagein size of beginning of executable file. |