MFi386: revisions 1.609 and 1.610.

This commit is contained in:
Yoshihiro Takahashi 2005-03-06 12:59:59 +00:00
parent 8cbe387216
commit c3b74b57af
2 changed files with 18 additions and 82 deletions

View File

@ -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))

View File

@ -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))