os_readdir() now using utcb as dirent buffer.

This commit is contained in:
Bahadir Balban
2008-04-13 16:32:34 +01:00
parent 2efffdfa88
commit 7b2f9f96cf
11 changed files with 46 additions and 21 deletions

View File

@@ -18,23 +18,12 @@
#include <l4/macros.h>
#include INC_GLUE(memory.h)
/*
* Arguments that are too large to fit in message registers are
* copied onto another area that is still on the utcb, and the servers
* map-in the task utcb and read those arguments from there.
*/
void *copy_to_utcb(void *arg, int size)
{
BUG_ON(size > PAGE_SIZE);
memcpy(utcb_page, arg, size);
}
static inline int l4_open(const char *pathname, int flags, mode_t mode)
{
int fd;
// write_mr(L4SYS_ARG0, (unsigned long)pathname);
copy_to_utcb((void *)pathname, strlen(pathname));
copy_to_utcb((void *)pathname, 0, strlen(pathname));
write_mr(L4SYS_ARG0, (unsigned long)utcb_page);
write_mr(L4SYS_ARG1, flags);
write_mr(L4SYS_ARG2, (u32)mode);

View File

@@ -5,19 +5,23 @@
*/
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <l4lib/arch/syscalls.h>
#include <l4lib/arch/syslib.h>
#include <l4lib/ipcdefs.h>
#include <l4lib/os/posix/readdir.h>
#include <l4/macros.h>
#include INC_GLUE(memory.h)
static inline int l4_readdir(int fd, void *buf, size_t count)
{
size_t cnt;
write_mr(L4SYS_ARG0, fd);
write_mr(L4SYS_ARG1, (unsigned long)buf);
write_mr(L4SYS_ARG1, (unsigned long)utcb_page);
write_mr(L4SYS_ARG2, count);
/* Call pager with readdir() request. Check ipc error. */
@@ -31,6 +35,8 @@ static inline int l4_readdir(int fd, void *buf, size_t count)
return cnt;
}
copy_from_utcb(buf, 0, cnt);
return cnt;
}