From owner-cvs-all Tue Mar 12 10:10:39 2002 Delivered-To: cvs-all@freebsd.org Received: from k6.locore.ca (k6.locore.ca [198.96.117.170]) by hub.freebsd.org (Postfix) with ESMTP id 787AB37B402; Tue, 12 Mar 2002 10:10:29 -0800 (PST) Received: (from jake@localhost) by k6.locore.ca (8.11.6/8.11.6) id g2CIGHn43762; Tue, 12 Mar 2002 13:16:17 -0500 (EST) (envelope-from jake) Date: Tue, 12 Mar 2002 13:16:17 -0500 From: Jake Burkholder To: Dag-Erling Smorgrav Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sbin/savecore savecore.c Message-ID: <20020312131617.Q20687@locore.ca> References: <200203111123.g2BBNo651853@freefall.freebsd.org> <20020311175817.I20687@locore.ca> <20020312120759.O20687@locore.ca> <20020312121957.P20687@locore.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from des@ofug.org on Tue, Mar 12, 2002 at 06:44:21PM +0100 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Apparently, On Tue, Mar 12, 2002 at 06:44:21PM +0100, Dag-Erling Smorgrav said words to the effect of; > Jake Burkholder writes: > > > > Yes, but why. It assumes that subtracting kernbase from a virtual > > > > address will give on offset into the core dump, ie a phsyical address. > > > > This doesn't work on sparc64. > > > I was told that it did work, but I'll take your word that it doesn't. > > > The question is, what *does* work? > > I don't know yet and its going to be hard. This is why I just left > > savecore for now. > > But - waitasec. Subtracting kernbase from a virtual address doesn't > give you a physical address on i386 either - it gives you an offset > into the KVA, regardless how it's mapped onto physical memory. Are > you saying that kernel memory on the i386 starts at physical address 0 > and is mapped linearly upward from there? Yes, that's exactly the problem. The kernel is loaded at physical adress 0x100000 and linked for virtual address 0xc0100000. Once you know the offset of the page table directory in the core dump, which is found in the data segment which is at a well known physical address, you can find the phsyical address, and thus offsets in the core dump, of dynamic kernel memory which may be anywhere (physically). > > Looking at the equivalent code for Alpha, it would seem that on Alpha > the kernel is also mapped linearly, starting at 0x300000 - is that > correct? Alpha uses a large direct mapped segment and the kernel runs from there. I don't know much about the details. > > And how, in brief terms, is kernel memory mapped on Sparc64? We allocate phsyical memory from the prom and load the kernel binary there. It must be physically contiguous, but may start at any reasonable physical address. To make matters worse, the physical addresses that are available change based on what banks your memory is in, and may have large holes if a bank is empty. The prom provides an array of (start, size) pairs which describe what physical memory is available. Once the kernel image is loaded an executing, dynamic kernel memory is allocated from all over the place (physically), just like everyone else. Once we can find the address of the kernel page table structure, we can find the rest of the kernel relatively easily. But finding that in the first place may take some doing. Jake To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message