How can I test if a physical address is already mapped or not.

StephanT stman937-linewbie at yahoo.com
Tue Oct 18 21:01:13 EDT 2011



>>  Yes you are right when you are in user space. However in a kernel
>>  module this would be physical address.
> 
> Nope. Unless you are using some really strange processor that I am not familiar 
> with, a memory read is a memory read. *pReg is going to read what's at 
> virtual address 0xc0000000 regardless of whether you are executing in user or 
> kernel context. I know it's going to work this way on a PC with an Intel x86 
> processor.
> 


OK, but how do you explain I can read 0xC0000000 and I get kicked out if
I try 0x00100000.


>>  The 0xC0000000 falls under PCI address range. I guess on a PC Linux
>>  just doesn't map this address range or it maps it one2one (phys==virt)
>>  I can dereference this address and I get something plausible.
> 
> On most 32 bit Intel processors running "standard" Linux 0xC0000000 is 
> the first address of kernel VM. This is a function of kernel configuration, but 
> it's this way by default. It's still a virtual address. So yes, on your 
> PC virtual address 0xC0000000 is mapped to physical RAM.
> 


Would this mean by reading the 0xC0000000 I am reading the Linux code not
PCI registers?

Thanks,
Stephan.




More information about the Kernelnewbies mailing list