From: stman937-linewbie@yahoo.com (StephanT) Date: Tue, 18 Oct 2011 18:01:13 -0700 (PDT) Subject: How can I test if a physical address is already mapped or not. In-Reply-To: <6F5DE7538AFCDA45A114F5E7510424A702BA8A34@hq-exchange01.bytemobile.com> References: <1318881863.52041.YahooMailNeo@web30802.mail.mud.yahoo.com> <1318958587.51216.YahooMailNeo@web30801.mail.mud.yahoo.com> <6F5DE7538AFCDA45A114F5E7510424A702BA89C6@hq-exchange01.bytemobile.com> <1318971483.51428.YahooMailNeo@web30803.mail.mud.yahoo.com> <6F5DE7538AFCDA45A114F5E7510424A702BA89DF@hq-exchange01.bytemobile.com> <1318984129.68495.YahooMailNeo@web30806.mail.mud.yahoo.com> <6F5DE7538AFCDA45A114F5E7510424A702BA8A34@hq-exchange01.bytemobile.com> Message-ID: <1318986073.55817.YahooMailNeo@web30803.mail.mud.yahoo.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org >> 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.