Re: Kernel virtual address for physical address, Problem in getting kernel vritual address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kernel never deal with physical addresses (except in
ioremap function in which it takes a 32bit physical
address only, so applicable for memory above 4GB) but
rather it deals ins a form of Pages or pfn (page frame
number) and pfn on x86 are actually equals to
physical_address >> PAGE_SHIFT, and on UMA
Architecture you can get the corresponding page
address for physical_address through "mem_map + pfn",
by the way using mem_map directly is I think not
suitable. By doing this u will get the page address of
the physical address and if it is mapped then that
page->virtual will certainly hav the virtual address
for that or just use page_to_virt function to get the
virual address of tha page.

If the page is of highmem then map it using kmap and
kmap will resturn u the virtual address of the mapped
page ......... 

By the way keep this in mind that I m telling this abt
x86 Architecture and I don't know abt the ppc but I
think that will work on that tooo ...........

Thanks and Regards,

Fawad


--- jhoney jhoney <jhoney_joney@xxxxxxxxxxxxxx> wrote:

> Date: 20 Oct 2004 15:42:58 -0000
> 
> Hello All,
> 
> I am working with kernel modules , and I would like
> to know the function that converts physical
> processor register address to the virtual kernel
> address so that that can be used in the kernel
> modules for further operations.
> 
> Thanks in Advance,
> 
> Regards
> 
> Jhoney



--- jhoney jhoney <jhoney_joney@xxxxxxxxxxxxxx> wrote:

> Subject: Problem in getting kernel vritual address

> I have a board MPC 8540 ported with ppc Linux and
> U-boot. U-boot is going to intialize the memory map,
> like  mapping 0x00000000 to SDRAM interface and
> 0xe0000000 to pci interface. so when we write at
> 0xe0000000 , the data will go through the pci.
> Assuming that whatever the memory map done by U-boot
> is carried over to the Linux, I wrote 
> 
> virtual_address = __va(0xfdf00000)  to get the
> virtual address for CCSRBAR , which  contains
> fdf00000 at offset zero.(It contains it's address at
> the offset zero from the CCSRBAR).
> 
> If  I dereference the virtual_address(
> *virtual_address  = fdf00000)
> it should contain the same address. But when i tried
> this , it result in segmentation fault. pls give me
> any clue.
> 
> Above all, what I want is , the memory map is
> carried from the u-boot to linux, if so how to get
> the virtual address(to manipulate in the kernel
> module) for the physical address to manipulate the
> processor registers.
> 
> Thanks in Advance
> 
> Regards
> 
> Jhoney
> 



		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux