17d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris/* libunwind - a platform-independent unwind library
27d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris   Copyright (C) 2013 The Android Open Source Project
37d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris
47d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher FerrisThis file is part of libunwind.
57d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris
67d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher FerrisPermission is hereby granted, free of charge, to any person obtaining
77d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferrisa copy of this software and associated documentation files (the
87d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris"Software"), to deal in the Software without restriction, including
97d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferriswithout limitation the rights to use, copy, modify, merge, publish,
107d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferrisdistribute, sublicense, and/or sell copies of the Software, and to
117d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferrispermit persons to whom the Software is furnished to do so, subject to
127d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferristhe following conditions:
137d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris
147d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher FerrisThe above copyright notice and this permission notice shall be
157d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferrisincluded in all copies or substantial portions of the Software.
167d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris
177d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher FerrisTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
187d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher FerrisEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
197d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher FerrisMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
207d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher FerrisNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
217d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher FerrisLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
227d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher FerrisOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
237d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher FerrisWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
247d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris
257d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris#ifndef map_info_h
267d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris#define map_info_h
277d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris
28f360ccc06f3f086f41cf6ba4036b52571ed2a54fChristopher Ferris/* Must not conflict with PROT_{NONE,READ,WRITE}. */
29f360ccc06f3f086f41cf6ba4036b52571ed2a54fChristopher Ferris#define MAP_FLAGS_DEVICE_MEM  0x8000
30f360ccc06f3f086f41cf6ba4036b52571ed2a54fChristopher Ferris
317d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferrisstruct map_info
327d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris  {
337d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris    uintptr_t start;
347d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris    uintptr_t end;
357d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris    uintptr_t offset;
367d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris    int flags;
3716b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris    char *path;
38b8627d92164f67864e806afb9f461f2db161f13cChristopher Ferris
39b8627d92164f67864e806afb9f461f2db161f13cChristopher Ferris    lock_var (ei_lock);
4016b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris    struct elf_image ei;
4116b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris
427d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris    struct map_info *next;
437d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris  };
447d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris
45f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferrisextern struct mempool map_pool;
460996405de25a3aab5045d20803c8f0a5441d0c57Christopher Ferrisextern struct map_info *local_map_list;
470996405de25a3aab5045d20803c8f0a5441d0c57Christopher Ferris
48f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferrisvoid map_local_init (void);
497d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris
50f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferrisint map_local_is_readable (unw_word_t);
517d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris
52f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferrisint map_local_is_writable (unw_word_t);
537d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris
54bb754471703e806d83d0e6670955dc1d399690b3Christopher Ferrischar *map_local_get_image_name (unw_word_t);
55bb754471703e806d83d0e6670955dc1d399690b3Christopher Ferris
56f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferrisstruct map_info *map_alloc_info (void);
57f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferris
58f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferrisvoid map_free_info (struct map_info *);
59f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferris
60f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferrisstruct map_info *map_find_from_addr (struct map_info *, unw_word_t);
61f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferris
62914a66ffa00715159179aeab640889604c4f87a0Christopher Ferrisstruct map_info *map_create_list (pid_t);
63f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferris
64f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferrisvoid map_destroy_list (struct map_info *);
6516b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris
667d46a21e0a2cb561e4cad57b101a7137e01023dcChristopher Ferris#endif /* map_info_h */
67