Fixed detection of devzero file.

Fixed adding VMA_ANONYMOUS flag explicitly if no file was given
This commit is contained in:
Bahadir Balban
2008-03-14 15:37:10 +00:00
parent 2ecc7612c3
commit dc3b63d924
4 changed files with 6 additions and 6 deletions

View File

@@ -32,7 +32,7 @@
/* Defines the type of file. A device file? Regular file? One used at boot? */
enum VM_FILE_TYPE {
VM_FILE_DEVZERO = 0,
VM_FILE_DEVZERO = 1,
VM_FILE_REGULAR,
VM_FILE_BOOTFILE,
};

View File

@@ -461,7 +461,7 @@ int do_mmap(struct vm_file *mapfile, unsigned long file_offset, struct tcb *task
/* Set up devzero if none given */
if (!mapfile) {
if (flags & VMA_ANONYMOUS) {
mapfile = get_devzero();
BUG_ON(!(mapfile = get_devzero()));
file_offset = 0;
} else
BUG();

View File

@@ -266,7 +266,7 @@ struct vm_file *get_devzero(void)
struct vm_file *f;
list_for_each_entry(f, &vm_file_list, list)
if (f->type & VM_FILE_DEVZERO)
if ((f->type & VM_FILE_DEVZERO) == VM_FILE_DEVZERO)
return f;
return 0;
}

View File

@@ -265,7 +265,7 @@ int start_boot_task(struct vm_file *file, struct task_ids *ids)
/* mmap each task's environment as anonymous memory. */
if ((err = do_mmap(0, 0, task, task->env_start,
VM_READ | VM_WRITE | VMA_PRIVATE,
VM_READ | VM_WRITE | VMA_PRIVATE | VMA_ANONYMOUS,
__pfn(task->env_end - task->env_start)) < 0)) {
printf("do_mmap: Mapping environment failed with %d.\n",
err);
@@ -274,7 +274,7 @@ int start_boot_task(struct vm_file *file, struct task_ids *ids)
/* mmap each task's stack as anonymous memory. */
if ((err = do_mmap(0, 0, task, task->stack_start,
VM_READ | VM_WRITE | VMA_PRIVATE,
VM_READ | VM_WRITE | VMA_PRIVATE | VMA_ANONYMOUS,
__pfn(task->stack_end - task->stack_start)) < 0)) {
printf("do_mmap: Mapping stack failed with %d.\n", err);
goto error;
@@ -284,7 +284,7 @@ int start_boot_task(struct vm_file *file, struct task_ids *ids)
printf("%s: Mapping utcb for new task at: 0x%x\n", __TASKNAME__,
task->utcb_address);
if ((err = do_mmap(0, 0, task, task->utcb_address,
VM_READ | VM_WRITE | VMA_SHARED,
VM_READ | VM_WRITE | VMA_SHARED | VMA_ANONYMOUS,
DEFAULT_UTCB_SIZE) < 0)) {
printf("do_mmap: Mapping utcb failed with %d.\n", err);
goto error;