mirror of
https://github.com/drasko/codezero.git
synced 2026-09-28 08:10:21 +02:00
Added vfs_read and vfs_write ipc calls to mm0
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
#define L4SYS_ARG0 (MR_UNUSED_START)
|
#define L4SYS_ARG0 (MR_UNUSED_START)
|
||||||
#define L4SYS_ARG1 (MR_UNUSED_START + 1)
|
#define L4SYS_ARG1 (MR_UNUSED_START + 1)
|
||||||
#define L4SYS_ARG2 (MR_UNUSED_START + 2)
|
#define L4SYS_ARG2 (MR_UNUSED_START + 2)
|
||||||
|
#define L4SYS_ARG3 (MR_UNUSED_START + 3)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Servers get sender.
|
* Servers get sender.
|
||||||
|
|||||||
+40
-3
@@ -9,6 +9,7 @@
|
|||||||
#include <l4lib/types.h>
|
#include <l4lib/types.h>
|
||||||
#include <l4lib/arch/syscalls.h>
|
#include <l4lib/arch/syscalls.h>
|
||||||
#include <l4lib/arch/syslib.h>
|
#include <l4lib/arch/syslib.h>
|
||||||
|
#include <l4lib/ipcdefs.h>
|
||||||
#include <l4/api/kip.h>
|
#include <l4/api/kip.h>
|
||||||
#include <posix/sys/types.h>
|
#include <posix/sys/types.h>
|
||||||
#include <string.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,
|
int vfs_read(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_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,
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user