1 / 6

Studying ‘mmap()/munmap()’

Studying ‘mmap()/munmap()’. How we can use our ‘toolbox’ of kernel modules to examine the effects of ‘mmap()/munmap()’. Experiment #1. Remember our ‘vma.c’ module? It creates a ‘/proc’ file It shows a task’s virtual memory areas NOTE: It works only for the ‘current’ task

gale
Download Presentation

Studying ‘mmap()/munmap()’

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Studying ‘mmap()/munmap()’ How we can use our ‘toolbox’ of kernel modules to examine the effects of ‘mmap()/munmap()’

  2. Experiment #1 • Remember our ‘vma.c’ module? • It creates a ‘/proc’ file • It shows a task’s virtual memory areas • NOTE: It works only for the ‘current’ task • We do BEFORE and AFTER comparisons

  3. Details of our Plan #1 • Install the ‘vma.c’ module • Install ‘mysis.c’ device-driver • Write an application: ‘mmstudy1.cpp’ • Open the files ‘/dev/mysis’ and ‘/proc/vma’ • Read and display contents of ‘/proc/vma’ • Call ‘mmap()’ to map the video frame-buffer • Read and display contents of ‘/proc/vma’ • Call ‘munmap()’ to unmap the frame-buffer • Read and display contents of ‘/proc/vma’

  4. Experiment #2 • We want to examine a task’s page-tables • We need to use our ‘ram.c’ device-driver • We also need a new ‘/proc’ file: ‘cr3.c’ • CR3 = physical address of page-directory • Page-Directory = page-table addresses • We again do BEFORE and AFTER looks

  5. Details of our Plan #2 • Install modules ‘cr3.c’ and ‘ram.c’ • Write an application: ‘mmstudy2.cpp’ • Open: /proc/cr3, ‘/dev/ram’ and ‘/dev/vram’ • Read page-directory and page-table(s) • Call ‘mmap()’ to map the video frame-buffer • Read page-directory and page-table(s) • Call ‘munmap()’ to unmap the frame-buffer • Read page-directory and page-table(s) • Compare tables (to see if anything changed)

  6. What to turn in today? • Turn in a printout of your source-code: • for ‘mmstudy1.cpp’ and for ‘mmstudy2.cpp’ • Turn in a printout of your program output: • from ‘mmstudy1’ and from ‘mmstudy2’ • You may ask for assistance • from Instructor, from TA, from classmembers

More Related