vm: change NO_MEM to a more impossible value
fixes an assert() firing when starting X. thanks to the report by pikpik. . NO_MEM was 0, which is actually an existing piece of physical memory. it can't be allocated because it's reserved for bios data (by the kernel), but it can be mapped in (e.g. by X), causing sanity check disaster. . NONCONTIGUOUS is also obsolete as all allocations are single-page now, i.e. NONCONTIGUOUS is really the default and only mode.
This commit is contained in:
parent
24776434f5
commit
25817b0854
2 changed files with 8 additions and 17 deletions
|
@ -376,8 +376,14 @@ struct memlist *alloc_mem_in_list(phys_bytes bytes, u32_t flags, phys_bytes know
|
|||
|
||||
assert(!(flags & PAF_CONTIG));
|
||||
|
||||
if(known != MAP_NONE)
|
||||
if(known != MAP_NONE) {
|
||||
if(known == NO_MEM) {
|
||||
printf("VM: odd mem for alloc_mem_in_list: 0x%lx\n",
|
||||
known);
|
||||
return NULL;
|
||||
}
|
||||
phys_count = known;
|
||||
}
|
||||
|
||||
do {
|
||||
struct memlist *ml;
|
||||
|
@ -426,19 +432,6 @@ struct memlist *alloc_mem_in_list(phys_bytes bytes, u32_t flags, phys_bytes know
|
|||
rempages--;
|
||||
} while(rempages > 0);
|
||||
|
||||
{
|
||||
struct memlist *ml;
|
||||
for(ml = head; ml; ml = ml->next) {
|
||||
assert(ml->phys);
|
||||
#if NONCONTIGUOUS
|
||||
if(!(flags & PAF_CONTIG)) {
|
||||
if(ml->next)
|
||||
assert(ml->phys + ml->length != ml->next->phys);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return head;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
#define NO_MEM ((phys_clicks) 0) /* returned by alloc_mem() with mem is up */
|
||||
|
||||
/* Memory flags to pt_allocmap() and alloc_mem(). */
|
||||
#define PAF_CLEAR 0x01 /* Clear physical memory. */
|
||||
#define PAF_CONTIG 0x02 /* Physically contiguous. */
|
||||
|
@ -21,7 +19,6 @@
|
|||
/* VM behaviour */
|
||||
#define MEMPROTECT 0 /* Slab objects not mapped. Access with USE() */
|
||||
#define JUNKFREE 0 /* Fill freed pages with junk */
|
||||
#define NONCONTIGUOUS 0 /* Make phys pages max. noncontiguous */
|
||||
|
||||
/* How noisy are we supposed to be? */
|
||||
#define VERBOSE 0
|
||||
|
@ -51,4 +48,5 @@
|
|||
#define WMF_VERIFY 0x08 /* Check pagetable contents. */
|
||||
|
||||
#define MAP_NONE 0xFFFFFFFE
|
||||
#define NO_MEM ((phys_clicks) MAP_NONE) /* returned by alloc_mem() with mem is up */
|
||||
|
||||
|
|
Loading…
Reference in a new issue