Added vfs_read and vfs_write ipc calls to mm0

This commit is contained in:
Bahadir Balban
2008-02-18 22:42:33 +00:00
parent c5713ae37d
commit a160f6f151
2 changed files with 41 additions and 3 deletions

View File

@@ -28,6 +28,7 @@
#define L4SYS_ARG0 (MR_UNUSED_START)
#define L4SYS_ARG1 (MR_UNUSED_START + 1)
#define L4SYS_ARG2 (MR_UNUSED_START + 2)
#define L4SYS_ARG3 (MR_UNUSED_START + 3)
/*
* Servers get sender.

View File

@@ -9,6 +9,7 @@
#include <l4lib/types.h>
#include <l4lib/arch/syscalls.h>
#include <l4lib/arch/syslib.h>
#include <l4lib/ipcdefs.h>
#include <l4/api/kip.h>
#include <posix/sys/types.h>
#include <string.h>
@@ -38,13 +39,49 @@ void vmfile_init(void)
int vfs_read(unsigned long vnum, unsigned long f_offset, unsigned long npages,
void *pagebuf)
{
return 0;
int err;
write_mr(L4SYS_ARG0, vnum);
write_mr(L4SYS_ARG1, f_offset);
write_mr(L4SYS_ARG2, npages);
write_mr(L4SYS_ARG3, (u32)pagebuf);
if ((err = l4_sendrecv(VFS_TID, VFS_TID, L4_IPC_TAG_READ)) < 0) {
printf("%s: L4 IPC Error: %d.\n", __FUNCTION__, err);
return err;
}
/* Check if syscall was successful */
if ((err = l4_get_retval()) < 0) {
printf("%s: Pager from VFS read error: %d.\n", __FUNCTION__, err);
return err;
}
return err;
}
int vfs_write(unsigned long vnum, unsigned long f_offset, unsigned long npages,
void *pagebuf)
void *pagebuf)
{
return 0;
int err;
write_mr(L4SYS_ARG0, vnum);
write_mr(L4SYS_ARG1, f_offset);
write_mr(L4SYS_ARG2, npages);
write_mr(L4SYS_ARG3, (u32)pagebuf);
if ((err = l4_sendrecv(VFS_TID, VFS_TID, L4_IPC_TAG_WRITE)) < 0) {
printf("%s: L4 IPC Error: %d.\n", __FUNCTION__, err);
return err;
}
/* Check if syscall was successful */
if ((err = l4_get_retval()) < 0) {
printf("%s: Pager to VFS write error: %d.\n", __FUNCTION__, err);
return err;
}
return err;
}
/*