diff --git a/src/Makefile.build b/src/Makefile.build index 7778f57..fea3a67 100644 --- a/src/Makefile.build +++ b/src/Makefile.build @@ -64,6 +64,7 @@ userprog_SRC += userprog/tss.c # TSS management. # Virtual memory code. vm_SRC += vm/frame.c # Frame table manager. vm_SRC += vm/page.c # Page table manager. +vm_SRC += vm/mmap.c # Memory-mapped files. vm_SRC += devices/swap.c # Swap block manager. # Filesystem code. diff --git a/src/vm/mmap.c b/src/vm/mmap.c new file mode 100644 index 0000000..328f37b --- /dev/null +++ b/src/vm/mmap.c @@ -0,0 +1 @@ +#include "mmap.h" \ No newline at end of file diff --git a/src/vm/mmap.h b/src/vm/mmap.h new file mode 100644 index 0000000..8fd64ee --- /dev/null +++ b/src/vm/mmap.h @@ -0,0 +1,18 @@ +#ifndef VM_MMAP_H +#define VM_MMAP_H + +#include + +/* A mapping identifier type. */ +typedef unsigned mapid_t; + +/* A structure to represent a memory mapped file. */ +struct mmap_entry { + mapid_t mapping; /* The mapping identifier of the mapped file. */ + struct file *file; /* A pointer to the file that is being mapped. */ + void *upage; /* The start address of the file data in the user VM. */ + + struct hash_elem elem; /* An elem for the hash table. */ +}; + +#endif /* vm/mmap.h */