Re: Page Physical Address and pte

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

 



But I am in a kernel mode. How do I use MMU? And I want to scan the whole pages not just accessing a particular address.

you might want to check vmscan to see how walkthrough of pages are done. i believe what he meant is to walk through/scan the linear/virtual addresses of the pages. that is how you access those pages.

I look in the file, it is doing swapping and scanning through pages but does not look into the bytes in the page. It involves moving pages to different page pools. What I need is to read the frame bytes of a page that I have the pte_t and page struct.


you don't intentionally "use" MMU. the kernel does that for you. you
just use the kernel api when necessary.

Right, I am already in the kernel, particularly in: mm/memory.c at do_no_page() function which reads the block of file and put it into the the frame which corresponds to a new_page. So now I have the pte_t of the new page and the page struct of the new pages. Since I'm already in kernel mode, I think I have the physical address of the fram from the pte_t, am I correct?


The pte_t if I'm not mistaken is the physical base address of the page, so I just have to run a pointer starting from that address to PAGE_SIZE. Can I do that? Or I have to call read syscall with fd pointing to /dev/kmem? Can I make a system call in the kernel mode?

I am confused of what kind of address pte_t is, and if the kernel operates in physical address or still virtual address. I just want to read the bytes in that page frame memory.

the size of a x86 page is 4kb. whether it is filled or not, depends on
the type of page it is. if it is a file/device backed page, then it is
usually filled with driver data. if the page is an anonymous page, and you are writing to it, then the page is allocated, zeroed, before it is used/reclaimed to be used.

Right now the page that I have is from a block device (disk file system). I believe the interesting data from file is brought in by blocks (a multiple of 512 bytes frame). Which means the page might only have a few frames, for example the page that is at the end of the file. How can I detect this? That's why I am thinking if I have to stop after the end of the data and not to read more eventhough it's not the end of the page.


Thanks a lot for the info.

Kuas


-- 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