Annotation of prex-old/sys/include/vm.h, Revision 1.1
1.1 ! nbrk 1: /*-
! 2: * Copyright (c) 2005-2007, Kohsuke Ohtani
! 3: * All rights reserved.
! 4: *
! 5: * Redistribution and use in source and binary forms, with or without
! 6: * modification, are permitted provided that the following conditions
! 7: * are met:
! 8: * 1. Redistributions of source code must retain the above copyright
! 9: * notice, this list of conditions and the following disclaimer.
! 10: * 2. Redistributions in binary form must reproduce the above copyright
! 11: * notice, this list of conditions and the following disclaimer in the
! 12: * documentation and/or other materials provided with the distribution.
! 13: * 3. Neither the name of the author nor the names of any co-contributors
! 14: * may be used to endorse or promote products derived from this software
! 15: * without specific prior written permission.
! 16: *
! 17: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
! 18: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 19: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 20: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
! 21: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 22: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 23: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 24: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 25: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 26: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 27: * SUCH DAMAGE.
! 28: */
! 29:
! 30: #ifndef _VM_H
! 31: #define _VM_H
! 32:
! 33: #include <arch.h>
! 34:
! 35: /*
! 36: * One structure per allocated region.
! 37: */
! 38: struct region {
! 39: struct region *prev; /* region list sorted by address */
! 40: struct region *next;
! 41: struct region *sh_prev; /* link for all shared region */
! 42: struct region *sh_next;
! 43: u_long addr; /* base address */
! 44: size_t size; /* size */
! 45: int flags; /* flag */
! 46: #ifdef CONFIG_MMU
! 47: u_long phys; /* physical address */
! 48: #endif
! 49: };
! 50:
! 51: /* Flags for region */
! 52: #define REG_READ 0x00000001
! 53: #define REG_WRITE 0x00000002
! 54: #define REG_EXEC 0x00000004
! 55: #define REG_SHARED 0x00000008
! 56: #define REG_MAPPED 0x00000010
! 57: #define REG_FREE 0x00000080
! 58:
! 59: /*
! 60: * VM mapping per one task.
! 61: */
! 62: struct vm_map {
! 63: struct region head; /* list head of regions */
! 64: int ref_count; /* reference count */
! 65: pgd_t pgd; /* page directory */
! 66: };
! 67:
! 68: /* VM attributes */
! 69: #define VMA_READ 0x01
! 70: #define VMA_WRITE 0x02
! 71: #define VMA_EXEC 0x04
! 72:
! 73: extern int vm_allocate(task_t, void **, size_t, int);
! 74: extern int vm_free(task_t, void *);
! 75: extern int vm_attribute(task_t, void *, int);
! 76: extern int vm_map(task_t, void *, size_t, void **);
! 77: extern vm_map_t vm_fork(vm_map_t);
! 78: extern vm_map_t vm_create(void);
! 79: extern int vm_reference(vm_map_t);
! 80: extern void vm_terminate(vm_map_t);
! 81: extern void vm_switch(vm_map_t);
! 82: extern int vm_load(vm_map_t, struct module *, void **);
! 83: extern void *vm_translate(void *, size_t);
! 84: extern int vm_access(void *, size_t, int);
! 85: extern void vm_dump(void);
! 86: extern void vm_init(void);
! 87:
! 88: #endif /* !_VM_H */
CVSweb