Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

linear adr to physical addr

0 views
Skip to first unread message

peter

unread,
Nov 30, 2009, 9:53:29 AM11/30/09
to

hi all
I am adding a feature about convert the physical adress to virtual
addres reversingly. But it needs to search all the pde nd pte in the
page directory. It is pretty slow. Any work arround?
thanks
from peter (cmk...@hotmail.com)

Dick Wesseling

unread,
Nov 30, 2009, 11:08:51 AM11/30/09
to

In article <4b13dc69$0$5103$9a6e...@unlimited.newshosting.com>,

peter <cmk...@MUNGED.microcosmotalk.com> writes:
>
> hi all
> I am adding a feature about convert the physical adress to virtual
> addres reversingly. But it needs to search all the pde nd pte in the
> page directory. It is pretty slow. Any work arround?
> thanks

Recursive paging. If the page directory contains a self reference then
the page tables will appear in the logical address space.
For example, if the self reference is the last entry of the page dir then
the page tables appear in the highest 4M. To obtain the physical
page for a logical address shift the address by 12 and index the
array at FFC00000.

Tim Roberts

unread,
Dec 1, 2009, 10:01:01 AM12/1/09
to

peter <cmk...@MUNGED.microcosmotalk.com> wrote:
>
> I am adding a feature about convert the physical adress to virtual
>addres reversingly. But it needs to search all the pde nd pte in the
>page directory. It is pretty slow. Any work arround?

Fortunately, that's only useful as a debug tool, so the speed is
irrelevant.
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Alexei A. Frounze

unread,
Dec 1, 2009, 10:02:01 AM12/1/09
to

On Nov 30, 8:08=A0am, f...@MUNGED.microcosmotalk.com (Dick Wesseling)
wrote:
> In article <4b13dc69$0$5103$9a6e1...@unlimited.newshosting.com>,

> =A0 =A0 =A0 =A0 peter <cmk...@MUNGED.microcosmotalk.com> writes:
>
>
>
> > hi all
> > =A0 =A0I am adding a feature about convert the physical adress to virtu=

al
> > addres reversingly. But it needs to search all the pde nd pte in the
> > page directory. It is pretty slow. Any work arround?
> > thanks
>
> Recursive paging. If the page directory contains a self reference then
> the page tables will appear in the logical address space.
> For example, if the self reference is the last entry of the page dir then
> the page tables appear in the highest 4M.

But that's not gonna help in any way (except for performance -- you
don't need map page tables as page frames to access them).

> To obtain the physical
> page for a logical address shift the address by 12 and index the
> array at FFC00000.

Right, but this is almost useless (except as noted above) since he
needs to do a reverse look up: given the physical adress (which is in
the PTE) he wants to find the corresponding virtual address (which is
the path from the top-most page directory to this PTE). So, he'd need
to scan all these 4MB in the worst case scenario to find the VA that
refers to the given PA.

I'd add a data structure for this. A binary tree probably, whose nodes
would describe subranges of the virtual address space which are mapped
to physically contiguous memory. That should speed things up
considerably.

But there's a catch. If any physical page is mapped in several places
in the address space, then there needs to be some logic around that
(e.g. one should either prohibit this or find multiple mappings to the
same physical page and decide what to do with each of them).

Alex

BGB / cr88192

unread,
Dec 1, 2009, 10:02:24 AM12/1/09
to

"Dick Wesseling" <fr...@MUNGED.microcosmotalk.com> wrote in message
news:4b13ee13$0$4860$9a6e...@unlimited.newshosting.com...

I think the question though was about reverse mapping...

note that with just this information, it would still be a problem to do a
reverse-lookup efficiently (granted, even a linear search would not likely
be that bad for likely "typical" uses).

it could be helped some using a hash table, where a hash is used to help map
addresses, assuming that addresses follow the "typical" distribution (as in,
lots of accesses to the same spots).

otherwise...
one might need some sort of inverse page table...


or such...


Dick Wesseling

unread,
Dec 1, 2009, 3:45:03 PM12/1/09
to

In article <4b152fe9$0$4958$9a6e...@unlimited.newshosting.com>,

"Alexei A. Frounze" <alexf...@MUNGED.microcosmotalk.com> writes:
>
>
> Right, but this is almost useless (except as noted above) since he
> needs to do a reverse look up: given the physical adress (which is in
> the PTE) he wants to find the corresponding virtual address

You are right, I misread the original posting.

peter

unread,
Dec 2, 2009, 2:29:40 AM12/2/09
to

On 12=E6=9C=882=E6=97=A5, =E4=B8=8A=E5=8D=884=E6=99=8245=E5=88=86, f...@MUN=
GED.microcosmotalk.com (Dick Wesseling)
wrote:
> In article <4b152fe9$0$4958$9a6e1...@unlimited.newshosting.com>,
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 "Alexei A. Frounze" <alexfrun...@MUNGED.micro=

cosmotalk.com> writes:
>
>
>
> > Right, but this is almost useless (except as noted above) since he
> > needs to do a reverse look up: given the physical adress (which is in
> > the PTE) he wants to find the corresponding virtual address
>
> You are right, I misread the original posting.

As alex said, I also believe I need to read all the PDE. sometimes,
one physical address are mapped with several virutal addresses.
But is this a good feature for my debugger?

thanks
from Peter

0 new messages