OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [posix/] [libposix/] [include/] [posix/] [shpage.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * A default shared page is used by every thread
3
 * to pass large data for system calls.
4
 *
5
 * This file contains relevant shpage definitions.
6
 */
7
#ifndef __LIBPOSIX_SHPAGE_H__
8
#define __LIBPOSIX_SHPAGE_H__
9
 
10
#include <l4/macros.h>
11
#include <l4lib/ipcdefs.h>
12
#include <l4lib/utcb.h>
13
#include INC_GLUE(memory.h)
14
#include L4LIB_INC_ARCH(syscalls.h)
15
#include L4LIB_INC_ARCH(syslib.h)
16
 
17
extern void *shared_page;
18
 
19
int shared_page_init(void);
20
 
21
/*
22
 * Arguments that are too large to fit in message registers are
23
 * copied onto another area that is still on the utcb, and the servers
24
 * map-in the task utcb and read those arguments from there.
25
 */
26
 
27
static inline int copy_to_shpage(void *arg, int offset, int size)
28
{
29
        if (offset + size > PAGE_SIZE)
30
                return -1;
31
 
32
        memcpy(shared_page + offset, arg, size);
33
        return 0;
34
}
35
 
36
static inline int copy_from_shpage(void *buf, int offset, int size)
37
{
38
        if (offset + size > PAGE_SIZE)
39
                return -1;
40
 
41
        memcpy(buf, shared_page + offset, size);
42
        return 0;
43
}
44
 
45
#endif /* __LIBPOSIX_SHPAGE_H__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.