From c3b74b57af4898d11b09ce213a1f74ab03bc8adf Mon Sep 17 00:00:00 2001 From: Yoshihiro Takahashi Date: Sun, 6 Mar 2005 12:59:59 +0000 Subject: [PATCH] MFi386: revisions 1.609 and 1.610. --- sys/pc98/i386/machdep.c | 50 ++++++++--------------------------------- sys/pc98/pc98/machdep.c | 50 ++++++++--------------------------------- 2 files changed, 18 insertions(+), 82 deletions(-) diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index 415f8bd2d32a..99ec50437608 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -1586,18 +1586,18 @@ getmemsize(int first) { #ifdef PC98 int i, physmap_idx, pa_indx, pg_n; + u_long physmem_tunable; u_int extmem, under16; vm_offset_t pa, physmap[PHYSMAP_SIZE]; pt_entry_t *pte; - char *cp; #else int i, physmap_idx, pa_indx; + u_long physmem_tunable; u_int extmem; struct vm86frame vmf; struct vm86context vmc; vm_paddr_t pa, physmap[PHYSMAP_SIZE]; pt_entry_t *pte; - char *cp; struct bios_smap *smap; #endif quad_t dcons_addr, dcons_size; @@ -1694,15 +1694,15 @@ getmemsize(int first) smap->type, smap->base, smap->length); if (smap->type != 0x01) - goto next_run; + continue; if (smap->length == 0) - goto next_run; + continue; if (smap->base >= 0xffffffff) { printf("%uK of memory above 4GB ignored\n", (u_int)(smap->length / 1024)); - goto next_run; + continue; } for (i = 0; i <= physmap_idx; i += 2) { @@ -1710,13 +1710,13 @@ getmemsize(int first) if (boothowto & RB_VERBOSE) printf( "Overlapping or non-montonic memory region, ignoring second region\n"); - goto next_run; + continue; } } if (smap->base == physmap[physmap_idx + 1]) { physmap[physmap_idx + 1] += smap->length; - goto next_run; + continue; } physmap_idx += 2; @@ -1727,7 +1727,6 @@ getmemsize(int first) } physmap[physmap_idx] = smap->base; physmap[physmap_idx + 1] = smap->base + smap->length; -next_run: ; } while (vmf.vmf_ebx != 0); /* @@ -1850,39 +1849,8 @@ next_run: ; Maxmem = MAXMEM / 4; #endif - /* - * hw.physmem is a size in bytes; we also allow k, m, and g suffixes - * for the appropriate modifiers. This overrides MAXMEM. - */ - if ((cp = getenv("hw.physmem")) != NULL) { - u_int64_t AllowMem, sanity; - char *ep; - - sanity = AllowMem = strtouq(cp, &ep, 0); - if ((ep != cp) && (*ep != 0)) { - switch(*ep) { - case 'g': - case 'G': - AllowMem <<= 10; - case 'm': - case 'M': - AllowMem <<= 10; - case 'k': - case 'K': - AllowMem <<= 10; - break; - default: - AllowMem = sanity = 0; - } - if (AllowMem < sanity) - AllowMem = 0; - } - if (AllowMem == 0) - printf("Ignoring invalid memory size of '%s'\n", cp); - else - Maxmem = atop(AllowMem); - freeenv(cp); - } + if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable)) + Maxmem = atop(physmem_tunable); if (atop(physmap[physmap_idx + 1]) != Maxmem && (boothowto & RB_VERBOSE)) diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 415f8bd2d32a..99ec50437608 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -1586,18 +1586,18 @@ getmemsize(int first) { #ifdef PC98 int i, physmap_idx, pa_indx, pg_n; + u_long physmem_tunable; u_int extmem, under16; vm_offset_t pa, physmap[PHYSMAP_SIZE]; pt_entry_t *pte; - char *cp; #else int i, physmap_idx, pa_indx; + u_long physmem_tunable; u_int extmem; struct vm86frame vmf; struct vm86context vmc; vm_paddr_t pa, physmap[PHYSMAP_SIZE]; pt_entry_t *pte; - char *cp; struct bios_smap *smap; #endif quad_t dcons_addr, dcons_size; @@ -1694,15 +1694,15 @@ getmemsize(int first) smap->type, smap->base, smap->length); if (smap->type != 0x01) - goto next_run; + continue; if (smap->length == 0) - goto next_run; + continue; if (smap->base >= 0xffffffff) { printf("%uK of memory above 4GB ignored\n", (u_int)(smap->length / 1024)); - goto next_run; + continue; } for (i = 0; i <= physmap_idx; i += 2) { @@ -1710,13 +1710,13 @@ getmemsize(int first) if (boothowto & RB_VERBOSE) printf( "Overlapping or non-montonic memory region, ignoring second region\n"); - goto next_run; + continue; } } if (smap->base == physmap[physmap_idx + 1]) { physmap[physmap_idx + 1] += smap->length; - goto next_run; + continue; } physmap_idx += 2; @@ -1727,7 +1727,6 @@ getmemsize(int first) } physmap[physmap_idx] = smap->base; physmap[physmap_idx + 1] = smap->base + smap->length; -next_run: ; } while (vmf.vmf_ebx != 0); /* @@ -1850,39 +1849,8 @@ next_run: ; Maxmem = MAXMEM / 4; #endif - /* - * hw.physmem is a size in bytes; we also allow k, m, and g suffixes - * for the appropriate modifiers. This overrides MAXMEM. - */ - if ((cp = getenv("hw.physmem")) != NULL) { - u_int64_t AllowMem, sanity; - char *ep; - - sanity = AllowMem = strtouq(cp, &ep, 0); - if ((ep != cp) && (*ep != 0)) { - switch(*ep) { - case 'g': - case 'G': - AllowMem <<= 10; - case 'm': - case 'M': - AllowMem <<= 10; - case 'k': - case 'K': - AllowMem <<= 10; - break; - default: - AllowMem = sanity = 0; - } - if (AllowMem < sanity) - AllowMem = 0; - } - if (AllowMem == 0) - printf("Ignoring invalid memory size of '%s'\n", cp); - else - Maxmem = atop(AllowMem); - freeenv(cp); - } + if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable)) + Maxmem = atop(physmem_tunable); if (atop(physmap[physmap_idx + 1]) != Maxmem && (boothowto & RB_VERBOSE))