Files
codezero/tasks/mm0/include/shm.h
Bahadir Balban 35d2d275b6 Multiple above-minor updates.
- fixed is_err(x), was evaluating x twice, resulting in calling a
function x twice.

- Divided task initialisation into multiple parts.
- MM0 now creates a tcb for itself and maintains memory regions of its own.
- MM0's tcb is used for mmapping other tasks' regions. MM0 mmaps and prefaults
  those regions, instead of the typical mmap() and fault approach used by
  non-pager tasks.
  For example there's an internal shmget_shmat() path to map in other tasks'
  shm utcbs. Those mappings are then prefaulted into mm0's address space using
  the default fault handling path.

- FS0 now reads task data into its utcb from mm0 via a syscall.
  FS0 shmat()s to utcbs of other tasks, e.g. mm0 and test0.

  FS0 then crashes, that is to be fixed and where this commit is left last.
2008-03-24 00:34:14 +00:00

50 lines
1.1 KiB
C

/*
* Copyright (C) 2008 Bahadir Balban
*/
#ifndef __SHM_H__
#define __SHM_H__
#include <l4/lib/list.h>
#include <l4/api/space.h>
#include <l4/macros.h>
#include <l4lib/types.h>
#include <task.h>
#include <posix/sys/ipc.h>
#include <posix/sys/shm.h>
#include <posix/sys/types.h>
struct shm_descriptor {
int key;
l4id_t shmid;
void *shm_addr;
unsigned long npages;
struct vm_file *devzero;
};
#if 0
struct shm_descriptor {
int key; /* IPC key supplied by user task */
l4id_t shmid; /* SHM area id, allocated by mm0 */
struct list_head list; /* SHM list, used by mm0 */
struct vm_file *owner;
void *shm_addr; /* The virtual address for segment. */
unsigned long size; /* Size of the area in pages */
unsigned int flags;
int refcnt;
};
#endif
#define SHM_AREA_MAX 64 /* Up to 64 shm areas */
/* Up to 10 pages per area, and at least 1 byte (implies 1 page) */
#define SHM_SHMMIN 1
#define SHM_SHMMAX 10
/* Initialises shared memory bookkeeping structures */
void shm_init();
void *shmat_shmget_internal(key_t key, void *shmaddr);
struct vm_file *shm_new(key_t key, unsigned long npages);
#endif /* __SHM_H__ */