18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * This header file contains assembly-language definitions (assembly 38c2ecf20Sopenharmony_ci * macros, etc.) for this specific Xtensa processor's TIE extensions 48c2ecf20Sopenharmony_ci * and options. It is customized to this Xtensa processor configuration. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 78c2ecf20Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 88c2ecf20Sopenharmony_ci * for more details. 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * Copyright (C) 1999-2008 Tensilica Inc. 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#ifndef _XTENSA_CORE_TIE_ASM_H 148c2ecf20Sopenharmony_ci#define _XTENSA_CORE_TIE_ASM_H 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci/* Selection parameter values for save-area save/restore macros: */ 178c2ecf20Sopenharmony_ci/* Option vs. TIE: */ 188c2ecf20Sopenharmony_ci#define XTHAL_SAS_TIE 0x0001 /* custom extension or coprocessor */ 198c2ecf20Sopenharmony_ci#define XTHAL_SAS_OPT 0x0002 /* optional (and not a coprocessor) */ 208c2ecf20Sopenharmony_ci/* Whether used automatically by compiler: */ 218c2ecf20Sopenharmony_ci#define XTHAL_SAS_NOCC 0x0004 /* not used by compiler w/o special opts/code */ 228c2ecf20Sopenharmony_ci#define XTHAL_SAS_CC 0x0008 /* used by compiler without special opts/code */ 238c2ecf20Sopenharmony_ci/* ABI handling across function calls: */ 248c2ecf20Sopenharmony_ci#define XTHAL_SAS_CALR 0x0010 /* caller-saved */ 258c2ecf20Sopenharmony_ci#define XTHAL_SAS_CALE 0x0020 /* callee-saved */ 268c2ecf20Sopenharmony_ci#define XTHAL_SAS_GLOB 0x0040 /* global across function calls (in thread) */ 278c2ecf20Sopenharmony_ci/* Misc */ 288c2ecf20Sopenharmony_ci#define XTHAL_SAS_ALL 0xFFFF /* include all default NCP contents */ 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci/* Macro to save all non-coprocessor (extra) custom TIE and optional state 338c2ecf20Sopenharmony_ci * (not including zero-overhead loop registers). 348c2ecf20Sopenharmony_ci * Save area ptr (clobbered): ptr (1 byte aligned) 358c2ecf20Sopenharmony_ci * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed) 368c2ecf20Sopenharmony_ci */ 378c2ecf20Sopenharmony_ci .macro xchal_ncp_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL 388c2ecf20Sopenharmony_ci xchal_sa_start \continue, \ofs 398c2ecf20Sopenharmony_ci .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~\select 408c2ecf20Sopenharmony_ci xchal_sa_align \ptr, 0, 1024-4, 4, 4 418c2ecf20Sopenharmony_ci rur \at1, THREADPTR // threadptr option 428c2ecf20Sopenharmony_ci s32i \at1, \ptr, .Lxchal_ofs_ + 0 438c2ecf20Sopenharmony_ci .set .Lxchal_ofs_, .Lxchal_ofs_ + 4 448c2ecf20Sopenharmony_ci .endif 458c2ecf20Sopenharmony_ci .endm // xchal_ncp_store 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci/* Macro to save all non-coprocessor (extra) custom TIE and optional state 488c2ecf20Sopenharmony_ci * (not including zero-overhead loop registers). 498c2ecf20Sopenharmony_ci * Save area ptr (clobbered): ptr (1 byte aligned) 508c2ecf20Sopenharmony_ci * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed) 518c2ecf20Sopenharmony_ci */ 528c2ecf20Sopenharmony_ci .macro xchal_ncp_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL 538c2ecf20Sopenharmony_ci xchal_sa_start \continue, \ofs 548c2ecf20Sopenharmony_ci .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~\select 558c2ecf20Sopenharmony_ci xchal_sa_align \ptr, 0, 1024-4, 4, 4 568c2ecf20Sopenharmony_ci l32i \at1, \ptr, .Lxchal_ofs_ + 0 578c2ecf20Sopenharmony_ci wur \at1, THREADPTR // threadptr option 588c2ecf20Sopenharmony_ci .set .Lxchal_ofs_, .Lxchal_ofs_ + 4 598c2ecf20Sopenharmony_ci .endif 608c2ecf20Sopenharmony_ci .endm // xchal_ncp_load 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#define XCHAL_NCP_NUM_ATMPS 1 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci#define XCHAL_SA_NUM_ATMPS 1 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#endif /*_XTENSA_CORE_TIE_ASM_H*/ 708c2ecf20Sopenharmony_ci 71