--- Gnu-Mach/vm/vm_map.h 2020/09/02 04:50:03 1.1.1.5 +++ Gnu-Mach/vm/vm_map.h 2020/09/02 04:54:15 1.1.1.7 @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -105,9 +106,17 @@ struct vm_map_entry { #define vme_start links.start #define vme_end links.end struct rbtree_node tree_node; /* links to other entries in tree */ + struct rbtree_node gap_node; /* links to other entries in gap tree */ + struct list gap_list; /* links to other entries with + the same gap size */ + vm_size_t gap_size; /* size of available memory + following this entry */ union vm_map_object object; /* object I point to */ vm_offset_t offset; /* offset into object */ unsigned int + /* boolean_t */ in_gap_tree:1, /* entry is in the gap tree if true, + or linked to other entries with + the same gap size if false */ /* boolean_t */ is_shared:1, /* region is shared */ /* boolean_t */ is_sub_map:1, /* Is "object" a submap? */ /* boolean_t */ in_transition:1, /* Entry being changed */ @@ -141,9 +150,9 @@ typedef struct vm_map_entry *vm_map_entr struct vm_map_header { struct vm_map_links links; /* first, last, min, max */ struct rbtree tree; /* Sorted tree of entries */ + struct rbtree gap_tree; /* Sorted tree of gap lists + for allocations */ int nentries; /* Number of entries */ - boolean_t entries_pageable; - /* are map entries pageable? */ }; /* @@ -183,6 +192,8 @@ struct vm_map { /* boolean_t */ wiring_required:1; /* All memory wired? */ unsigned int timestamp; /* Version number */ + + const char *name; /* Associated name */ }; #define vm_map_to_entry(map) ((struct vm_map_entry *) &(map)->hdr.links) @@ -341,13 +352,9 @@ MACRO_BEGIN \ (map)->timestamp = 0; \ MACRO_END -#define vm_map_lock(map) \ -MACRO_BEGIN \ - lock_write(&(map)->lock); \ - (map)->timestamp++; \ -MACRO_END +void vm_map_lock(struct vm_map *map); +void vm_map_unlock(struct vm_map *map); -#define vm_map_unlock(map) lock_write_done(&(map)->lock) #define vm_map_lock_read(map) lock_read(&(map)->lock) #define vm_map_unlock_read(map) lock_read_done(&(map)->lock) #define vm_map_lock_write_to_read(map) \ @@ -363,18 +370,13 @@ MACRO_END * Exported procedures that operate on vm_map_t. */ -extern vm_offset_t kentry_data; -extern vm_size_t kentry_data_size; -extern int kentry_count; /* Initialize the module */ extern void vm_map_init(void); /* Initialize an empty map */ -extern void vm_map_setup(vm_map_t, pmap_t, vm_offset_t, vm_offset_t, - boolean_t); +extern void vm_map_setup(vm_map_t, pmap_t, vm_offset_t, vm_offset_t); /* Create an empty map */ -extern vm_map_t vm_map_create(pmap_t, vm_offset_t, vm_offset_t, - boolean_t); +extern vm_map_t vm_map_create(pmap_t, vm_offset_t, vm_offset_t); /* Create a map in the image of an existing map */ extern vm_map_t vm_map_fork(vm_map_t); @@ -458,6 +460,12 @@ boolean_t vm_map_lookup_entry( vm_offset_t address, vm_map_entry_t *entry); /* OUT */ +static inline void vm_map_set_name(vm_map_t map, const char *name) +{ + map->name = name; +} + + /* * Functions implemented as macros */