mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 10:53:16 +01:00
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:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user