Account for the fact that contigmalloc(9) can return a NULL pointer.

Fix the flags argument: M_WAITOK is not a valid flag. Its presence
leaves the indication that contigmalloc(9) will not return a NULL
pointer.

The use of contigmalloc(9) in this place is probably not a good idea
given the constraints. It's probably better to lift the constraints
and instead add a permanent mapping to the ITR. It's possible that
the first 256MB of memory is exhausted when we get here.

This fixes a kernel panic on a 16GB rx3600.
This commit is contained in:
Marcel Moolenaar 2007-05-19 12:50:12 +00:00
parent fe85f6cee8
commit 47538c21e5

View File

@ -92,6 +92,9 @@ ia64_mca_save_state(int type)
if (mca_info_size[type] == -1)
return;
if (mca_info_block == 0)
return;
while (1) {
mtx_lock_spin(&mca_info_block_lock);
@ -198,9 +201,9 @@ ia64_mca_init(void)
}
max_size = round_page(max_size);
if (max_size) {
p = contigmalloc(max_size, M_TEMP, M_WAITOK, 0ul,
256*1024*1024 - 1, PAGE_SIZE, 256*1024*1024);
p = (max_size) ? contigmalloc(max_size, M_TEMP, 0, 0ul,
256*1024*1024 - 1, PAGE_SIZE, 256*1024*1024) : NULL;
if (p != NULL) {
mca_info_block = IA64_PHYS_TO_RR7(ia64_tpa((u_int64_t)p));
if (bootverbose)