Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-05-16 13:55:18 +0400
committerCorinna Vinschen <corinna@vinschen.de>2011-05-16 13:55:18 +0400
commit6d6cfa4840b66c2dc152e7eab915a8ac9c10ef71 (patch)
tree01dd5cde99e17518990bb4efe163a0048281f293 /winsup/cygwin/mmap.cc
parent943e23a49f6f2fcb15cebe37e4c2361cab8f0fe4 (diff)
* dcrt0.cc (child_info_fork::alloc_stack_hard_way): Check if the
requested stack is application-provided within the user heap or an mmapped region. If so, just use it. Add comment to explain why. * miscfuncs.cc (thread_wrapper): If an application-provided stack has been given, implement cygtls area at the stackbase. Fix comment. * mmap.cc (is_mmapped_region): New function. * winsup.h (is_mmapped_region): Declare.
Diffstat (limited to 'winsup/cygwin/mmap.cc')
-rw-r--r--winsup/cygwin/mmap.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc
index 059daa186..9daa32fd7 100644
--- a/winsup/cygwin/mmap.cc
+++ b/winsup/cygwin/mmap.cc
@@ -659,6 +659,34 @@ mmap_areas::del_list (mmap_list *ml)
cfree (ml);
}
+/* This function allows an external function to test if a given memory
+ region is part of an mmapped memory region. */
+bool
+is_mmapped_region (caddr_t start_addr, caddr_t end_address)
+{
+ bool ret = false;
+
+ size_t len = end_address - start_addr;
+
+ LIST_LOCK ();
+ mmap_list *map_list = mmapped_areas.get_list_by_fd (-1, NULL);
+
+ mmap_record *rec;
+ caddr_t u_addr;
+ DWORD u_len;
+
+ LIST_FOREACH (rec, &map_list->recs, mr_next)
+ {
+ if (rec->match (start_addr, len, u_addr, u_len))
+ {
+ ret = true;
+ break;
+ }
+ }
+ LIST_UNLOCK ();
+ return ret;
+}
+
/* This function is called from exception_handler when a segmentation
violation has occurred. It should also be called from all Cygwin
functions that want to support passing noreserve mmap page addresses
@@ -677,6 +705,7 @@ mmap_areas::del_list (mmap_list *ml)
On MAP_NORESERVE_COMMITED, the exeception handler should return 0 to
allow the application to retry the memory access, or the calling Cygwin
function should retry the Windows system call. */
+
mmap_region_status
mmap_is_attached_or_noreserve (void *addr, size_t len)
{