From b73ef645ae16ea00ca5842556f19326f77bc45e5 Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Sat, 22 Sep 2001 19:50:12 +0000 Subject: [PATCH] * Turn off memory descriptor debugging - its served its purpose. * Don't get confused when memory regions don't lie on page boundaries - remember our page size is typically larger than the firmware's page size. * Add a function ia64_running_in_simulator() which is intended to detect whether the kernel is running in SKI or on real hardware. --- sys/ia64/ia64/machdep.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c index 23fbfcc57336..c0a699aabb2b 100644 --- a/sys/ia64/ia64/machdep.c +++ b/sys/ia64/ia64/machdep.c @@ -392,8 +392,6 @@ identifycpu(void) extern char kernel_text[], _end[]; -#define DEBUG_MD - void ia64_init() { @@ -506,7 +504,6 @@ ia64_init() * the memory descriptors. */ -#define DEBUG_MD #ifdef DEBUG_MD printf("Memory descriptor count: %d\n", mdcount); #endif @@ -514,29 +511,31 @@ ia64_init() phys_avail_cnt = 0; for (i = 0, mdp = md; i < mdcount; i++, mdp = NextMemoryDescriptor(mdp, bootinfo.bi_memdesc_size)) { - size_t size; #ifdef DEBUG_MD printf("MD %d: type %d pa 0x%lx cnt 0x%lx\n", i, mdp->Type, mdp->PhysicalStart, mdp->NumberOfPages); #endif - size = mdp->NumberOfPages * 4096; + pfn0 = ia64_btop(round_page(mdp->PhysicalStart)); + pfn1 = ia64_btop(trunc_page(mdp->PhysicalStart + + mdp->NumberOfPages * 4096)); + if (pfn1 <= pfn0) + continue; + if (mdp->Type != EfiConventionalMemory) { - resvmem += ia64_btop(size); + resvmem += (pfn1 - pfn0); continue; } - totalphysmem += ia64_btop(size); + totalphysmem += (pfn1 - pfn0); /* * We have a memory descriptors available for system * software use. We must determine if this cluster * holds the kernel. */ - physmem += ia64_btop(size); - pfn0 = ia64_btop(mdp->PhysicalStart); - pfn1 = pfn0 + ia64_btop(size); + physmem += (pfn1 - pfn0); if (pfn0 <= kernendpfn && kernstartpfn <= pfn1) { /* * Must compute the location of the kernel @@ -706,6 +705,12 @@ ia64_init() #endif } +int +ia64_running_in_simulator() +{ + return bootinfo.bi_systab == 0; +} + void bzero(void *buf, size_t len) {