* fhandler_process.cc (format_process_maps): Define page protection

shortcuts RO, X, and WC.  Use in creating access flag string.  Don't
	set type flag to 's' for copy-on-write pages, as on Linux.
This commit is contained in:
Corinna Vinschen 2011-08-20 18:55:45 +00:00
parent fe9bdaedff
commit f71c1cdb55
2 changed files with 15 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2011-08-20 Corinna Vinschen <corinna@vinschen.de>
* fhandler_process.cc (format_process_maps): Define page protection
shortcuts RO, X, and WC. Use in creating access flag string. Don't
set type flag to 's' for copy-on-write pages, as on Linux.
2011-08-19 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* devices.h (fh_devices): Define DEV_MISC_MAJOR, DEV_MEM_MAJOR,

View File

@ -907,16 +907,19 @@ format_process_maps (void *data, char *&destbuf)
}
else
{
static DWORD const RO = (PAGE_EXECUTE_READ | PAGE_READONLY);
static DWORD const RW = (PAGE_EXECUTE_READWRITE | PAGE_READWRITE
| PAGE_EXECUTE_WRITECOPY | PAGE_WRITECOPY);
static DWORD const X = (PAGE_EXECUTE | PAGE_EXECUTE_READ
| PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY);
static DWORD const WC = (PAGE_EXECUTE_WRITECOPY | PAGE_WRITECOPY);
DWORD p = mb.Protect;
a = (access) {{
(p & (RW | PAGE_EXECUTE_READ | PAGE_READONLY)) ? 'r' : '-',
(p & (RW)) ? 'w' : '-',
(p & (PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_READ
| PAGE_EXECUTE_WRITECOPY | PAGE_EXECUTE)) ? 'x' : '-',
(mb.Type & MEM_MAPPED) ? 's'
: (p & PAGE_GUARD) ? 'g' : 'p',
(p & (RO | RW)) ? 'r' : '-',
(p & (RW)) ? 'w' : '-',
(p & (X)) ? 'x' : '-',
(mb.Type & MEM_MAPPED) && !(p & (WC)) ? 's'
: (p & PAGE_GUARD) ? 'g' : 'p',
'\0', // zero-fill the remaining bytes
}};
}