All of lore.kernel.org
 help / color / mirror / Atom feed
* dear list
@ 2010-09-02  6:51 gaoqiang
  2010-10-14  5:18 ` Américo Wang
  0 siblings, 1 reply; 5+ messages in thread
From: gaoqiang @ 2010-09-02  6:51 UTC (permalink / raw)
  To: linux-kernel

I'm a newbie and got some question when learning the linux kernel

about a macro:

page_to_pfn(pg)

I traced its definition,and finally got that:

#define __page_to_pfn(page) ((unsigned long)((page) - mem_map) + 
ARCH_PFN_OFFSET)


why hot ((unsigned long)((page)-mem_map + ARCH_PFN_OFFSET)/sizeof 
(struct page)



^ permalink raw reply	[flat|nested] 5+ messages in thread

* dear list
@ 2010-09-04  3:42 gaoqiang
  2010-09-06  4:57 ` Peter Teoh
  0 siblings, 1 reply; 5+ messages in thread
From: gaoqiang @ 2010-09-04  3:42 UTC (permalink / raw)
  To: linux-newbie

Recently,I got some trouble reading the kernel source.  There are so 
many macro def in the source tree and I don't know whether some one wad 
defined or not.

So,is there any way to just preprocessor to eliminate these macros , 
similiar to gcc -E ???


--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dear list
  2010-09-04  3:42 dear list gaoqiang
@ 2010-09-06  4:57 ` Peter Teoh
  2010-09-07  4:26   ` Om Narasimhan
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Teoh @ 2010-09-06  4:57 UTC (permalink / raw)
  To: gaoqiang; +Cc: linux-newbie

On Sat, Sep 4, 2010 at 11:42 AM, gaoqiang <834555262@qq.com> wrote:
> Recently,I got some trouble reading the kernel source.  There are so many
> macro def in the source tree and I don't know whether some one wad defined
> or not.
>
> So,is there any way to just preprocessor to eliminate these macros ,
> similiar to gcc -E ???
>

pros and cons...."-E" will generate so much intermediate output that
you will be drowned in source codes.

alternatively....it is better to zoom down via learning how to use
ctags with "vi", and direct disassembly via "objdump" to see which
macro it matches to.

http://www.yolinux.com/TUTORIALS/LinuxTutorialAdvanced_vi.html

but first u must generate the tag file with "make tags" on the kernel
source first.

>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs
>



-- 
Regards,
Peter Teoh
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dear list
  2010-09-06  4:57 ` Peter Teoh
@ 2010-09-07  4:26   ` Om Narasimhan
  0 siblings, 0 replies; 5+ messages in thread
From: Om Narasimhan @ 2010-09-07  4:26 UTC (permalink / raw)
  To: Peter Teoh; +Cc: gaoqiang, linux-newbie

http://kernelnewbies.org/FAQ/KernelCrossCompilation
check the last part, I have written how to get the preprocessed output.

HTH,
Om.

On Sun, Sep 5, 2010 at 9:57 PM, Peter Teoh <htmldeveloper@gmail.com> wrote:
> On Sat, Sep 4, 2010 at 11:42 AM, gaoqiang <834555262@qq.com> wrote:
>> Recently,I got some trouble reading the kernel source.  There are so many
>> macro def in the source tree and I don't know whether some one wad defined
>> or not.
>>
>> So,is there any way to just preprocessor to eliminate these macros ,
>> similiar to gcc -E ???
>>
>
> pros and cons...."-E" will generate so much intermediate output that
> you will be drowned in source codes.
>
> alternatively....it is better to zoom down via learning how to use
> ctags with "vi", and direct disassembly via "objdump" to see which
> macro it matches to.
>
> http://www.yolinux.com/TUTORIALS/LinuxTutorialAdvanced_vi.html
>
> but first u must generate the tag file with "make tags" on the kernel
> source first.
>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at http://www.linux-learn.org/faqs
>>
>
>
>
> --
> Regards,
> Peter Teoh
> --
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs
>
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dear list
  2010-09-02  6:51 gaoqiang
@ 2010-10-14  5:18 ` Américo Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Américo Wang @ 2010-10-14  5:18 UTC (permalink / raw)
  To: gaoqiang; +Cc: linux-kernel

On Thu, Sep 02, 2010 at 02:51:48PM +0800, gaoqiang wrote:
>I'm a newbie and got some question when learning the linux kernel
>
>about a macro:
>
>page_to_pfn(pg)
>
>I traced its definition,and finally got that:
>
>#define __page_to_pfn(page) ((unsigned long)((page) - mem_map) +
>ARCH_PFN_OFFSET)
>
>
>why hot ((unsigned long)((page)-mem_map + ARCH_PFN_OFFSET)/sizeof
>(struct page)
>

Sorry for the really long delay.

That is because both 'page' and 'mem_map' have type 'struct page *'.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-10-14  5:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-04  3:42 dear list gaoqiang
2010-09-06  4:57 ` Peter Teoh
2010-09-07  4:26   ` Om Narasimhan
  -- strict thread matches above, loose matches on Subject: below --
2010-09-02  6:51 gaoqiang
2010-10-14  5:18 ` Américo Wang

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.