1a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm/* libunwind - a platform-independent unwind library 2d9e100753f5694ebb14769048373e8171f336127hp.com!davidm Copyright (C) 2002, 2005 Hewlett-Packard Co 3a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm Contributed by David Mosberger-Tang <davidm@hpl.hp.com> 4a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm 5a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmThis file is part of libunwind. 6a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm 7a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmPermission is hereby granted, free of charge, to any person obtaining 8a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidma copy of this software and associated documentation files (the 9a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm"Software"), to deal in the Software without restriction, including 10a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmwithout limitation the rights to use, copy, modify, merge, publish, 11a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmdistribute, sublicense, and/or sell copies of the Software, and to 12a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmpermit persons to whom the Software is furnished to do so, subject to 13a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmthe following conditions: 14a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm 15a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmThe above copyright notice and this permission notice shall be 16a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmincluded in all copies or substantial portions of the Software. 17a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm 18a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 25a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm 26d9e100753f5694ebb14769048373e8171f336127hp.com!davidm#include "libunwind_i.h" 27a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm 28a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmPROTECTED int 29a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidmunw_set_caching_policy (unw_addr_space_t as, unw_caching_policy_t policy) 30a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm{ 315d0f376b08126b51a001d7cdfba1ec4e0d644f54Tommi Rantala if (!tdep_init_done) 32a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm tdep_init (); 33a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm 34a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm#ifndef HAVE___THREAD 35a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm if (policy == UNW_CACHE_PER_THREAD) 36a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm policy = UNW_CACHE_GLOBAL; 37a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm#endif 38a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm 39a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm if (policy == as->caching_policy) 40a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm return 0; /* no change */ 41a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm 42a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm as->caching_policy = policy; 43a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm /* Ensure caches are empty (and initialized). */ 44a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm unw_flush_cache (as, 0, 0); 45a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm return 0; 46a758c420e1270273600d9435c9d4e28087dc70d4hp.com!davidm} 47