mirror of
https://github.com/drasko/codezero.git
synced 2026-04-18 09:49:05 +02:00
Moved all find_task(sender) calls into topmost ipc handler.
System calls now need not search for the tcb they are serving for.
This commit is contained in:
@@ -9,17 +9,15 @@
|
|||||||
void vmfile_init(void);
|
void vmfile_init(void);
|
||||||
|
|
||||||
struct vm_file *vmfile_alloc_init(void);
|
struct vm_file *vmfile_alloc_init(void);
|
||||||
int vfs_receive_sys_open(l4id_t sender, l4id_t opener, int fd,
|
|
||||||
unsigned long vnum, unsigned long size);
|
|
||||||
int vfs_read(unsigned long vnum, unsigned long f_offset, unsigned long npages,
|
int vfs_read(unsigned long vnum, unsigned long f_offset, unsigned long npages,
|
||||||
void *pagebuf);
|
void *pagebuf);
|
||||||
int vfs_write(unsigned long vnum, unsigned long f_offset, unsigned long npages,
|
int vfs_write(unsigned long vnum, unsigned long f_offset, unsigned long npages,
|
||||||
void *pagebuf);
|
void *pagebuf);
|
||||||
int sys_read(l4id_t sender, int fd, void *buf, int count);
|
int sys_read(struct tcb *sender, int fd, void *buf, int count);
|
||||||
int sys_write(l4id_t sender, int fd, void *buf, int count);
|
int sys_write(struct tcb *sender, int fd, void *buf, int count);
|
||||||
int sys_lseek(l4id_t sender, int fd, off_t offset, int whence);
|
int sys_lseek(struct tcb *sender, int fd, off_t offset, int whence);
|
||||||
int sys_close(l4id_t sender, int fd);
|
int sys_close(struct tcb *sender, int fd);
|
||||||
int sys_fsync(l4id_t sender, int fd);
|
int sys_fsync(struct tcb *sender, int fd);
|
||||||
int file_open(struct tcb *opener, int fd);
|
int file_open(struct tcb *opener, int fd);
|
||||||
|
|
||||||
struct vfs_file_data {
|
struct vfs_file_data {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <l4lib/types.h>
|
#include <l4lib/types.h>
|
||||||
|
#include <task.h>
|
||||||
|
|
||||||
/* For reading argument data from a system call */
|
/* For reading argument data from a system call */
|
||||||
struct sys_mmap_args {
|
struct sys_mmap_args {
|
||||||
@@ -22,10 +23,10 @@ struct sys_mmap_args {
|
|||||||
off_t offset;
|
off_t offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
void *sys_mmap(l4id_t sender, void *start, size_t length, int prot,
|
void *sys_mmap(struct tcb *sender, void *start, size_t length, int prot,
|
||||||
int flags, int fd, off_t offset);
|
int flags, int fd, off_t offset);
|
||||||
|
|
||||||
int sys_munmap(l4id_t sender, void *vaddr, unsigned long size);
|
int sys_munmap(struct tcb *sender, void *vaddr, unsigned long size);
|
||||||
|
|
||||||
struct sys_shmat_args {
|
struct sys_shmat_args {
|
||||||
l4id_t shmid;
|
l4id_t shmid;
|
||||||
@@ -33,8 +34,8 @@ struct sys_shmat_args {
|
|||||||
int shmflg;
|
int shmflg;
|
||||||
};
|
};
|
||||||
|
|
||||||
void *sys_shmat(l4id_t requester, l4id_t shmid, const void *shmaddr, int shmflg);
|
void *sys_shmat(struct tcb *requester, l4id_t shmid, const void *shmaddr, int shmflg);
|
||||||
int sys_shmdt(l4id_t requester, const void *shmaddr);
|
int sys_shmdt(struct tcb *requester, const void *shmaddr);
|
||||||
|
|
||||||
struct sys_shmget_args {
|
struct sys_shmget_args {
|
||||||
key_t key;
|
key_t key;
|
||||||
@@ -44,7 +45,7 @@ struct sys_shmget_args {
|
|||||||
|
|
||||||
int sys_shmget(key_t key, int size, int shmflg);
|
int sys_shmget(key_t key, int size, int shmflg);
|
||||||
|
|
||||||
int sys_fork(l4id_t parent);
|
int sys_fork(struct tcb *parent);
|
||||||
|
|
||||||
#endif /* __MM0_SYSARGS_H__ */
|
#endif /* __MM0_SYSARGS_H__ */
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ struct task_data_head {
|
|||||||
|
|
||||||
struct tcb *find_task(int tid);
|
struct tcb *find_task(int tid);
|
||||||
void task_add_global(struct tcb *t);
|
void task_add_global(struct tcb *t);
|
||||||
int send_task_data(l4id_t requester);
|
int send_task_data(struct tcb *requester);
|
||||||
void task_map_prefault_utcb(struct tcb *mapper, struct tcb *owner);
|
void task_map_prefault_utcb(struct tcb *mapper, struct tcb *owner);
|
||||||
int task_mmap_regions(struct tcb *task, struct vm_file *file);
|
int task_mmap_regions(struct tcb *task, struct vm_file *file);
|
||||||
int task_setup_regions(struct vm_file *file, struct tcb *task,
|
int task_setup_regions(struct vm_file *file, struct tcb *task,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ int utcb_pool_init(void);
|
|||||||
|
|
||||||
|
|
||||||
/* IPC to send utcb address information to tasks */
|
/* IPC to send utcb address information to tasks */
|
||||||
void *task_send_utcb_address(l4id_t sender, l4id_t taskid);
|
void *task_send_utcb_address(struct tcb *sender, l4id_t taskid);
|
||||||
|
|
||||||
/* Prefault an *mmaped* utcb */
|
/* Prefault an *mmaped* utcb */
|
||||||
int utcb_prefault(struct tcb *task, unsigned int vmflags);
|
int utcb_prefault(struct tcb *task, unsigned int vmflags);
|
||||||
|
|||||||
@@ -252,6 +252,6 @@ static inline void task_add_vma(struct tcb *task, struct vm_area *vma)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Main page fault entry point */
|
/* Main page fault entry point */
|
||||||
int page_fault_handler(l4id_t tid, fault_kdata_t *fkdata);
|
int page_fault_handler(struct tcb *faulty_task, fault_kdata_t *fkdata);
|
||||||
|
|
||||||
#endif /* __VM_AREA_H__ */
|
#endif /* __VM_AREA_H__ */
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <l4/api/thread.h>
|
#include <l4/api/thread.h>
|
||||||
#include <l4/api/space.h>
|
#include <l4/api/space.h>
|
||||||
#include <l4/api/ipc.h>
|
#include <l4/api/ipc.h>
|
||||||
|
#include <l4/api/errno.h>
|
||||||
#include <vm_area.h>
|
#include <vm_area.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
#include <file.h>
|
#include <file.h>
|
||||||
@@ -26,7 +27,8 @@ void handle_requests(void)
|
|||||||
{
|
{
|
||||||
/* Generic ipc data */
|
/* Generic ipc data */
|
||||||
u32 mr[MR_UNUSED_TOTAL];
|
u32 mr[MR_UNUSED_TOTAL];
|
||||||
l4id_t sender;
|
l4id_t senderid;
|
||||||
|
struct tcb *sender;
|
||||||
u32 tag;
|
u32 tag;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -39,7 +41,12 @@ void handle_requests(void)
|
|||||||
|
|
||||||
/* Syslib conventional ipc data which uses first few mrs. */
|
/* Syslib conventional ipc data which uses first few mrs. */
|
||||||
tag = l4_get_tag();
|
tag = l4_get_tag();
|
||||||
sender = l4_get_sender();
|
senderid = l4_get_sender();
|
||||||
|
|
||||||
|
if (!(sender = find_task(senderid))) {
|
||||||
|
l4_ipc_return(-ESRCH);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Read mrs not used by syslib */
|
/* Read mrs not used by syslib */
|
||||||
for (int i = 0; i < MR_UNUSED_TOTAL; i++)
|
for (int i = 0; i < MR_UNUSED_TOTAL; i++)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ int vfs_notify_fork(struct tcb *child, struct tcb *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int do_fork(struct tcb *parent)
|
int sys_fork(struct tcb *parent)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct tcb *child;
|
struct tcb *child;
|
||||||
@@ -111,23 +111,11 @@ int do_fork(struct tcb *parent)
|
|||||||
return child->tid;
|
return child->tid;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sys_fork(l4id_t sender)
|
int sys_clone(struct tcb *parent, void *child_stack, unsigned int flags)
|
||||||
{
|
|
||||||
struct tcb *parent;
|
|
||||||
|
|
||||||
if (!(parent = find_task(sender)))
|
|
||||||
return -ESRCH;
|
|
||||||
|
|
||||||
return do_fork(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
int sys_clone(l4id_t sender, void *child_stack, unsigned int flags)
|
|
||||||
{
|
{
|
||||||
struct task_ids ids;
|
struct task_ids ids;
|
||||||
struct vm_file *utcb_shm;
|
struct vm_file *utcb_shm;
|
||||||
struct tcb *parent, *child;
|
struct tcb *child;
|
||||||
|
|
||||||
BUG_ON(!(parent = find_task(sender)));
|
|
||||||
|
|
||||||
ids.tid = TASK_ID_INVALID;
|
ids.tid = TASK_ID_INVALID;
|
||||||
ids.spid = parent->spid;
|
ids.spid = parent->spid;
|
||||||
|
|||||||
@@ -681,19 +681,15 @@ int do_page_fault(struct fault_data *fault)
|
|||||||
return __do_page_fault(fault);
|
return __do_page_fault(fault);
|
||||||
}
|
}
|
||||||
|
|
||||||
int page_fault_handler(l4id_t sender, fault_kdata_t *fkdata)
|
int page_fault_handler(struct tcb *sender, fault_kdata_t *fkdata)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct fault_data fault = {
|
struct fault_data fault = {
|
||||||
/* Fault data from kernel */
|
/* Fault data from kernel */
|
||||||
.kdata = fkdata,
|
.kdata = fkdata,
|
||||||
|
.task = sender,
|
||||||
};
|
};
|
||||||
|
|
||||||
BUG_ON(sender == 0);
|
|
||||||
|
|
||||||
/* Get pager specific task info */
|
|
||||||
BUG_ON(!(fault.task = find_task(sender)));
|
|
||||||
|
|
||||||
/* Extract fault reason, fault address etc. in generic format */
|
/* Extract fault reason, fault address etc. in generic format */
|
||||||
set_generic_fault_params(&fault);
|
set_generic_fault_params(&fault);
|
||||||
|
|
||||||
|
|||||||
@@ -403,13 +403,9 @@ int do_close(struct tcb *task, int fd)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sys_close(l4id_t sender, int fd)
|
int sys_close(struct tcb *task, int fd)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct tcb *task;
|
|
||||||
|
|
||||||
if (!(task = find_task(sender)))
|
|
||||||
return -ESRCH;
|
|
||||||
|
|
||||||
/* Sync the file and update stats */
|
/* Sync the file and update stats */
|
||||||
if ((ret = fsync_common(task, fd)) < 0)
|
if ((ret = fsync_common(task, fd)) < 0)
|
||||||
@@ -419,13 +415,8 @@ int sys_close(l4id_t sender, int fd)
|
|||||||
return do_close(task, fd);
|
return do_close(task, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sys_fsync(l4id_t sender, int fd)
|
int sys_fsync(struct tcb *task, int fd)
|
||||||
{
|
{
|
||||||
struct tcb *task;
|
|
||||||
|
|
||||||
if (!(task = find_task(sender)))
|
|
||||||
return -ESRCH;
|
|
||||||
|
|
||||||
/* Sync the file and update stats */
|
/* Sync the file and update stats */
|
||||||
return fsync_common(task, fd);
|
return fsync_common(task, fd);
|
||||||
}
|
}
|
||||||
@@ -586,17 +577,13 @@ copy:
|
|||||||
return count - left;
|
return count - left;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sys_read(l4id_t sender, int fd, void *buf, int count)
|
int sys_read(struct tcb *task, int fd, void *buf, int count)
|
||||||
{
|
{
|
||||||
unsigned long pfn_start, pfn_end;
|
unsigned long pfn_start, pfn_end;
|
||||||
unsigned long cursor, byte_offset;
|
unsigned long cursor, byte_offset;
|
||||||
struct vm_file *vmfile;
|
struct vm_file *vmfile;
|
||||||
struct tcb *task;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!(task = find_task(sender)))
|
|
||||||
return -ESRCH;
|
|
||||||
|
|
||||||
/* Check fd validity */
|
/* Check fd validity */
|
||||||
if (!task->files->fd[fd].vmfile)
|
if (!task->files->fd[fd].vmfile)
|
||||||
if ((ret = file_open(task, fd)) < 0)
|
if ((ret = file_open(task, fd)) < 0)
|
||||||
@@ -658,19 +645,15 @@ int sys_read(l4id_t sender, int fd, void *buf, int count)
|
|||||||
* We find the page buffer is in, and then copy from the *start* of the page
|
* We find the page buffer is in, and then copy from the *start* of the page
|
||||||
* rather than buffer's offset in that page.
|
* rather than buffer's offset in that page.
|
||||||
*/
|
*/
|
||||||
int sys_write(l4id_t sender, int fd, void *buf, int count)
|
int sys_write(struct tcb *task, int fd, void *buf, int count)
|
||||||
{
|
{
|
||||||
unsigned long pfn_wstart, pfn_wend; /* Write start/end */
|
unsigned long pfn_wstart, pfn_wend; /* Write start/end */
|
||||||
unsigned long pfn_fstart, pfn_fend; /* File start/end */
|
unsigned long pfn_fstart, pfn_fend; /* File start/end */
|
||||||
unsigned long pfn_nstart, pfn_nend; /* New pages start/end */
|
unsigned long pfn_nstart, pfn_nend; /* New pages start/end */
|
||||||
unsigned long cursor, byte_offset;
|
unsigned long cursor, byte_offset;
|
||||||
struct vm_file *vmfile;
|
struct vm_file *vmfile;
|
||||||
struct tcb *task;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!(task = find_task(sender)))
|
|
||||||
return -ESRCH;
|
|
||||||
|
|
||||||
/* Check fd validity */
|
/* Check fd validity */
|
||||||
if (!task->files->fd[fd].vmfile)
|
if (!task->files->fd[fd].vmfile)
|
||||||
if ((ret = file_open(task, fd)) < 0)
|
if ((ret = file_open(task, fd)) < 0)
|
||||||
@@ -766,15 +749,11 @@ int sys_write(l4id_t sender, int fd, void *buf, int count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Check for invalid cursor values. Check for total, sometimes negative. */
|
/* FIXME: Check for invalid cursor values. Check for total, sometimes negative. */
|
||||||
int sys_lseek(l4id_t sender, int fd, off_t offset, int whence)
|
int sys_lseek(struct tcb *task, int fd, off_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct tcb *task;
|
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
unsigned long long total, cursor;
|
unsigned long long total, cursor;
|
||||||
|
|
||||||
if (!(task = find_task(sender)))
|
|
||||||
return -ESRCH;
|
|
||||||
|
|
||||||
/* Check fd validity */
|
/* Check fd validity */
|
||||||
if (!task->files->fd[fd].vmfile)
|
if (!task->files->fd[fd].vmfile)
|
||||||
if ((retval = file_open(task, fd)) < 0)
|
if ((retval = file_open(task, fd)) < 0)
|
||||||
|
|||||||
@@ -582,19 +582,15 @@ void *do_mmap(struct vm_file *mapfile, unsigned long file_offset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* mmap system call implementation */
|
/* mmap system call implementation */
|
||||||
void *sys_mmap(l4id_t sender, void *start, size_t length, int prot,
|
void *sys_mmap(struct tcb *task, void *start, size_t length, int prot,
|
||||||
int flags, int fd, unsigned long pfn)
|
int flags, int fd, unsigned long pfn)
|
||||||
{
|
{
|
||||||
unsigned long npages = __pfn(page_align_up(length));
|
unsigned long npages = __pfn(page_align_up(length));
|
||||||
unsigned long base = (unsigned long)start;
|
unsigned long base = (unsigned long)start;
|
||||||
struct vm_file *file = 0;
|
struct vm_file *file = 0;
|
||||||
unsigned int vmflags = 0;
|
unsigned int vmflags = 0;
|
||||||
struct tcb *task;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!(task = find_task(sender)))
|
|
||||||
return PTR_ERR(-ESRCH);
|
|
||||||
|
|
||||||
/* Check fd validity */
|
/* Check fd validity */
|
||||||
if (!(flags & MAP_ANONYMOUS))
|
if (!(flags & MAP_ANONYMOUS))
|
||||||
if (!task->files->fd[fd].vmfile)
|
if (!task->files->fd[fd].vmfile)
|
||||||
@@ -647,7 +643,7 @@ void *sys_mmap(l4id_t sender, void *start, size_t length, int prot,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Sets the end of data segment for sender */
|
/* Sets the end of data segment for sender */
|
||||||
int sys_brk(l4id_t sender, void *ds_end)
|
int sys_brk(struct tcb *sender, void *ds_end)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,10 +119,9 @@ static void *do_shmat(struct vm_file *shm_file, void *shm_addr, int shmflg,
|
|||||||
utcb_prefault(task, VM_READ | VM_WRITE);
|
utcb_prefault(task, VM_READ | VM_WRITE);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void *sys_shmat(l4id_t requester, l4id_t shmid, void *shmaddr, int shmflg)
|
void *sys_shmat(struct tcb *task, l4id_t shmid, void *shmaddr, int shmflg)
|
||||||
{
|
{
|
||||||
struct vm_file *shm_file, *n;
|
struct vm_file *shm_file, *n;
|
||||||
struct tcb *task = find_task(requester);
|
|
||||||
|
|
||||||
list_for_each_entry_safe(shm_file, n, &shm_file_list, list) {
|
list_for_each_entry_safe(shm_file, n, &shm_file_list, list) {
|
||||||
if (shm_file_to_desc(shm_file)->shmid == shmid)
|
if (shm_file_to_desc(shm_file)->shmid == shmid)
|
||||||
@@ -133,34 +132,26 @@ void *sys_shmat(l4id_t requester, l4id_t shmid, void *shmaddr, int shmflg)
|
|||||||
return PTR_ERR(-EINVAL);
|
return PTR_ERR(-EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int do_shmdt(struct vm_file *shm, l4id_t tid)
|
int do_shmdt(struct tcb *task, struct vm_file *shm)
|
||||||
{
|
{
|
||||||
struct tcb *task = find_task(tid);
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!task) {
|
|
||||||
printf("%s:%s: Internal error. Cannot find task with tid %d\n",
|
|
||||||
__TASKNAME__, __FUNCTION__, tid);
|
|
||||||
BUG();
|
|
||||||
}
|
|
||||||
if ((err = do_munmap(shm_file_to_desc(shm)->shm_addr,
|
if ((err = do_munmap(shm_file_to_desc(shm)->shm_addr,
|
||||||
shm_file_to_desc(shm)->npages, task)) < 0) {
|
shm_file_to_desc(shm)->npages,
|
||||||
printf("do_munmap: Unmapping shm segment failed with %d.\n",
|
task)) < 0)
|
||||||
err);
|
return err;
|
||||||
BUG();
|
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sys_shmdt(l4id_t requester, const void *shmaddr)
|
int sys_shmdt(struct tcb *task, const void *shmaddr)
|
||||||
{
|
{
|
||||||
struct vm_file *shm_file, *n;
|
struct vm_file *shm_file, *n;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
list_for_each_entry_safe(shm_file, n, &shm_file_list, list) {
|
list_for_each_entry_safe(shm_file, n, &shm_file_list, list) {
|
||||||
if (shm_file_to_desc(shm_file)->shm_addr == shmaddr) {
|
if (shm_file_to_desc(shm_file)->shm_addr == shmaddr) {
|
||||||
if ((err = do_shmdt(shm_file, requester) < 0))
|
if ((err = do_shmdt(task, shm_file) < 0))
|
||||||
return err;
|
return err;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -436,20 +436,19 @@ void task_map_prefault_utcb(struct tcb *mapper, struct tcb *owner)
|
|||||||
* are running, and their tids, which includes itself. This function
|
* are running, and their tids, which includes itself. This function
|
||||||
* provides that information.
|
* provides that information.
|
||||||
*/
|
*/
|
||||||
int send_task_data(l4id_t requester)
|
int send_task_data(struct tcb *vfs)
|
||||||
{
|
{
|
||||||
int li = 0;
|
int li = 0;
|
||||||
struct tcb *t, *vfs, *self;
|
struct tcb *t, *self;
|
||||||
struct task_data_head *tdata_head;
|
struct task_data_head *tdata_head;
|
||||||
|
|
||||||
if (requester != VFS_TID) {
|
if (vfs->tid != VFS_TID) {
|
||||||
printf("%s: Task data requested by %d, which is not "
|
printf("%s: Task data requested by %d, which is not "
|
||||||
"FS0 id %d, ignoring.\n", __TASKNAME__, requester,
|
"FS0 id %d, ignoring.\n", __TASKNAME__, vfs->tid,
|
||||||
VFS_TID);
|
VFS_TID);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BUG_ON(!(vfs = find_task(requester)));
|
|
||||||
BUG_ON(!(self = find_task(self_tid())));
|
BUG_ON(!(self = find_task(self_tid())));
|
||||||
BUG_ON(!vfs->utcb);
|
BUG_ON(!vfs->utcb);
|
||||||
|
|
||||||
|
|||||||
@@ -39,17 +39,13 @@ void *utcb_vaddr_new(void)
|
|||||||
* for its own. The requester then uses this address as a shm key and
|
* for its own. The requester then uses this address as a shm key and
|
||||||
* maps its own utcb via shmget/shmat.
|
* maps its own utcb via shmget/shmat.
|
||||||
*/
|
*/
|
||||||
void *task_send_utcb_address(l4id_t sender, l4id_t taskid)
|
void *task_send_utcb_address(struct tcb *sender, l4id_t taskid)
|
||||||
{
|
{
|
||||||
struct tcb *task = find_task(taskid);
|
struct tcb *task = find_task(taskid);
|
||||||
|
|
||||||
/* Is the task asking for its own utcb address */
|
/* Is the task asking for its own utcb address */
|
||||||
if (sender == taskid) {
|
if (sender->tid == taskid) {
|
||||||
/*
|
/* It hasn't got one allocated. */
|
||||||
* It hasn't got one allocated. We allocate one here,
|
|
||||||
* but only because the requester is requesting for its
|
|
||||||
* own utcb.
|
|
||||||
*/
|
|
||||||
BUG_ON(!task->utcb);
|
BUG_ON(!task->utcb);
|
||||||
|
|
||||||
/* Return it to requester */
|
/* Return it to requester */
|
||||||
@@ -58,7 +54,7 @@ void *task_send_utcb_address(l4id_t sender, l4id_t taskid)
|
|||||||
/* A task is asking for someone else's utcb */
|
/* A task is asking for someone else's utcb */
|
||||||
} else {
|
} else {
|
||||||
/* Only vfs is allowed to do so yet, because its a server */
|
/* Only vfs is allowed to do so yet, because its a server */
|
||||||
if (sender == VFS_TID) {
|
if (sender->tid == VFS_TID) {
|
||||||
/*
|
/*
|
||||||
* Return utcb address to requester. Note if there's
|
* Return utcb address to requester. Note if there's
|
||||||
* none allocated so far, requester gets 0. We don't
|
* none allocated so far, requester gets 0. We don't
|
||||||
|
|||||||
Reference in New Issue
Block a user