View of xos/mm/map_struct.h


XOS | Parent Directory | View | Download

/* Copyright (C) 2008  Emmanuel Varoquaux
 
   This file is part of XOS.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
#ifndef MAP_STRUCT_H
#define MAP_STRUCT_H
 
/* Segments */
 
struct segment_struct {
  unsigned long start;
  unsigned long end;
};
 
/* Projections */
 
struct map_struct;
struct map_info_struct;
 
struct map_operations_struct {
  void (*do_destroy)(struct map_struct *);
  void (*do_clone)(const struct map_struct *, struct map_struct *);
  int (*do_is_mergeable)(const struct map_struct *, const struct map_struct *);
  void (*do_merge)(struct map_struct *, struct map_struct *);
  void (*do_grow_down)(struct map_struct *);
 
  int (*do_fill_page)(const struct map_struct *, unsigned long);
  unsigned long (*do_get_clean_page_frame)(const struct map_struct *, unsigned long);
  void (*do_set_clean_page_frame)(const struct map_struct *, unsigned long, unsigned long);
  void (*do_dirty_page)(const struct map_struct *, unsigned long, unsigned long);
  int (*do_get_info)(const struct map_struct *, struct map_info_struct *);
};
 
/* segment de memoire lineaire */
struct map_struct {
  struct segment_struct segment;
  int prot;
  int grows_down;
  const struct map_operations_struct *operations;
  union {
    struct { /* mem_map */
      void *mem_start;
    };
    struct { /* anon_map */
      const char *name;
    };
    struct { /* file_map */
      struct file_struct *file;
      unsigned long offset;
    };
  };
 
  struct map_struct *previous;
  struct map_struct *next;
};
 
#endif