Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Mapping of virtual to physical memory. More...
Go to the source code of this file.
Macros | |
#define | _LARGEFILE64_SOURCE |
#define | BIT(i) ((unsigned long long) 1 << i) |
#define | FILENAME_SIZE 30 |
#define | PAGE_SHIFT 12 |
#define | PAGE_SIZE (1<<PAGE_SHIFT) |
#define | PAGE_MASK (((unsigned long long)1<< PAGE_SHIFT) -1) |
#define | PAGE_PRESENT BIT(63) |
#define | PAGE_SWAPPED BIT(62) |
#define | PAGE_PFN_MASK (((unsigned long long)1<< 55) -1) |
Functions | |
static int | open_pagemap (pid_t pid) |
static int | virt2phys (int fd, unsigned long vaddr, unsigned long *paddr) |
int | check_contiguity (unsigned long vaddr, pid_t pid, struct physmem *pmem, size_t size) |
Mapping of virtual to physical memory.
Source : See the linux kernel documentation at -> https://www.kernel.org/doc/Documentation/vm/pagemap.txt
The file /proc/pid/pagemap contains 8 bytes for each virtual PFN describing the page status. First we check the bits indicating if page is present and not swapped. Then we can get the physical PFN.
Contiguity check consist to verify of contiguous virtual memory correspond to present, not swapped and contiguous physical pages.
Definition in file virt2phys.c.
#define _LARGEFILE64_SOURCE |
Definition at line 37 of file virt2phys.c.
#define BIT | ( | i | ) | ((unsigned long long) 1 << i) |
Definition at line 44 of file virt2phys.c.
#define FILENAME_SIZE 30 |
Definition at line 45 of file virt2phys.c.
#define PAGE_MASK (((unsigned long long)1<< PAGE_SHIFT) -1) |
Definition at line 48 of file virt2phys.c.
#define PAGE_PFN_MASK (((unsigned long long)1<< 55) -1) |
Definition at line 52 of file virt2phys.c.
#define PAGE_PRESENT BIT(63) |
Definition at line 50 of file virt2phys.c.
#define PAGE_SHIFT 12 |
Definition at line 46 of file virt2phys.c.
#define PAGE_SIZE (1<<PAGE_SHIFT) |
Definition at line 47 of file virt2phys.c.
#define PAGE_SWAPPED BIT(62) |
Definition at line 51 of file virt2phys.c.
int check_contiguity | ( | unsigned long | vaddr, |
pid_t | pid, | ||
struct physmem * | pmem, | ||
size_t | size | ||
) |
Definition at line 111 of file virt2phys.c.
References fd, open_pagemap(), physmem::paddr, PAGE_MASK, PAGE_SIZE, physmem::size, and virt2phys().
Referenced by v4l2_init().
|
static |
Definition at line 59 of file virt2phys.c.
References FILENAME_SIZE.
Referenced by check_contiguity().
|
static |
Definition at line 78 of file virt2phys.c.
References fd, PAGE_MASK, PAGE_PFN_MASK, PAGE_PRESENT, PAGE_SHIFT, and PAGE_SWAPPED.
Referenced by check_contiguity().