Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1271310 > unrolled thread

read physical address space

Started byalan hopes <hopes.alan@gmail.com>
First post2015-11-17 16:30 +0100
Last post2015-11-24 16:50 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  read physical address space alan hopes <hopes.alan@gmail.com> - 2015-11-17 16:30 +0100
    Re: read physical address space yalin wang <yalin.wang2010@gmail.com> - 2015-11-17 18:00 +0100
      Re: read physical address space alan hopes <hopes.alan@gmail.com> - 2015-11-24 16:50 +0100

#1271310 — read physical address space

Fromalan hopes <hopes.alan@gmail.com>
Date2015-11-17 16:30 +0100
Subjectread physical address space
Message-ID<qvQmJ-6NX-3@gated-at.bofh.it>
Hi,

I am new to kernel and working on a college project.

I have kernel module which takes process ID. Based on the PID, I walk
its page tables and get to PTE for a particular VMA area.

I convert PTE to physical address (phy_addr) and now I want to read
from the that physical address.

I have made sure the page containing the physical address is mapped
but if I do printk (*phys_addr) , then kernel crashes.

I think I am missing some important concept here. Do I need another
driver to access physical space, may be a PCI driver as RAM being a
PCI device ?

Thanks
Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" 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.tux.org/lkml/

[toc] | [next] | [standalone]


#1271445

Fromyalin wang <yalin.wang2010@gmail.com>
Date2015-11-17 18:00 +0100
Message-ID<qvRLR-7AN-21@gated-at.bofh.it>
In reply to#1271310
you should access it like this:
	printk ( *(int*)kmap(pays_to_page(pays_addr)));

pays address must be mapped into virtual address before access it .
> On Nov 17, 2015, at 23:21, alan hopes <hopes.alan@gmail.com> wrote:
> 
> phys_addr

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" 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.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1276583

Fromalan hopes <hopes.alan@gmail.com>
Date2015-11-24 16:50 +0100
Message-ID<qyo0W-1By-7@gated-at.bofh.it>
In reply to#1271445
Thanks Yalin.

Yeah, got it.. So, it means I can't directly access physical address,
its only the responsibility of MMU to access it. Even if I have a
physical address, I need to convert it to kernel virtual address to
access it to maintain consistency with other general user-mode memory
access operation.

Thanks
Alan.

On Tue, Nov 17, 2015 at 4:28 PM, yalin wang <yalin.wang2010@gmail.com> wrote:
> you should access it like this:
>         printk ( *(int*)kmap(pays_to_page(pays_addr)));
>
> pays address must be mapped into virtual address before access it .
>> On Nov 17, 2015, at 23:21, alan hopes <hopes.alan@gmail.com> wrote:
>>
>> phys_addr
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" 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.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web