* Questions on one PowerPC assembly instruction from hash_page
2007-06-18 7:05 ` Jens Axboe
@ 2007-06-18 8:33 ` gshan
0 siblings, 0 replies; 3+ messages in thread
From: gshan @ 2007-06-18 8:33 UTC (permalink / raw)
To: LKML; +Cc: Chen, Jinmin (Jinmin)
Hey Guys,
I can't understand the following instructions from
arch/ppc/mm/hashtable.S::hash_page. If I got the right design, the
following instruction is to get the PMD (Page Middle Descritor) because
Linux for 32-bits PowerPC cut page table into 3 domains: root, PMD, PTE.
The top bits (22 to 31 bit) is the index for PMD, and the next 10 bits
(12 to 21 bit) is the index for PTE in the associative PMD. The
remaining 12 bits (0 to 11 bit) indicated the page size (4KB). However,
the following instruction polled [8-17] bits instead of [22-31] bits as
expected. Anybody could give me answer?
r4 is the address that caused the DSI
r5 is the address of swapper_pg_dir if we are under kernel mode.
rlwimi r5,r4,12,20,29 /* insert top 10 bits of address */
Thanks,
Gavin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Questions on one PowerPC assembly instruction from hash_page
@ 2007-06-18 8:57 Mikael Pettersson
2007-06-19 2:18 ` gshan
0 siblings, 1 reply; 3+ messages in thread
From: Mikael Pettersson @ 2007-06-18 8:57 UTC (permalink / raw)
To: gshan, linux-kernel; +Cc: jinminc
On Mon, 18 Jun 2007 16:33:22 +0800, gshan <gshan@alcatel-lucent.com> wrote:
> I can't understand the following instructions from
> arch/ppc/mm/hashtable.S::hash_page. If I got the right design, the
> following instruction is to get the PMD (Page Middle Descritor) because
> Linux for 32-bits PowerPC cut page table into 3 domains: root, PMD, PTE.
> The top bits (22 to 31 bit) is the index for PMD, and the next 10 bits
> (12 to 21 bit) is the index for PTE in the associative PMD. The
> remaining 12 bits (0 to 11 bit) indicated the page size (4KB). However,
> the following instruction polled [8-17] bits instead of [22-31] bits as
> expected. Anybody could give me answer?
>
> r4 is the address that caused the DSI
> r5 is the address of swapper_pg_dir if we are under kernel mode.
>
> rlwimi r5,r4,12,20,29 /* insert top 10 bits of address */
POWER/PowerPC has an insanely broken bit numbering scheme, in
which the most significant bit has number 0 (or is it 1?),
and the least significant bit has number N-1 (or is it N?)
where N is number of bits in a word.
The fact that you refer to the top bits as 22-31 makes me
suspect that you haven't compensated for this quirk.
/Mikael
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Questions on one PowerPC assembly instruction from hash_page
2007-06-18 8:57 Questions on one PowerPC assembly instruction from hash_page Mikael Pettersson
@ 2007-06-19 2:18 ` gshan
0 siblings, 0 replies; 3+ messages in thread
From: gshan @ 2007-06-19 2:18 UTC (permalink / raw)
To: Mikael Pettersson; +Cc: linux-kernel, jinminc
Mikael Pettersson wrote:
> On Mon, 18 Jun 2007 16:33:22 +0800, gshan <gshan@alcatel-lucent.com> wrote:
>
>> I can't understand the following instructions from
>> arch/ppc/mm/hashtable.S::hash_page. If I got the right design, the
>> following instruction is to get the PMD (Page Middle Descritor) because
>> Linux for 32-bits PowerPC cut page table into 3 domains: root, PMD, PTE.
>> The top bits (22 to 31 bit) is the index for PMD, and the next 10 bits
>> (12 to 21 bit) is the index for PTE in the associative PMD. The
>> remaining 12 bits (0 to 11 bit) indicated the page size (4KB). However,
>> the following instruction polled [8-17] bits instead of [22-31] bits as
>> expected. Anybody could give me answer?
>>
>> r4 is the address that caused the DSI
>> r5 is the address of swapper_pg_dir if we are under kernel mode.
>>
>> rlwimi r5,r4,12,20,29 /* insert top 10 bits of address */
>>
>
> POWER/PowerPC has an insanely broken bit numbering scheme, in
> which the most significant bit has number 0 (or is it 1?),
> and the least significant bit has number N-1 (or is it N?)
> where N is number of bits in a word.
>
> The fact that you refer to the top bits as 22-31 makes me
> suspect that you haven't compensated for this quirk.
>
> /Mikael
>
Mikael, Thanks a lot. I understood why the instruction is there. So the
0-11 bits are used as address index for PMD. swapper_pg_dir is 4KB large
and there are 1K PMDs inside swapper_pg_dir. So 10 bits (0-9 bits) are
used as index for PMD, right?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-06-19 2:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-18 8:57 Questions on one PowerPC assembly instruction from hash_page Mikael Pettersson
2007-06-19 2:18 ` gshan
-- strict thread matches above, loose matches on Subject: below --
2007-06-14 14:24 [PATCH] cdrom_sysctl_info fix Dave Young
2007-06-15 13:26 ` Jens Axboe
2007-06-18 12:58 ` Dave Young
2007-06-18 6:27 ` Jens Axboe
2007-06-18 6:41 ` dave young
2007-06-18 6:43 ` Jens Axboe
2007-06-18 7:03 ` dave young
2007-06-18 7:05 ` Jens Axboe
2007-06-18 8:33 ` Questions on one PowerPC assembly instruction from hash_page gshan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.