1// 2// miscellaneous.S - miscellaneous assembly language routines 3// 4// $Id: //depot/rel/Foxhill/dot.8/Xtensa/OS/hal/miscellaneous.S#1 $ 5 6// Copyright (c) 2011 Tensilica Inc. 7// 8// Permission is hereby granted, free of charge, to any person obtaining 9// a copy of this software and associated documentation files (the 10// "Software"), to deal in the Software without restriction, including 11// without limitation the rights to use, copy, modify, merge, publish, 12// distribute, sublicense, and/or sell copies of the Software, and to 13// permit persons to whom the Software is furnished to do so, subject to 14// the following conditions: 15// 16// The above copyright notice and this permission notice shall be included 17// in all copies or substantial portions of the Software. 18// 19// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 27#include <xtensa/cacheasm.h> 28#include <xtensa/cacheattrasm.h> 29#include <xtensa/xtensa-versions.h> 30 31 32 .text 33 34//---------------------------------------------------------------------- 35// Clear any remnant register state pointing to (or containing) code. 36// Specifically, clear loop registers (LCOUNT) to avoid hardware loopback 37// from LEND to LBEGIN when new code is loaded where code containing a 38// zero-overhead loop was located. See the HAL chapter of the Tensilica 39// System Software Reference Manual for details on the use of this function. 40//---------------------------------------------------------------------- 41 42 43DECLFUNC(xthal_clear_regcached_code) 44 abi_entry 45# if XCHAL_HAVE_LOOPS 46 movi a2, 0 47 wsr.lcount a2 48# endif 49 isync_retw_nop 50 abi_return 51 endfunc 52 53 54