Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Mar 2002 13:16:17 -0500
From:      Jake Burkholder <jake@locore.ca>
To:        Dag-Erling Smorgrav <des@ofug.org>
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sbin/savecore savecore.c
Message-ID:  <20020312131617.Q20687@locore.ca>
In-Reply-To: <xzpadtdy93e.fsf@flood.ping.uio.no>; from des@ofug.org on Tue, Mar 12, 2002 at 06:44:21PM %2B0100
References:  <200203111123.g2BBNo651853@freefall.freebsd.org> <20020311175817.I20687@locore.ca> <xzpn0xeuhix.fsf@flood.ping.uio.no> <20020312120759.O20687@locore.ca> <xzpr8mpyauy.fsf@flood.ping.uio.no> <20020312121957.P20687@locore.ca> <xzpadtdy93e.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
Apparently, On Tue, Mar 12, 2002 at 06:44:21PM +0100,
	Dag-Erling Smorgrav said words to the effect of;

> Jake Burkholder <jake@locore.ca> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020312131617.Q20687>