diff options
author | Richard Braun <rbraun@sceen.net> | 2016-12-24 01:30:22 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2016-12-24 01:30:22 +0100 |
commit | 023401c5b97023670a44059a60eb2a3a11c8a929 (patch) | |
tree | 9e4fc6286d8545275dab9ba2140bb98bf7ab19b5 /vm/vm_map.h | |
parent | eb07428ffb0009085fcd01dd1b79d9953af8e0ad (diff) | |
download | gnumach-023401c5b97023670a44059a60eb2a3a11c8a929.tar.gz gnumach-023401c5b97023670a44059a60eb2a3a11c8a929.tar.bz2 gnumach-023401c5b97023670a44059a60eb2a3a11c8a929.zip |
VM: rework map entry wiring
First, user wiring is removed, simply because it has never been used.
Second, make the VM system track wiring requests to better handle
protection. This change makes it possible to wire entries with
VM_PROT_NONE protection without actually reserving any page for
them until protection changes, and even make those pages pageable
if protection is downgraded to VM_PROT_NONE.
* ddb/db_ext_symtab.c: Update call to vm_map_pageable.
* i386/i386/user_ldt.c: Likewise.
* ipc/mach_port.c: Likewise.
* vm/vm_debug.c (mach_vm_region_info): Update values returned
as appropriate.
* vm/vm_map.c (vm_map_entry_copy): Update operation as appropriate.
(vm_map_setup): Update member names as appropriate.
(vm_map_find_entry): Update to account for map member variable changes.
(vm_map_enter): Likewise.
(vm_map_entry_inc_wired): New function.
(vm_map_entry_reset_wired): Likewise.
(vm_map_pageable_scan): Likewise.
(vm_map_protect): Update wired access, call vm_map_pageable_scan.
(vm_map_pageable_common): Rename to ...
(vm_map_pageable): ... and rewrite to use vm_map_pageable_scan.
(vm_map_entry_delete): Fix unwiring.
(vm_map_copy_overwrite): Replace inline code with a call to
vm_map_entry_reset_wired.
(vm_map_copyin_page_list): Likewise.
(vm_map_print): Likewise. Also print map size and wired size.
(vm_map_copyout_page_list): Update to account for map member variable
changes.
* vm/vm_map.h (struct vm_map_entry): Remove `user_wired_count' member,
add `wired_access' member.
(struct vm_map): Rename `user_wired' member to `size_wired'.
(vm_map_pageable_common): Remove function.
(vm_map_pageable_user): Remove macro.
(vm_map_pageable): Replace macro with function declaration.
* vm/vm_user.c (vm_wire): Update call to vm_map_pageable.
Diffstat (limited to 'vm/vm_map.h')
-rw-r--r-- | vm/vm_map.h | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/vm/vm_map.h b/vm/vm_map.h index 537c36ef..aa68b92c 100644 --- a/vm/vm_map.h +++ b/vm/vm_map.h @@ -129,7 +129,9 @@ struct vm_map_entry { vm_prot_t max_protection; /* maximum protection */ vm_inherit_t inheritance; /* inheritance */ unsigned short wired_count; /* can be paged if = 0 */ - unsigned short user_wired_count; /* for vm_wire */ + vm_prot_t wired_access; /* wiring access types, as accepted + by vm_map_pageable; used on wiring + scans when protection != VM_PROT_NONE */ struct vm_map_entry *projected_on; /* 0 for normal map entry or persistent kernel map projected buffer entry; -1 for non-persistent kernel map projected buffer entry; @@ -179,7 +181,7 @@ struct vm_map { #define max_offset hdr.links.end /* end of range */ pmap_t pmap; /* Physical map */ vm_size_t size; /* virtual size */ - vm_size_t user_wired; /* wired by user size */ + vm_size_t size_wired; /* wired size */ int ref_count; /* Reference count */ decl_simple_lock_data(, ref_lock) /* Lock for ref_count field */ vm_map_entry_t hint; /* hint for quick lookups */ @@ -485,17 +487,10 @@ static inline void vm_map_set_name(vm_map_t map, const char *name) * a verified lookup is * now complete */ /* - * Pageability functions. Includes macro to preserve old interface. + * Pageability functions. */ -extern kern_return_t vm_map_pageable_common(vm_map_t, vm_offset_t, - vm_offset_t, vm_prot_t, - boolean_t); - -#define vm_map_pageable(map, s, e, access) \ - vm_map_pageable_common(map, s, e, access, FALSE) - -#define vm_map_pageable_user(map, s, e, access) \ - vm_map_pageable_common(map, s, e, access, TRUE) +extern kern_return_t vm_map_pageable(vm_map_t, vm_offset_t, vm_offset_t, + vm_prot_t, boolean_t, boolean_t); /* * Submap object. Must be used to create memory to be put |