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

Subversion Repositories c0or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * Copyright (C) 2008 Bahadir Balban
3
 */
4
#ifndef __SHM_H__
5
#define __SHM_H__
6
 
7
#include <l4/lib/list.h>
8
#include <l4/api/space.h>
9
#include <l4/macros.h>
10
#include <l4lib/types.h>
11
#include <task.h>
12
#include <posix/sys/ipc.h>
13
#include <posix/sys/shm.h>
14
#include <posix/sys/types.h>
15
 
16
struct shm_descriptor {
17
        int key;
18
        l4id_t shmid;
19
        void *shm_addr;
20
        unsigned long npages;
21
        struct vm_file *devzero;
22
};
23
 
24
#if 0
25
struct shm_descriptor {
26
        int key;                        /* IPC key supplied by user task */
27
        l4id_t shmid;                   /* SHM area id, allocated by mm0 */
28
        struct link list;               /* SHM list, used by mm0 */
29
        struct vm_file *owner;
30
        void *shm_addr;                 /* The virtual address for segment. */
31
        unsigned long size;             /* Size of the area in pages */
32
        unsigned int flags;
33
        int refcnt;
34
};
35
#endif
36
 
37
#define SHM_AREA_MAX                    64      /* Up to 64 shm areas */
38
 
39
/* Up to 10 pages per area, and at least 1 byte (implies 1 page) */
40
#define SHM_SHMMIN                      1
41
#define SHM_SHMMAX                      10
42
 
43
/* Initialises shared memory bookkeeping structures */
44
int shm_pool_init();
45
 
46
void *shmat_shmget_internal(struct tcb *task, key_t key, void *shmaddr);
47
struct vm_file *shm_new(key_t key, unsigned long npages);
48
void *shm_new_address(int npages);
49
 
50
 
51
/* Below is the special-case per-task default shared memory page prototypes */
52
 
53
/* Prefaults shared page after mapping */
54
#define SHPAGE_PREFAULT         (1 << 0)
55
 
56
/* Creates new shm segment for default shpage */
57
#define SHPAGE_NEW_SHM          (1 << 1)
58
 
59
/* Allocates a virtual address for default shpage */
60
#define SHPAGE_NEW_ADDRESS      (1 << 2)
61
 
62
/* IPC to send utcb address information to tasks */
63
void *task_send_shpage_address(struct tcb *sender, l4id_t taskid);
64
 
65
int shpage_map_to_task(struct tcb *owner, struct tcb *mapper, unsigned int flags);
66
int shpage_unmap_from_task(struct tcb *owner, struct tcb *mapper);
67
 
68
/* Prefault a *mmaped* default shared page */
69
int shpage_prefault(struct tcb *task, unsigned int vmflags);
70
 
71
#endif /* __SHM_H__ */

powered by: WebSVN 2.1.0

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