Files
codezero/tasks/mm0/include/mmap.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

32 lines
763 B
C

/*
* Prototypes for mmap/munmap functions that do the actual work.
*
* Copyright (C) 2007 Bahadir Balban
*/
#ifndef __MM0_MMAP_H__
#define __MM0_MMAP_H__
#include <task.h>
#include <vm_area.h>
/* POSIX-defined mmap flags */
#define PROT_READ 0x1
#define PROT_WRITE 0x2
#define PROT_EXEC 0x4
#define PROT_NONE 0x0
#define MAP_ANONYMOUS 0x20
#define MAP_FIXED 0x10
#define MAP_SHARED 0x01
#define MAP_PRIVATE 0x02
int do_munmap(void *vaddr, unsigned long size, struct tcb *task);
int do_mmap(struct vm_file *mapfile, unsigned long f_offset, struct tcb *t,
unsigned long map_address, unsigned int flags, unsigned int pages);
int mmap_address_validate(struct tcb *t, unsigned long map_address,
unsigned int vm_flags);
#endif /* __MM0_MMAP_H__ */