shm file didn't initialise with VM_WRITE. Added that.

Otherwise copy_on_write() tries to create a r/w shadow which is wrong.
Also fixed the fault print functions to print SHM file type as well.
This commit is contained in:
Bahadir Balban
2008-03-21 16:00:20 +00:00
parent b369ff6efe
commit 0b279081b6
3 changed files with 16 additions and 6 deletions

View File

@@ -14,7 +14,7 @@
#include <arch/mm.h>
#include <lib/spinlock.h>
//#define DEBUG_FAULT_HANDLING
#define DEBUG_FAULT_HANDLING
#ifdef DEBUG_FAULT_HANDLING
#define dprintf(...) printf(__VA_ARGS__)
#else

View File

@@ -195,7 +195,7 @@ static struct vm_file *shm_new(key_t key, unsigned long npages)
/* Initialise the vm object */
shm_file->vm_obj.pager = &swap_pager;
shm_file->vm_obj.flags = VM_OBJ_FILE;
shm_file->vm_obj.flags = VM_OBJ_FILE | VM_WRITE;
list_add(&shm_file->list, &shm_file_list);
list_add(&shm_file->vm_obj.list, &vm_object_list);

View File

@@ -32,10 +32,20 @@ void vm_object_print(struct vm_object *vmo)
vmo->npages);
if (vmo->flags & VM_OBJ_FILE) {
f = vm_object_to_file(vmo);
printf("File type: %s\n",
(f->type == VM_FILE_DEVZERO) ? "devzero" :
((f->type == VM_FILE_BOOTFILE) ? "bootfile" : "regular"));
// printf("File type: 0x%x\n", f->type);
char *ftype;
if (f->type == VM_FILE_DEVZERO)
ftype = "devzero";
else if (f->type == VM_FILE_BOOTFILE)
ftype = "bootfile";
else if (f->type == VM_FILE_SHM)
ftype = "shm file";
else if (f->type == VM_FILE_REGULAR)
ftype = "regular";
else
BUG();
printf("File type: %s\n", ftype);
}
print_cache_pages(vmo);
printf("\n");