From cf7d1453893eb3f035f2ac66dd05eff3f3b426b5 Mon Sep 17 00:00:00 2001 From: David Greenman Date: Wed, 3 Feb 1999 14:10:50 +0000 Subject: [PATCH] Fixed the type of target_page to vm_offset_t (unsigned). This fixes a panic during boot on machines with >=2GB of RAM. Also changed some incorrect printf conversion specifiers from %d to %u (signed to unsigned). This fixes bugs when printing the amount of memory on machines with >=2GB of RAM. --- sys/amd64/amd64/machdep.c | 16 ++++++++-------- sys/i386/i386/machdep.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 6e65e1e1a09e..0a6b14a6b31a 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.322 1999/01/15 17:24:05 msmith Exp $ + * $Id: machdep.c,v 1.323 1999/01/28 11:45:29 newton Exp $ */ #include "apm.h" @@ -291,7 +291,7 @@ cpu_startup(dummy) #ifdef PERFMON perfmon_init(); #endif - printf("real memory = %d (%dK bytes)\n", ptoa(Maxmem), ptoa(Maxmem) / 1024); + printf("real memory = %u (%uK bytes)\n", ptoa(Maxmem), ptoa(Maxmem) / 1024); /* * Display any holes after the first chunk of extended memory. */ @@ -302,7 +302,7 @@ cpu_startup(dummy) for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) { int size1 = phys_avail[indx + 1] - phys_avail[indx]; - printf("0x%08x - 0x%08x, %d bytes (%d pages)\n", + printf("0x%08x - 0x%08x, %u bytes (%u pages)\n", phys_avail[indx], phys_avail[indx + 1] - 1, size1, size1 / PAGE_SIZE); } @@ -443,7 +443,7 @@ again: cninit(); /* the preferred console may have changed */ #endif - printf("avail memory = %d (%dK bytes)\n", ptoa(cnt.v_free_count), + printf("avail memory = %u (%uK bytes)\n", ptoa(cnt.v_free_count), ptoa(cnt.v_free_count) / 1024); /* @@ -1152,8 +1152,8 @@ init386(first) struct region_descriptor r_gdt, r_idt; #endif int pagesinbase, pagesinext; - int target_page, pa_indx; - int off; + vm_offset_t target_page; + int pa_indx, off; int speculative_mprobe; /* @@ -1326,12 +1326,12 @@ init386(first) * don't believe it - set it to 640k. */ if (biosbasemem > 640) { - printf("Preposterous RTC basemem of %dK, truncating to 640K\n", + printf("Preposterous RTC basemem of %uK, truncating to 640K\n", biosbasemem); biosbasemem = 640; } if (bootinfo.bi_memsizes_valid && bootinfo.bi_basemem > 640) { - printf("Preposterous BIOS basemem of %dK, truncating to 640K\n", + printf("Preposterous BIOS basemem of %uK, truncating to 640K\n", bootinfo.bi_basemem); bootinfo.bi_basemem = 640; } diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 6e65e1e1a09e..0a6b14a6b31a 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.322 1999/01/15 17:24:05 msmith Exp $ + * $Id: machdep.c,v 1.323 1999/01/28 11:45:29 newton Exp $ */ #include "apm.h" @@ -291,7 +291,7 @@ cpu_startup(dummy) #ifdef PERFMON perfmon_init(); #endif - printf("real memory = %d (%dK bytes)\n", ptoa(Maxmem), ptoa(Maxmem) / 1024); + printf("real memory = %u (%uK bytes)\n", ptoa(Maxmem), ptoa(Maxmem) / 1024); /* * Display any holes after the first chunk of extended memory. */ @@ -302,7 +302,7 @@ cpu_startup(dummy) for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) { int size1 = phys_avail[indx + 1] - phys_avail[indx]; - printf("0x%08x - 0x%08x, %d bytes (%d pages)\n", + printf("0x%08x - 0x%08x, %u bytes (%u pages)\n", phys_avail[indx], phys_avail[indx + 1] - 1, size1, size1 / PAGE_SIZE); } @@ -443,7 +443,7 @@ again: cninit(); /* the preferred console may have changed */ #endif - printf("avail memory = %d (%dK bytes)\n", ptoa(cnt.v_free_count), + printf("avail memory = %u (%uK bytes)\n", ptoa(cnt.v_free_count), ptoa(cnt.v_free_count) / 1024); /* @@ -1152,8 +1152,8 @@ init386(first) struct region_descriptor r_gdt, r_idt; #endif int pagesinbase, pagesinext; - int target_page, pa_indx; - int off; + vm_offset_t target_page; + int pa_indx, off; int speculative_mprobe; /* @@ -1326,12 +1326,12 @@ init386(first) * don't believe it - set it to 640k. */ if (biosbasemem > 640) { - printf("Preposterous RTC basemem of %dK, truncating to 640K\n", + printf("Preposterous RTC basemem of %uK, truncating to 640K\n", biosbasemem); biosbasemem = 640; } if (bootinfo.bi_memsizes_valid && bootinfo.bi_basemem > 640) { - printf("Preposterous BIOS basemem of %dK, truncating to 640K\n", + printf("Preposterous BIOS basemem of %uK, truncating to 640K\n", bootinfo.bi_basemem); bootinfo.bi_basemem = 640; }