Various minor fixes.

Removed some commented out code.
Removed excessive printfs.
Fixed spid not initialising for mm0
Fixed some faults with fs0.

TODO:
- Need to store vfs files in a separate list.
- Need to define vnum as a vfs-file-specific data, i.e. in priv_data field of vm_file.
- Need to then fix vfs_receive_sys_open.
This commit is contained in:
Bahadir Balban
2008-03-24 22:39:21 +00:00
parent 13b9e5407a
commit 4b1abc60a6
13 changed files with 36 additions and 103 deletions

View File

@@ -23,19 +23,19 @@ int __sys_kread(int rd, void *dest)
switch(rd) {
case KDATA_PAGE_MAP:
printk("Handling KDATA_PAGE_MAP request.\n");
// printk("Handling KDATA_PAGE_MAP request.\n");
if (check_access(vaddr, sizeof(page_map), MAP_USR_RW_FLAGS) < 0)
return -EINVAL;
memcpy(dest, &page_map, sizeof(page_map));
break;
case KDATA_BOOTDESC:
printk("Handling KDATA_BOOTDESC request.\n");
// printk("Handling KDATA_BOOTDESC request.\n");
if (check_access(vaddr, bootdesc->desc_size, MAP_USR_RW_FLAGS) < 0)
return -EINVAL;
memcpy(dest, bootdesc, bootdesc->desc_size);
break;
case KDATA_BOOTDESC_SIZE:
printk("Handling KDATA_BOOTDESC_SIZE request.\n");
// printk("Handling KDATA_BOOTDESC_SIZE request.\n");
if (check_access(vaddr, sizeof(unsigned int), MAP_USR_RW_FLAGS) < 0)
return -EINVAL;
*(unsigned int *)dest = bootdesc->desc_size;

View File

@@ -49,75 +49,6 @@ int sys_schedule(struct syscall_args *regs)
return 0;
}
#if 0
/*
* THIS CODE IS TO BE USED WHEN MODIFYING PAGE TABLES FOR SHARED MEMORY!!!
*/
int do_shm_setup(struct shm_kdata *kdata)
{
struct ktcb *sender, *receiver;
unsigned long sndphys, sndvirt, rcvvirt;
if (!(sender = find_task(kdata->sender)))
return -1;
if (!(receiver = find_task(kdata->receiver)))
return -1;
/*
* There's no guarantee that shared pages are contiguous in physical,
* therefore every virtual page in the sharer shall be converted for
* its physical address, and each of those addresses are mapped.
*/
for (int i = 0; i < kdata->npages; i++) {
/* The sender virtual address for each shared page */
sndvirt = __pfn_to_addr(kdata->send_pfn) + (i * PAGE_SIZE);
/* The corresponding receiver virtual address */
rcvvirt = __pfn_to_addr(kdata->recv_pfn) + (i * PAGE_SIZE);
/* Converted to physical, through the sharer's page table. */
sndphys = __pte_to_addr(virt_to_pte_from_pgd(sndvirt,
sender->pgd));
/*
* Mapped to virtual in the sharee's address space. Note this
* is mapped as uncached, in order to avoid cache aliasing
* issues in ARM v5, which is VIVT. A possible optimisation for
* the future is to make it cached and restrict the shm
* address range.
*/
add_mapping_pgd(sndphys, rcvvirt, PAGE_SIZE, MAP_SVC_IO_FLAGS,
receiver->pgd);
}
return 0;
}
/* Modifies an address space */
int sys_space_control(struct syscall_args *regs)
{
unsigned int operation = regs->r0;
int err = 0;
if (current->tid != PAGER_TID) {
printk("%s: Priveledged call, only task id %d can call it. (Current id: %d)\n",
__FUNCTION__, current->tid, PAGER_TID);
return -EPERM;
}
switch (operation) {
case SPCCTRL_SHM:
/* FIXME: Add an access check for user space structure */
if ((err = do_shm_setup((struct shm_kdata *)&regs->r1) < 0))
printk("%s: Error setting up the shm area.\n", __FUNCTION__);
break;
default:
printk("%s: Unsupported operation: %d\n", __FUNCTION__, operation);
err = -ENOSYS;
}
printk("%s called. Tid (%d)\n", __FUNCTION__, current->tid);
return err;
}
#endif
int sys_space_control(struct syscall_args *regs)
{
return -ENOSYS;