Add mmap module in vm defining mmap_entry structure and some helper functions
This commit is contained in:
@@ -64,6 +64,7 @@ userprog_SRC += userprog/tss.c # TSS management.
|
|||||||
# Virtual memory code.
|
# Virtual memory code.
|
||||||
vm_SRC += vm/frame.c # Frame table manager.
|
vm_SRC += vm/frame.c # Frame table manager.
|
||||||
vm_SRC += vm/page.c # Page 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.
|
vm_SRC += devices/swap.c # Swap block manager.
|
||||||
|
|
||||||
# Filesystem code.
|
# Filesystem code.
|
||||||
|
|||||||
1
src/vm/mmap.c
Normal file
1
src/vm/mmap.c
Normal file
@@ -0,0 +1 @@
|
|||||||
|
#include "mmap.h"
|
||||||
18
src/vm/mmap.h
Normal file
18
src/vm/mmap.h
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#ifndef VM_MMAP_H
|
||||||
|
#define VM_MMAP_H
|
||||||
|
|
||||||
|
#include <hash.h>
|
||||||
|
|
||||||
|
/* 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 */
|
||||||
Reference in New Issue
Block a user