PERFORCE change 79020 for review
Paul Saab
ps at FreeBSD.org
Sun Jun 26 22:31:52 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=79020
Change 79020 by ps at butter.corp on 2005/06/26 22:31:11
Duplicate changes for populating dump_avail inline with
phys_avail from i386.
Affected files ...
.. //depot/projects/hammer/sys/amd64/amd64/dump_machdep.c#18 edit
.. //depot/projects/hammer/sys/amd64/amd64/machdep.c#130 edit
.. //depot/projects/hammer/sys/amd64/include/pmap.h#54 edit
Differences ...
==== //depot/projects/hammer/sys/amd64/amd64/dump_machdep.c#18 (text+ko) ====
@@ -64,37 +64,24 @@
static size_t fragsz;
/* 20 phys_avail entry pairs correspond to 10 md_pa's */
-static struct md_pa dump_avail[10];
+static struct md_pa dump_map[10];
static void
md_pa_init(void)
{
int n, idx;
- bzero(&dump_avail, sizeof(dump_avail));
- for (n = 0; n < sizeof(dump_avail) / sizeof(dump_avail[0]); n++) {
+ bzero(dump_map, sizeof(dump_map));
+ for (n = 0; n < sizeof(dump_map) / sizeof(dump_map[0]); n++) {
idx = n * 2;
- if (phys_avail[idx] == 0 && phys_avail[idx + 1] == 0)
+ if (dump_avail[idx] == 0 && dump_avail[idx + 1] == 0)
break;
- dump_avail[n].md_start = phys_avail[idx];
- dump_avail[n].md_size = phys_avail[idx + 1] - phys_avail[idx];
- if (dump_avail[n].md_start == kernphys[1]) {
- /* Include the kernel, that would be helpful! */
- dump_avail[n].md_start = kernphys[0];
- dump_avail[n].md_size += kernphys[1] - kernphys[0];
- }
- if (dump_avail[n].md_start == PAGE_SIZE) {
+ dump_map[n].md_start = dump_map[idx];
+ dump_map[n].md_size = dump_avail[idx + 1] - dump_avail[idx];
+ if (dump_map[n].md_start == PAGE_SIZE) {
/* Include page zero */
- dump_avail[n].md_start = 0;
- dump_avail[n].md_size += PAGE_SIZE;
- }
- if (dump_avail[n].md_start == 0 && dump_avail[n].md_size >= 0x98000) {
- /* Include mpboot code and/or bios EBDA */
- dump_avail[n].md_size = 0xA0000;
- }
- if (phys_avail[idx + 1] == avail_end) {
- /* Include msgbuf, that would be helpful! */
- dump_avail[n].md_size += (Maxmem << PAGE_SHIFT) - avail_end;
+ dump_map[n].md_start = 0;
+ dump_map[n].md_size += PAGE_SIZE;
}
}
}
@@ -103,7 +90,7 @@
md_pa_first(void)
{
- return (&dump_avail[0]);
+ return (&dump_map[0]);
}
static struct md_pa *
==== //depot/projects/hammer/sys/amd64/amd64/machdep.c#130 (text+ko) ====
@@ -159,9 +159,11 @@
long realmem = 0;
vm_paddr_t phys_avail[20];
+vm_paddr_t dump_avail[20];
/* 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)
+#define PHYS_AVAIL_ARRAY_END ((sizeof(phys_avail) / sizeof(phys_avail[0])) - 2)
+#define DUMP_AVAIL_ARRAY_END ((sizeof(dump_avail) / sizeof(dump_avail[0])) - 2)
struct kva_md_info kmi;
@@ -848,7 +850,7 @@
u_int basemem;
-vm_paddr_t kernphys[2];
+static vm_paddr_t kernphys[2];
/*
* Populate the (physmap) array with base/bound pairs describing the
@@ -866,7 +868,7 @@
static void
getmemsize(caddr_t kmdp, u_int64_t first)
{
- int i, physmap_idx, pa_indx;
+ int i, physmap_idx, pa_indx, da_indx;
vm_paddr_t pa, physmap[PHYSMAP_SIZE];
u_long physmem_tunable;
pt_entry_t *pte;
@@ -982,6 +984,8 @@
pa_indx = 0;
phys_avail[pa_indx++] = physmap[0];
phys_avail[pa_indx] = physmap[0];
+ dump_avail[da_indx++] = physmap[0];
+ dump_avail[da_indx] = physmap[0];
pte = CMAP1;
/*
@@ -1008,14 +1012,15 @@
if (physmap[i + 1] < end)
end = trunc_page(physmap[i + 1]);
for (pa = round_page(physmap[i]); pa < end; pa += PAGE_SIZE) {
- int tmp, page_bad;
+ int tmp, page_bad, full;
int *ptr = (int *)CADDR1;
+ full = FALSE
/*
* block out kernel memory as not available.
*/
if (pa >= kernphys[0] && pa < kernphys[1])
- continue;
+ goto do_dump_avail;
/*
* block out dcons buffer
@@ -1023,7 +1028,7 @@
if (dcons_addr > 0
&& pa >= trunc_page(dcons_addr)
&& pa < dcons_addr + dcons_size)
- continue;
+ goto do_dump_avail;
page_bad = FALSE;
@@ -1087,12 +1092,28 @@
printf(
"Too many holes in the physical address space, giving up\n");
pa_indx--;
- break;
+ full = TRUE;
+ goto do_dump_avail;
}
phys_avail[pa_indx++] = pa; /* start */
phys_avail[pa_indx] = pa + PAGE_SIZE; /* end */
}
physmem++;
+do_dump_avail:
+ if (dump_avail[da_indx] == pa) {
+ dump_avail[da_indx] += PAGE_SIZE;
+ } else {
+ da_indx++;
+ if (da_indx == DUMP_AVAIL_ARRAY_END) {
+ da_indx--;
+ goto do_next;
+ }
+ dump_avail[da_indx++] = pa; /* start */
+ dump_avail[da_indx] = pa + PAGE_SIZE; /* end */
+ }
+do_next:
+ if (full)
+ break;
}
}
*pte = 0;
==== //depot/projects/hammer/sys/amd64/include/pmap.h#54 (text+ko) ====
@@ -282,7 +282,7 @@
extern pt_entry_t *CMAP1;
extern vm_paddr_t avail_end;
extern vm_paddr_t phys_avail[];
-extern vm_paddr_t kernphys[];
+extern vm_paddr_t dump_avail[];
extern vm_offset_t virtual_avail;
extern vm_offset_t virtual_end;
More information about the p4-projects
mailing list