diff options
author | jake <jake@FreeBSD.org> | 2003-03-25 00:07:06 +0000 |
---|---|---|
committer | jake <jake@FreeBSD.org> | 2003-03-25 00:07:06 +0000 |
commit | 783ae539c3e44d35afb500b405ff986b3033bc4a (patch) | |
tree | 553401a4d58eb98b1e208a82c3ba2c32b848a225 /sys/pc98 | |
parent | 0079e3d786d0b0a2647229d3498a426a039a5016 (diff) | |
download | FreeBSD-src-783ae539c3e44d35afb500b405ff986b3033bc4a.zip FreeBSD-src-783ae539c3e44d35afb500b405ff986b3033bc4a.tar.gz |
- Add vm_paddr_t, a physical address type. This is required for systems
where physical addresses larger than virtual addresses, such as i386s
with PAE.
- Use this to represent physical addresses in the MI vm system and in the
i386 pmap code. This also changes the paddr parameter to d_mmap_t.
- Fix printf formats to handle physical addresses >4G in the i386 memory
detection code, and due to kvtop returning vm_paddr_t instead of u_long.
Note that this is a name change only; vm_paddr_t is still the same as
vm_offset_t on all currently supported platforms.
Sponsored by: DARPA, Network Associates Laboratories
Discussed with: re, phk (cdevsw change)
Diffstat (limited to 'sys/pc98')
-rw-r--r-- | sys/pc98/cbus/gdc.c | 2 | ||||
-rw-r--r-- | sys/pc98/i386/machdep.c | 41 | ||||
-rw-r--r-- | sys/pc98/pc98/machdep.c | 41 | ||||
-rw-r--r-- | sys/pc98/pc98/pc98gdc.c | 2 | ||||
-rw-r--r-- | sys/pc98/pc98/syscons.c | 2 |
5 files changed, 45 insertions, 43 deletions
diff --git a/sys/pc98/cbus/gdc.c b/sys/pc98/cbus/gdc.c index 01a63ad..b6d302f 100644 --- a/sys/pc98/cbus/gdc.c +++ b/sys/pc98/cbus/gdc.c @@ -392,7 +392,7 @@ gdcioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) } static int -gdcmmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int prot) +gdcmmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) { gdc_softc_t *sc; diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index f02c6b9..ea42cdc 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -190,7 +190,7 @@ long Maxmem = 0; int Maxmem_under16M = 0; #endif -vm_offset_t phys_avail[10]; +vm_paddr_t phys_avail[10]; /* must be 2 less so 0 0 can signal end of chunks */ #define PHYS_AVAIL_ARRAY_END ((sizeof(phys_avail) / sizeof(vm_offset_t)) - 2) @@ -217,8 +217,8 @@ cpu_startup(dummy) #ifdef PERFMON perfmon_init(); #endif - printf("real memory = %u (%u MB)\n", ptoa(Maxmem), - ptoa(Maxmem) / 1048576); + printf("real memory = %ju (%ju MB)\n", ptoa((uintmax_t)Maxmem), + ptoa((uintmax_t)Maxmem) / 1048576); /* * Display any holes after the first chunk of extended memory. */ @@ -227,19 +227,22 @@ cpu_startup(dummy) printf("Physical memory chunk(s):\n"); for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) { - unsigned int size1; + vm_paddr_t size; - size1 = phys_avail[indx + 1] - phys_avail[indx]; - printf("0x%08x - 0x%08x, %u bytes (%u pages)\n", - phys_avail[indx], phys_avail[indx + 1] - 1, size1, - size1 / PAGE_SIZE); + size = phys_avail[indx + 1] - phys_avail[indx]; + printf( + "0x%016jx - 0x%016jx, %ju bytes (%ju pages)\n", + (uintmax_t)phys_avail[indx], + (uintmax_t)phys_avail[indx + 1] - 1, + (uintmax_t)size, (uintmax_t)size / PAGE_SIZE); } } vm_ksubmap_init(&kmi); - printf("avail memory = %u (%u MB)\n", ptoa(cnt.v_free_count), - ptoa(cnt.v_free_count) / 1048576); + printf("avail memory = %ju (%ju MB)\n", + ptoa((uintmax_t)cnt.v_free_count), + ptoa((uintmax_t)cnt.v_free_count) / 1048576); /* * Set up buffers, so they can be used to read disk labels. @@ -1483,6 +1486,8 @@ sdtossd(sd, ssd) * * Total memory size may be set by the kernel environment variable * hw.physmem or the compile-time define MAXMEM. + * + * XXX first should be vm_paddr_t. */ static void getmemsize(int first) @@ -1498,7 +1503,7 @@ getmemsize(int first) u_int basemem, extmem; struct vm86frame vmf; struct vm86context vmc; - vm_offset_t pa, physmap[PHYSMAP_SIZE]; + vm_paddr_t pa, physmap[PHYSMAP_SIZE]; pt_entry_t *pte; char *cp; struct bios_smap *smap; @@ -1592,12 +1597,8 @@ getmemsize(int first) if (i || vmf.vmf_eax != SMAP_SIG) break; if (boothowto & RB_VERBOSE) - printf("SMAP type=%02x base=%08x %08x len=%08x %08x\n", - smap->type, - *(u_int32_t *)((char *)&smap->base + 4), - (u_int32_t)smap->base, - *(u_int32_t *)((char *)&smap->length + 4), - (u_int32_t)smap->length); + printf("SMAP type=%02x base=%016llx len=%016llx\n", + smap->type, smap->base, smap->length); if (smap->type != 0x01) goto next_run; @@ -1810,7 +1811,7 @@ physmap_done: * extend the last memory segment to the new limit. */ if (atop(physmap[physmap_idx + 1]) < Maxmem) - physmap[physmap_idx + 1] = ptoa(Maxmem); + physmap[physmap_idx + 1] = ptoa((vm_paddr_t)Maxmem); /* call pmap initialization to make new kernel address space */ pmap_bootstrap(first, 0); @@ -1829,9 +1830,9 @@ physmap_done: * round up the start address and round down the end address. */ for (i = 0; i <= physmap_idx; i += 2) { - vm_offset_t end; + vm_paddr_t end; - end = ptoa(Maxmem); + end = ptoa((vm_paddr_t)Maxmem); if (physmap[i + 1] < end) end = trunc_page(physmap[i + 1]); for (pa = round_page(physmap[i]); pa < end; pa += PAGE_SIZE) { diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index f02c6b9..ea42cdc 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -190,7 +190,7 @@ long Maxmem = 0; int Maxmem_under16M = 0; #endif -vm_offset_t phys_avail[10]; +vm_paddr_t phys_avail[10]; /* must be 2 less so 0 0 can signal end of chunks */ #define PHYS_AVAIL_ARRAY_END ((sizeof(phys_avail) / sizeof(vm_offset_t)) - 2) @@ -217,8 +217,8 @@ cpu_startup(dummy) #ifdef PERFMON perfmon_init(); #endif - printf("real memory = %u (%u MB)\n", ptoa(Maxmem), - ptoa(Maxmem) / 1048576); + printf("real memory = %ju (%ju MB)\n", ptoa((uintmax_t)Maxmem), + ptoa((uintmax_t)Maxmem) / 1048576); /* * Display any holes after the first chunk of extended memory. */ @@ -227,19 +227,22 @@ cpu_startup(dummy) printf("Physical memory chunk(s):\n"); for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) { - unsigned int size1; + vm_paddr_t size; - size1 = phys_avail[indx + 1] - phys_avail[indx]; - printf("0x%08x - 0x%08x, %u bytes (%u pages)\n", - phys_avail[indx], phys_avail[indx + 1] - 1, size1, - size1 / PAGE_SIZE); + size = phys_avail[indx + 1] - phys_avail[indx]; + printf( + "0x%016jx - 0x%016jx, %ju bytes (%ju pages)\n", + (uintmax_t)phys_avail[indx], + (uintmax_t)phys_avail[indx + 1] - 1, + (uintmax_t)size, (uintmax_t)size / PAGE_SIZE); } } vm_ksubmap_init(&kmi); - printf("avail memory = %u (%u MB)\n", ptoa(cnt.v_free_count), - ptoa(cnt.v_free_count) / 1048576); + printf("avail memory = %ju (%ju MB)\n", + ptoa((uintmax_t)cnt.v_free_count), + ptoa((uintmax_t)cnt.v_free_count) / 1048576); /* * Set up buffers, so they can be used to read disk labels. @@ -1483,6 +1486,8 @@ sdtossd(sd, ssd) * * Total memory size may be set by the kernel environment variable * hw.physmem or the compile-time define MAXMEM. + * + * XXX first should be vm_paddr_t. */ static void getmemsize(int first) @@ -1498,7 +1503,7 @@ getmemsize(int first) u_int basemem, extmem; struct vm86frame vmf; struct vm86context vmc; - vm_offset_t pa, physmap[PHYSMAP_SIZE]; + vm_paddr_t pa, physmap[PHYSMAP_SIZE]; pt_entry_t *pte; char *cp; struct bios_smap *smap; @@ -1592,12 +1597,8 @@ getmemsize(int first) if (i || vmf.vmf_eax != SMAP_SIG) break; if (boothowto & RB_VERBOSE) - printf("SMAP type=%02x base=%08x %08x len=%08x %08x\n", - smap->type, - *(u_int32_t *)((char *)&smap->base + 4), - (u_int32_t)smap->base, - *(u_int32_t *)((char *)&smap->length + 4), - (u_int32_t)smap->length); + printf("SMAP type=%02x base=%016llx len=%016llx\n", + smap->type, smap->base, smap->length); if (smap->type != 0x01) goto next_run; @@ -1810,7 +1811,7 @@ physmap_done: * extend the last memory segment to the new limit. */ if (atop(physmap[physmap_idx + 1]) < Maxmem) - physmap[physmap_idx + 1] = ptoa(Maxmem); + physmap[physmap_idx + 1] = ptoa((vm_paddr_t)Maxmem); /* call pmap initialization to make new kernel address space */ pmap_bootstrap(first, 0); @@ -1829,9 +1830,9 @@ physmap_done: * round up the start address and round down the end address. */ for (i = 0; i <= physmap_idx; i += 2) { - vm_offset_t end; + vm_paddr_t end; - end = ptoa(Maxmem); + end = ptoa((vm_paddr_t)Maxmem); if (physmap[i + 1] < end) end = trunc_page(physmap[i + 1]); for (pa = round_page(physmap[i]); pa < end; pa += PAGE_SIZE) { diff --git a/sys/pc98/pc98/pc98gdc.c b/sys/pc98/pc98/pc98gdc.c index 01a63ad..b6d302f 100644 --- a/sys/pc98/pc98/pc98gdc.c +++ b/sys/pc98/pc98/pc98gdc.c @@ -392,7 +392,7 @@ gdcioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) } static int -gdcmmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int prot) +gdcmmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) { gdc_softc_t *sc; diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c index f2ad080..ff1d69d 100644 --- a/sys/pc98/pc98/syscons.c +++ b/sys/pc98/pc98/syscons.c @@ -3384,7 +3384,7 @@ next_code: } static int -scmmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nprot) +scmmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) { scr_stat *scp; |