mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
l4_unmap now returns -1 if given range was only partially unmapped. do_munmap() now only unmaps address ranges that have correspondence in the unmapped vmas. Trying to unmap regions with no correspondent vmas causes problems in corner cases, e.g. mm0 that tries to mmap its own address space during initialisation would unmap its whole address space and fail to execute.
36 lines
928 B
C
36 lines
928 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
|
|
#define MAP_GROWSDOWN 0x00100
|
|
|
|
struct vm_area *vma_new(unsigned long pfn_start, unsigned long npages,
|
|
unsigned int flags, unsigned long file_offset);
|
|
|
|
int do_munmap(struct tcb *task, unsigned long vaddr, unsigned long size);
|
|
|
|
void *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__ */
|