mirror of
https://github.com/drasko/codezero.git
synced 2026-04-18 09:49:05 +02:00
Fixed detection of devzero file.
Fixed adding VMA_ANONYMOUS flag explicitly if no file was given
This commit is contained in:
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
/* Defines the type of file. A device file? Regular file? One used at boot? */
|
/* Defines the type of file. A device file? Regular file? One used at boot? */
|
||||||
enum VM_FILE_TYPE {
|
enum VM_FILE_TYPE {
|
||||||
VM_FILE_DEVZERO = 0,
|
VM_FILE_DEVZERO = 1,
|
||||||
VM_FILE_REGULAR,
|
VM_FILE_REGULAR,
|
||||||
VM_FILE_BOOTFILE,
|
VM_FILE_BOOTFILE,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -461,7 +461,7 @@ int do_mmap(struct vm_file *mapfile, unsigned long file_offset, struct tcb *task
|
|||||||
/* Set up devzero if none given */
|
/* Set up devzero if none given */
|
||||||
if (!mapfile) {
|
if (!mapfile) {
|
||||||
if (flags & VMA_ANONYMOUS) {
|
if (flags & VMA_ANONYMOUS) {
|
||||||
mapfile = get_devzero();
|
BUG_ON(!(mapfile = get_devzero()));
|
||||||
file_offset = 0;
|
file_offset = 0;
|
||||||
} else
|
} else
|
||||||
BUG();
|
BUG();
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ struct vm_file *get_devzero(void)
|
|||||||
struct vm_file *f;
|
struct vm_file *f;
|
||||||
|
|
||||||
list_for_each_entry(f, &vm_file_list, list)
|
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 f;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ int start_boot_task(struct vm_file *file, struct task_ids *ids)
|
|||||||
|
|
||||||
/* mmap each task's environment as anonymous memory. */
|
/* mmap each task's environment as anonymous memory. */
|
||||||
if ((err = do_mmap(0, 0, task, task->env_start,
|
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)) {
|
__pfn(task->env_end - task->env_start)) < 0)) {
|
||||||
printf("do_mmap: Mapping environment failed with %d.\n",
|
printf("do_mmap: Mapping environment failed with %d.\n",
|
||||||
err);
|
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. */
|
/* mmap each task's stack as anonymous memory. */
|
||||||
if ((err = do_mmap(0, 0, task, task->stack_start,
|
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)) {
|
__pfn(task->stack_end - task->stack_start)) < 0)) {
|
||||||
printf("do_mmap: Mapping stack failed with %d.\n", err);
|
printf("do_mmap: Mapping stack failed with %d.\n", err);
|
||||||
goto error;
|
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__,
|
printf("%s: Mapping utcb for new task at: 0x%x\n", __TASKNAME__,
|
||||||
task->utcb_address);
|
task->utcb_address);
|
||||||
if ((err = do_mmap(0, 0, task, 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)) {
|
DEFAULT_UTCB_SIZE) < 0)) {
|
||||||
printf("do_mmap: Mapping utcb failed with %d.\n", err);
|
printf("do_mmap: Mapping utcb failed with %d.\n", err);
|
||||||
goto error;
|
goto error;
|
||||||
|
|||||||
Reference in New Issue
Block a user