mirror of
https://github.com/drasko/codezero.git
synced 2026-02-17 12:23:16 +01:00
Added copy-on-write shared memory but untested yet.
For anonymous shm, mmap now adds a shm_file and devzero behind it as two vm_objects. Faults are handled by copy_on_write(). Just as shadows copy r/w pages from original files, it should copy r/w pages from devzero into the shm_file in front. shmat/shmget uses mmap to set-up their areas. Untested yet so bugs expected. modified: tasks/libl4/src/init.c modified: tasks/mm0/include/shm.h modified: tasks/mm0/include/vm_area.h modified: tasks/mm0/src/fault.c modified: tasks/mm0/src/mmap.c modified: tasks/mm0/src/shm.c
This commit is contained in:
@@ -1,11 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Bahadir Balban
|
||||
*/
|
||||
#ifndef __SHM_H__
|
||||
#define __SHM_H__
|
||||
|
||||
#include <l4/api/space.h>
|
||||
#include <l4/lib/list.h>
|
||||
#include <l4/api/space.h>
|
||||
#include <l4/macros.h>
|
||||
#include <l4lib/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 */
|
||||
@@ -16,12 +28,13 @@ struct shm_descriptor {
|
||||
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 (PAGE_SIZE * 10)
|
||||
#define SHM_SHMMAX 10
|
||||
|
||||
/* Initialises shared memory bookkeeping structures */
|
||||
void shm_init();
|
||||
|
||||
@@ -42,6 +42,7 @@ enum VM_FILE_TYPE {
|
||||
VM_FILE_DEVZERO = 1,
|
||||
VM_FILE_REGULAR,
|
||||
VM_FILE_BOOTFILE,
|
||||
VM_FILE_SHM,
|
||||
};
|
||||
|
||||
/* Defines the type of object. A file? Just a standalone object? */
|
||||
|
||||
Reference in New Issue
Block a user