Fixed few more issues

The svc images must be pushed to boot file list in correct order
otherwise if test0 starts earlier than fs0, it gets fs0's predefined
thread and space id (since that's the first unallocated one) and
fs0 fails to initalise. In the future we can pre-allocate ids from
the kernel but current temporary fix is simple enough to use.
This commit is contained in:
Bahadir Balban
2008-03-14 15:39:00 +00:00
parent dc3b63d924
commit ed68f934aa
2 changed files with 32 additions and 3 deletions

View File

@@ -444,6 +444,35 @@ unsigned long find_unmapped_area(unsigned long npages, struct tcb *task)
return 0;
}
/* Validate an address that is a possible candidate for an mmap() region */
int mmap_address_validate(unsigned long map_address, unsigned int vm_flags)
{
if (map_address == 0)
return 0;
/* Private mappings can only go in task address space */
if (vm_flags & VMA_PRIVATE) {
if (map_address >= USER_AREA_START ||
map_address < USER_AREA_END) {
return 1;
} else
return 0;
/*
* Shared mappings can *also* go in the utcb address space,
* taking in account that utcb's are shared mappings done
* by individual tasks.
*/
} else if (vm_flags & VMA_SHARED) {
if ((map_address >= UTCB_AREA_START &&
map_address < UTCB_AREA_END) ||
(map_address >= USER_AREA_START &&
map_address < USER_AREA_END))
return 1;
else
return 0;
} else
BUG();
}
/*
* Maps the given file with given flags at the given page offset to the given
* task's address space at the specified virtual memory address and length.
@@ -487,8 +516,7 @@ int do_mmap(struct vm_file *mapfile, unsigned long file_offset, struct tcb *task
}
/* Check invalid map address */
if (map_address == 0 || map_address < USER_AREA_START ||
map_address >= USER_AREA_END) {
if (!mmap_address_validate(map_address, flags)) {
/* Get new map address for region of this size */
if ((int)(map_address =

View File

@@ -285,7 +285,7 @@ int start_boot_task(struct vm_file *file, struct task_ids *ids)
task->utcb_address);
if ((err = do_mmap(0, 0, task, task->utcb_address,
VM_READ | VM_WRITE | VMA_SHARED | VMA_ANONYMOUS,
DEFAULT_UTCB_SIZE) < 0)) {
__pfn(DEFAULT_UTCB_SIZE)) < 0)) {
printf("do_mmap: Mapping utcb failed with %d.\n", err);
goto error;
}
@@ -318,6 +318,7 @@ int start_boot_tasks(struct initdata *initdata)
struct task_ids ids;
int total = 0;
INIT_LIST_HEAD(&tcb_head.list);
do {
file = 0;
list_for_each_entry_safe(file, n, &initdata->boot_file_list,