Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9209595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:52:51+00:00 2026-06-18T00:52:51+00:00

Any one know about how virtual address is translated to physical address in no

  • 0

Any one know about how virtual address is translated to physical address in no page method.
with reference to Device Drivers book the nopage method is given as ,

struct page *simple_vma_nopage(struct vm_area_struct *vma,
                unsigned long address, int *type)
{
    struct page *pageptr;
    unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
    unsigned long physaddr = address - vma->vm_start + offset;
    unsigned long pageframe = physaddr >> PAGE_SHIFT;

    if (!pfn_valid(pageframe))
        return NOPAGE_SIGBUS;
    pageptr = pfn_to_page(pageframe);
    get_page(pageptr);
    if (type)
        *type = VM_FAULT_MINOR;
    return pageptr;
}

page_shift is the number of bits used to reperesent offset for Virtual and physical memory address.
But what is the offset variable ?
How a physical address is calculated from arithmetic operations on virtual address variables like address and vm_start ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:52:52+00:00Added an answer on June 18, 2026 at 12:52 am

    I feel the documentation of vm_pgoff is not very clear.
    This is the offset of the first page of the memory region in RAM.
    So if our RAM begins at 0x00000000, and our memory region begins
    at 0x0000A000, then vm_pgoff = 10. If you consider/ revisit the mmap
    system call then you can see that the “offset” which we pass is the offset
    of the starting byte in the file from which “length” bytes will be mapped
    on to the memory region. This offset can be converted to address by left
    shifting it to PAGE_SHIFT value which is 12 (i.e. 4KB per page size)

    Now, irrespective of whether the cr3 register is used in linear address to
    physical address translation or not, when we say that “address – vm_start”
    then this gives the size of portion between the addresses.
    example:
    vm_start = 0xc0080000
    address = 0xc0090000

    address - vm_start = 0x00010000
    physaddr    = (address - vma->vm_start) + offset;
                = 0x00010000 + (10 << PAGE_SHIFT)
                = offset_to_page_that_fault + start_addr_of_memoryRegion_in_RAM  
                = 0x00010000 + 0x0000A000
                = 0x0001A000
    

    Now since this is the physical address therefore we need to convert to page frame
    number by right shifting by PAGE_SHIFT value i.e 0x0001A000 >> 12 = 0x1A = 26 (decimal)
    Therefore the 26th page-frame must be loaded with the data from the file which is being mapped.
    Hence data is retrieved from the disk by using the inode’s struct address_sapce
    which contains the information of the location of page on the disk (swap space).
    Once the data is brought in we return the struct page which represents this data in the
    page_frame for which this page fault occurred. We return this to the user.

    This is my understanding of the latest but I haven’t tested it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does any one know about opensource network monitor tool for BlackBerry ?
Any one know about any API which give city, state informations for a given
Did any one know about Renderscript in android 3.0 Also I want to know
Does anyone know about any API's, IDE's or such that simplifies the development of
Does anyone know any more details about google's web-crawler (aka GoogleBot)? I was curious
Does anyone know of any resources, examples or tutorials about testing ember.js apps ?
Any one know how to apply a css propert to the a tag, but
Does any one know why the location indicator stay on for certain bundle identifer
does any one know how to make the slide to left effect like in
This image gives a good picture about Virtual Address space. But it only says

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.