belinghy / jos-mmap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JOS/mmap

Brief introduction of main files

inc/lib.h contains the declarations and some data stuctures

#define PROT_NONE   0
#define PROT_READ   1
#define PROT_WRITE  2
#define PROT_EXEC   3

#define MAP_PRIVATE 0
#define MAP_SHARED  1

typedef struct mmap_entry
{
    ...
} mmap_entry;

typedef struct mmap_entry_bucket
{
    ...
} mmap_entry_bucket;

lib/mmap.c contains the implementation of mmap

// for mmap
void * mmap(void *addr, size_t length, int permission, int flags,
            int fdnum, off_t offset);

// for unmapping
int munmap(void *addr, size_t length);

// for handling page fault, which the user first access the mapped pages
void pgfault_upcall(struct UTrapframe *tf);

// other helper functions
...

user/test_mmap.c contains the testing files. You can configure which test to run in the umain(...).

make qemu-nox to start the OS, then type test_mmap to run the test.

About


Languages

Language:C 88.4%Language:Assembly 7.2%Language:Makefile 2.5%Language:C++ 0.8%Language:Perl 0.7%Language:Python 0.4%Language:Emacs Lisp 0.1%Language:Shell 0.0%