10c1bc742181ded4930842b46e9507372f0b1b963James Dong;// 278e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// Copyright (C) 2007-2008 ARM Limited 378e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// 478e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// Licensed under the Apache License, Version 2.0 (the "License"); 578e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// you may not use this file except in compliance with the License. 678e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// You may obtain a copy of the License at 778e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// 878e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// http://www.apache.org/licenses/LICENSE-2.0 978e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// 1078e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// Unless required by applicable law or agreed to in writing, software 1178e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// distributed under the License is distributed on an "AS IS" BASIS, 1278e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1378e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// See the License for the specific language governing permissions and 1478e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// limitations under the License. 1578e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// 1678e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar;// 170c1bc742181ded4930842b46e9507372f0b1b963James Dong;// 180c1bc742181ded4930842b46e9507372f0b1b963James Dong;// File Name: armCOMM_s.h 190c1bc742181ded4930842b46e9507372f0b1b963James Dong;// OpenMAX DL: v1.0.2 200c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Revision: 12290 210c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Date: Wednesday, April 9, 2008 220c1bc742181ded4930842b46e9507372f0b1b963James Dong;// 230c1bc742181ded4930842b46e9507372f0b1b963James Dong;// 240c1bc742181ded4930842b46e9507372f0b1b963James Dong;// 250c1bc742181ded4930842b46e9507372f0b1b963James Dong;// 260c1bc742181ded4930842b46e9507372f0b1b963James Dong;// ARM optimized OpenMAX common header file 270c1bc742181ded4930842b46e9507372f0b1b963James Dong;// 280c1bc742181ded4930842b46e9507372f0b1b963James Dong 290c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Protect against multiple inclusion 300c1bc742181ded4930842b46e9507372f0b1b963James Dong IF :LNOT::DEF:ARMCOMM_S_H 310c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLL ARMCOMM_S_H 320c1bc742181ded4930842b46e9507372f0b1b963James Dong 330c1bc742181ded4930842b46e9507372f0b1b963James Dong REQUIRE8 ;// Requires 8-byte stack alignment 340c1bc742181ded4930842b46e9507372f0b1b963James Dong PRESERVE8 ;// Preserves 8-byte stack alignment 350c1bc742181ded4930842b46e9507372f0b1b963James Dong 360c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLL ARM_ERRORCHECK 370c1bc742181ded4930842b46e9507372f0b1b963James DongARM_ERRORCHECK SETL {FALSE} 380c1bc742181ded4930842b46e9507372f0b1b963James Dong 390c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Globals 400c1bc742181ded4930842b46e9507372f0b1b963James Dong 410c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLS _RRegList ;// R saved register list 420c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLS _DRegList ;// D saved register list 430c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLS _Variant ;// Selected processor variant 440c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLS _CPU ;// CPU name 450c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLS _Struct ;// Structure name 460c1bc742181ded4930842b46e9507372f0b1b963James Dong 470c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLL _InFunc ;// Inside function assembly flag 480c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLL _SwLong ;// Long switch flag 490c1bc742181ded4930842b46e9507372f0b1b963James Dong 500c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLA _RBytes ;// Number of register bytes on stack 510c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLA _SBytes ;// Number of scratch bytes on stack 520c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLA _ABytes ;// Stack offset of next argument 530c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLA _Workspace ;// Stack offset of scratch workspace 540c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLA _F ;// Function number 550c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLA _StOff ;// Struct offset 560c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLA _SwNum ;// Switch number 570c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLS _32 ;// Suffix for 32 byte alignmnet 580c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLS _16 ;// Suffix for 16 byte alignmnet 590c1bc742181ded4930842b46e9507372f0b1b963James Dong 600c1bc742181ded4930842b46e9507372f0b1b963James Dong_InFunc SETL {FALSE} 610c1bc742181ded4930842b46e9507372f0b1b963James Dong_SBytes SETA 0 620c1bc742181ded4930842b46e9507372f0b1b963James Dong_F SETA 0 630c1bc742181ded4930842b46e9507372f0b1b963James Dong_SwNum SETA 0 640c1bc742181ded4930842b46e9507372f0b1b963James Dong_32 SETS "ALIGN32" 650c1bc742181ded4930842b46e9507372f0b1b963James Dong_16 SETS "ALIGN16" 660c1bc742181ded4930842b46e9507372f0b1b963James Dong 670c1bc742181ded4930842b46e9507372f0b1b963James Dong;///////////////////////////////////////////////////////// 680c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Override the tools settings of the CPU if the #define 690c1bc742181ded4930842b46e9507372f0b1b963James Dong;// USECPU is set, otherwise use the CPU defined by the 700c1bc742181ded4930842b46e9507372f0b1b963James Dong;// assembler settings. 710c1bc742181ded4930842b46e9507372f0b1b963James Dong;///////////////////////////////////////////////////////// 720c1bc742181ded4930842b46e9507372f0b1b963James Dong 730c1bc742181ded4930842b46e9507372f0b1b963James Dong IF :DEF: OVERRIDECPU 740c1bc742181ded4930842b46e9507372f0b1b963James Dong_CPU SETS OVERRIDECPU 750c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 760c1bc742181ded4930842b46e9507372f0b1b963James Dong_CPU SETS {CPU} 770c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 780c1bc742181ded4930842b46e9507372f0b1b963James Dong 790c1bc742181ded4930842b46e9507372f0b1b963James Dong 800c1bc742181ded4930842b46e9507372f0b1b963James Dong 810c1bc742181ded4930842b46e9507372f0b1b963James Dong;///////////////////////////////////////////////////////// 820c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Work out which code to build 830c1bc742181ded4930842b46e9507372f0b1b963James Dong;///////////////////////////////////////////////////////// 840c1bc742181ded4930842b46e9507372f0b1b963James Dong 850c1bc742181ded4930842b46e9507372f0b1b963James Dong IF :DEF:ARM1136JS:LOR::DEF:CortexA8:LOR::DEF:ARM_GENERIC 860c1bc742181ded4930842b46e9507372f0b1b963James Dong INFO 1,"Please switch to using M_VARIANTS" 870c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 880c1bc742181ded4930842b46e9507372f0b1b963James Dong 890c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Define and reset all officially recongnised variants 900c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 910c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DEF_VARIANTS 920c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DEF_VARIANT ARM926EJS 930c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DEF_VARIANT ARM1136JS 940c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DEF_VARIANT ARM1136JS_U 950c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DEF_VARIANT CortexA8 960c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DEF_VARIANT ARM7TDMI 970c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 980c1bc742181ded4930842b46e9507372f0b1b963James Dong 990c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 1000c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DEF_VARIANT $var 1010c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLL $var 1020c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLL _ok$var 1030c1bc742181ded4930842b46e9507372f0b1b963James Dong$var SETL {FALSE} 1040c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 1050c1bc742181ded4930842b46e9507372f0b1b963James Dong 1060c1bc742181ded4930842b46e9507372f0b1b963James Dong 1070c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Variant declaration 1080c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// 1090c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Define a list of code variants supported by this 1100c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// source file. This macro then chooses the most 1110c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// appropriate variant to build for the currently configured 1120c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// core. 1130c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// 1140c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 1150c1bc742181ded4930842b46e9507372f0b1b963James Dong M_VARIANTS $v0,$v1,$v2,$v3,$v4,$v5,$v6,$v7 1160c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Set to TRUE variants that are supported 1170c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DEF_VARIANTS 1180c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_VARIANT $v0 1190c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_VARIANT $v1 1200c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_VARIANT $v2 1210c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_VARIANT $v3 1220c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_VARIANT $v4 1230c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_VARIANT $v5 1240c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_VARIANT $v6 1250c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_VARIANT $v7 1260c1bc742181ded4930842b46e9507372f0b1b963James Dong 1270c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Look for first available variant to match a CPU 1280c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// _M_TRY cpu, variant fall back list 1290c1bc742181ded4930842b46e9507372f0b1b963James Dong_Variant SETS "" 1300c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY ARM926EJ-S, ARM926EJS 1310c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY ARM1176JZ-S, ARM1136JS 1320c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY ARM1176JZF-S, ARM1136JS 1330c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY ARM1156T2-S, ARM1136JS 1340c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY ARM1156T2F-S, ARM1136JS 1350c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY ARM1136J-S, ARM1136JS 1360c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY ARM1136JF-S, ARM1136JS 1370c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY MPCore, ARM1136JS 1380c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY falcon-vfp, ARM1136JS 1390c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY falcon-full-neon, CortexA8 1400c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY Cortex-A8NoNeon, ARM1136JS 1410c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY Cortex-A8, CortexA8, ARM1136JS 1420c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY Cortex-R4, ARM1136JS 1430c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY ARM7TDMI 1440c1bc742181ded4930842b46e9507372f0b1b963James Dong 1450c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Select the correct variant 1460c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DEF_VARIANTS 1470c1bc742181ded4930842b46e9507372f0b1b963James Dong IF _Variant="" 1480c1bc742181ded4930842b46e9507372f0b1b963James Dong INFO 1, "No match found for CPU '$_CPU'" 1490c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 1500c1bc742181ded4930842b46e9507372f0b1b963James Dong$_Variant SETL {TRUE} 1510c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 1520c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 1530c1bc742181ded4930842b46e9507372f0b1b963James Dong 1540c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Register a variant as available 1550c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 1560c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_VARIANT $var 1570c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$var"="" 1580c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 1590c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 1600c1bc742181ded4930842b46e9507372f0b1b963James Dong IF :LNOT::DEF:_ok$var 1610c1bc742181ded4930842b46e9507372f0b1b963James Dong INFO 1, "Unrecognized variant '$var'" 1620c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 1630c1bc742181ded4930842b46e9507372f0b1b963James Dong$var SETL {TRUE} 1640c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 1650c1bc742181ded4930842b46e9507372f0b1b963James Dong 1660c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// For a given CPU, see if any of the variants supporting 1670c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// this CPU are available. The first available variant is 1680c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// chosen 1690c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 1700c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY $cpu, $v0,$v1,$v2,$v3,$v4,$v5,$v6,$v7 1710c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$cpu"<>_CPU 1720c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 1730c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 1740c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY1 $v0 1750c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY1 $v1 1760c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY1 $v2 1770c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY1 $v3 1780c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY1 $v4 1790c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY1 $v5 1800c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY1 $v6 1810c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY1 $v7 1820c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Check a match was found 1830c1bc742181ded4930842b46e9507372f0b1b963James Dong IF _Variant="" 1840c1bc742181ded4930842b46e9507372f0b1b963James Dong INFO 1, "No variant match found for CPU '$_CPU'" 1850c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 1860c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 1870c1bc742181ded4930842b46e9507372f0b1b963James Dong 1880c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 1890c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_TRY1 $var 1900c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$var"="" 1910c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 1920c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 1930c1bc742181ded4930842b46e9507372f0b1b963James Dong IF (_Variant=""):LAND:$var 1940c1bc742181ded4930842b46e9507372f0b1b963James Dong_Variant SETS "$var" 1950c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 1960c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 1970c1bc742181ded4930842b46e9507372f0b1b963James Dong 1980c1bc742181ded4930842b46e9507372f0b1b963James Dong;//////////////////////////////////////////////////////// 1990c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Structure definition 2000c1bc742181ded4930842b46e9507372f0b1b963James Dong;//////////////////////////////////////////////////////// 2010c1bc742181ded4930842b46e9507372f0b1b963James Dong 2020c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Declare a structure of given name 2030c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 2040c1bc742181ded4930842b46e9507372f0b1b963James Dong M_STRUCT $sname 2050c1bc742181ded4930842b46e9507372f0b1b963James Dong_Struct SETS "$sname" 2060c1bc742181ded4930842b46e9507372f0b1b963James Dong_StOff SETA 0 2070c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 2080c1bc742181ded4930842b46e9507372f0b1b963James Dong 2090c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Declare a structure field 2100c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// The field is called $sname_$fname 2110c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $size = the size of each entry, must be power of 2 2120c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $number = (if provided) the number of entries for an array 2130c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 2140c1bc742181ded4930842b46e9507372f0b1b963James Dong M_FIELD $fname, $size, $number 2150c1bc742181ded4930842b46e9507372f0b1b963James Dong IF (_StOff:AND:($size-1))!=0 2160c1bc742181ded4930842b46e9507372f0b1b963James Dong_StOff SETA _StOff + ($size - (_StOff:AND:($size-1))) 2170c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 2180c1bc742181ded4930842b46e9507372f0b1b963James Dong$_Struct._$fname EQU _StOff 2190c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$number"<>"" 2200c1bc742181ded4930842b46e9507372f0b1b963James Dong_StOff SETA _StOff + $size*$number 2210c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 2220c1bc742181ded4930842b46e9507372f0b1b963James Dong_StOff SETA _StOff + $size 2230c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 2240c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 2250c1bc742181ded4930842b46e9507372f0b1b963James Dong 2260c1bc742181ded4930842b46e9507372f0b1b963James Dong 2270c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 2280c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ENDSTRUCT 2290c1bc742181ded4930842b46e9507372f0b1b963James Dongsizeof_$_Struct EQU _StOff 2300c1bc742181ded4930842b46e9507372f0b1b963James Dong_Struct SETS "" 2310c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 2320c1bc742181ded4930842b46e9507372f0b1b963James Dong 2330c1bc742181ded4930842b46e9507372f0b1b963James Dong;////////////////////////////////////////////////////////// 2340c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Switch and table macros 2350c1bc742181ded4930842b46e9507372f0b1b963James Dong;////////////////////////////////////////////////////////// 2360c1bc742181ded4930842b46e9507372f0b1b963James Dong 2370c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Start a relative switch table with register to switch on 2380c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// 2390c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $v = the register to switch on 2400c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $s = if specified must be "L" to indicate long 2410c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// this allows a greater range to the case code 2420c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 2430c1bc742181ded4930842b46e9507372f0b1b963James Dong M_SWITCH $v, $s 2440c1bc742181ded4930842b46e9507372f0b1b963James Dong ASSERT "$s"="":LOR:"$s"="L" 2450c1bc742181ded4930842b46e9507372f0b1b963James Dong_SwLong SETL {FALSE} 2460c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$s"="L" 2470c1bc742181ded4930842b46e9507372f0b1b963James Dong_SwLong SETL {TRUE} 2480c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 2490c1bc742181ded4930842b46e9507372f0b1b963James Dong_SwNum SETA _SwNum+1 2500c1bc742181ded4930842b46e9507372f0b1b963James Dong IF {CONFIG}=16 2510c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Thumb 2520c1bc742181ded4930842b46e9507372f0b1b963James Dong IF _SwLong 2530c1bc742181ded4930842b46e9507372f0b1b963James Dong TBH [pc, $v, LSL#1] 2540c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 2550c1bc742181ded4930842b46e9507372f0b1b963James Dong TBB [pc, $v] 2560c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 2570c1bc742181ded4930842b46e9507372f0b1b963James Dong_Switch$_SwNum 2580c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 2590c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// ARM 2600c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD pc, pc, $v, LSL #2 2610c1bc742181ded4930842b46e9507372f0b1b963James Dong NOP 2620c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 2630c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 2640c1bc742181ded4930842b46e9507372f0b1b963James Dong 2650c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Add a case to the switch statement 2660c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 2670c1bc742181ded4930842b46e9507372f0b1b963James Dong M_CASE $label 2680c1bc742181ded4930842b46e9507372f0b1b963James Dong IF {CONFIG}=16 2690c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Thumb 2700c1bc742181ded4930842b46e9507372f0b1b963James Dong IF _SwLong 2710c1bc742181ded4930842b46e9507372f0b1b963James Dong DCW ($label - _Switch$_SwNum)/2 2720c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 2730c1bc742181ded4930842b46e9507372f0b1b963James Dong DCB ($label - _Switch$_SwNum)/2 2740c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 2750c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 2760c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// ARM 2770c1bc742181ded4930842b46e9507372f0b1b963James Dong B $label 2780c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 2790c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 2800c1bc742181ded4930842b46e9507372f0b1b963James Dong 2810c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// End of switch statement 2820c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 2830c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ENDSWITCH 2840c1bc742181ded4930842b46e9507372f0b1b963James Dong ALIGN 2 2850c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 2860c1bc742181ded4930842b46e9507372f0b1b963James Dong 2870c1bc742181ded4930842b46e9507372f0b1b963James Dong 2880c1bc742181ded4930842b46e9507372f0b1b963James Dong;//////////////////////////////////////////////////////// 2890c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Data area allocation 2900c1bc742181ded4930842b46e9507372f0b1b963James Dong;//////////////////////////////////////////////////////// 2910c1bc742181ded4930842b46e9507372f0b1b963James Dong 2920c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Constant table allocator macro 2930c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// 2940c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Creates a new section for each constant table 2950c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $name is symbol through which the table can be accessed. 2960c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $align is the optional alignment of the table, log2 of 2970c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// the byte alignment - $align=4 is 16 byte aligned 2980c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 2990c1bc742181ded4930842b46e9507372f0b1b963James Dong M_TABLE $name, $align 3000c1bc742181ded4930842b46e9507372f0b1b963James Dong ASSERT :LNOT:_InFunc 3010c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$align"="" 3020c1bc742181ded4930842b46e9507372f0b1b963James Dong AREA |.constdata|, READONLY, DATA 3030c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 3040c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// AREAs inherit the alignment of the first declaration. 3050c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Therefore for each alignment size we must have an area 3060c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// of a different name. 3070c1bc742181ded4930842b46e9507372f0b1b963James Dong AREA constdata_a$align, READONLY, DATA, ALIGN=$align 3080c1bc742181ded4930842b46e9507372f0b1b963James Dong 3090c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// We also force alignment incase we are tagging onto 3100c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// an already started area. 3110c1bc742181ded4930842b46e9507372f0b1b963James Dong ALIGN (1<<$align) 3120c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 3130c1bc742181ded4930842b46e9507372f0b1b963James Dong$name 3140c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 3150c1bc742181ded4930842b46e9507372f0b1b963James Dong 3160c1bc742181ded4930842b46e9507372f0b1b963James Dong;///////////////////////////////////////////////////// 3170c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Macros to allocate space on the stack 3180c1bc742181ded4930842b46e9507372f0b1b963James Dong;// 3190c1bc742181ded4930842b46e9507372f0b1b963James Dong;// These all assume that the stack is 8-byte aligned 3200c1bc742181ded4930842b46e9507372f0b1b963James Dong;// at entry to the function, which means that the 3210c1bc742181ded4930842b46e9507372f0b1b963James Dong;// 32-byte alignment macro needs to work in a 3220c1bc742181ded4930842b46e9507372f0b1b963James Dong;// bit more of a special way... 3230c1bc742181ded4930842b46e9507372f0b1b963James Dong;///////////////////////////////////////////////////// 3240c1bc742181ded4930842b46e9507372f0b1b963James Dong 3250c1bc742181ded4930842b46e9507372f0b1b963James Dong 3260c1bc742181ded4930842b46e9507372f0b1b963James Dong 3270c1bc742181ded4930842b46e9507372f0b1b963James Dong 3280c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Allocate 1-byte aligned area of name 3290c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $name size $size bytes. 3300c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 3310c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ALLOC1 $name, $size 3320c1bc742181ded4930842b46e9507372f0b1b963James Dong ASSERT :LNOT:_InFunc 3330c1bc742181ded4930842b46e9507372f0b1b963James Dong$name$_F EQU _SBytes 3340c1bc742181ded4930842b46e9507372f0b1b963James Dong_SBytes SETA _SBytes + ($size) 3350c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 3360c1bc742181ded4930842b46e9507372f0b1b963James Dong 3370c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Allocate 2-byte aligned area of name 3380c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $name size $size bytes. 3390c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 3400c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ALLOC2 $name, $size 3410c1bc742181ded4930842b46e9507372f0b1b963James Dong ASSERT :LNOT:_InFunc 3420c1bc742181ded4930842b46e9507372f0b1b963James Dong IF (_SBytes:AND:1)!=0 3430c1bc742181ded4930842b46e9507372f0b1b963James Dong_SBytes SETA _SBytes + (2 - (_SBytes:AND:1)) 3440c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 3450c1bc742181ded4930842b46e9507372f0b1b963James Dong$name$_F EQU _SBytes 3460c1bc742181ded4930842b46e9507372f0b1b963James Dong_SBytes SETA _SBytes + ($size) 3470c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 3480c1bc742181ded4930842b46e9507372f0b1b963James Dong 3490c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Allocate 4-byte aligned area of name 3500c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $name size $size bytes. 3510c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 3520c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ALLOC4 $name, $size 3530c1bc742181ded4930842b46e9507372f0b1b963James Dong ASSERT :LNOT:_InFunc 3540c1bc742181ded4930842b46e9507372f0b1b963James Dong IF (_SBytes:AND:3)!=0 3550c1bc742181ded4930842b46e9507372f0b1b963James Dong_SBytes SETA _SBytes + (4 - (_SBytes:AND:3)) 3560c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 3570c1bc742181ded4930842b46e9507372f0b1b963James Dong$name$_F EQU _SBytes 3580c1bc742181ded4930842b46e9507372f0b1b963James Dong_SBytes SETA _SBytes + ($size) 3590c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 3600c1bc742181ded4930842b46e9507372f0b1b963James Dong 3610c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Allocate 8-byte aligned area of name 3620c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $name size $size bytes. 3630c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 3640c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ALLOC8 $name, $size 3650c1bc742181ded4930842b46e9507372f0b1b963James Dong ASSERT :LNOT:_InFunc 3660c1bc742181ded4930842b46e9507372f0b1b963James Dong IF (_SBytes:AND:7)!=0 3670c1bc742181ded4930842b46e9507372f0b1b963James Dong_SBytes SETA _SBytes + (8 - (_SBytes:AND:7)) 3680c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 3690c1bc742181ded4930842b46e9507372f0b1b963James Dong$name$_F EQU _SBytes 3700c1bc742181ded4930842b46e9507372f0b1b963James Dong_SBytes SETA _SBytes + ($size) 3710c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 3720c1bc742181ded4930842b46e9507372f0b1b963James Dong 3730c1bc742181ded4930842b46e9507372f0b1b963James Dong 3740c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Allocate 8-byte aligned area of name 3750c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $name size ($size+16) bytes. 3760c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// The extra 16 bytes are later used to align the pointer to 16 bytes 3770c1bc742181ded4930842b46e9507372f0b1b963James Dong 3780c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 3790c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ALLOC16 $name, $size 3800c1bc742181ded4930842b46e9507372f0b1b963James Dong ASSERT :LNOT:_InFunc 3810c1bc742181ded4930842b46e9507372f0b1b963James Dong IF (_SBytes:AND:7)!=0 3820c1bc742181ded4930842b46e9507372f0b1b963James Dong_SBytes SETA _SBytes + (8 - (_SBytes:AND:7)) 3830c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 3840c1bc742181ded4930842b46e9507372f0b1b963James Dong$name$_F$_16 EQU (_SBytes + 8) 3850c1bc742181ded4930842b46e9507372f0b1b963James Dong_SBytes SETA _SBytes + ($size) + 8 3860c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 3870c1bc742181ded4930842b46e9507372f0b1b963James Dong 3880c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Allocate 8-byte aligned area of name 3890c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $name size ($size+32) bytes. 3900c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// The extra 32 bytes are later used to align the pointer to 32 bytes 3910c1bc742181ded4930842b46e9507372f0b1b963James Dong 3920c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 3930c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ALLOC32 $name, $size 3940c1bc742181ded4930842b46e9507372f0b1b963James Dong ASSERT :LNOT:_InFunc 3950c1bc742181ded4930842b46e9507372f0b1b963James Dong IF (_SBytes:AND:7)!=0 3960c1bc742181ded4930842b46e9507372f0b1b963James Dong_SBytes SETA _SBytes + (8 - (_SBytes:AND:7)) 3970c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 3980c1bc742181ded4930842b46e9507372f0b1b963James Dong$name$_F$_32 EQU (_SBytes + 24) 3990c1bc742181ded4930842b46e9507372f0b1b963James Dong_SBytes SETA _SBytes + ($size) + 24 4000c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 4010c1bc742181ded4930842b46e9507372f0b1b963James Dong 4020c1bc742181ded4930842b46e9507372f0b1b963James Dong 4030c1bc742181ded4930842b46e9507372f0b1b963James Dong 4040c1bc742181ded4930842b46e9507372f0b1b963James Dong 4050c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Argument Declaration Macro 4060c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// 4070c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Allocate an argument name $name 4080c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// size $size bytes 4090c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 4100c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ARG $name, $size 4110c1bc742181ded4930842b46e9507372f0b1b963James Dong ASSERT _InFunc 4120c1bc742181ded4930842b46e9507372f0b1b963James Dong$name$_F EQU _ABytes 4130c1bc742181ded4930842b46e9507372f0b1b963James Dong_ABytes SETA _ABytes + ($size) 4140c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 4150c1bc742181ded4930842b46e9507372f0b1b963James Dong 4160c1bc742181ded4930842b46e9507372f0b1b963James Dong;/////////////////////////////////////////////// 4170c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Macros to access stacked variables 4180c1bc742181ded4930842b46e9507372f0b1b963James Dong;/////////////////////////////////////////////// 4190c1bc742181ded4930842b46e9507372f0b1b963James Dong 4200c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Macro to perform a data processing operation 4210c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// with a constant second operand 4220c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 4230c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_OPC $op,$rd,$rn,$const 4240c1bc742181ded4930842b46e9507372f0b1b963James Dong LCLA _sh 4250c1bc742181ded4930842b46e9507372f0b1b963James Dong LCLA _cst 4260c1bc742181ded4930842b46e9507372f0b1b963James Dong_sh SETA 0 4270c1bc742181ded4930842b46e9507372f0b1b963James Dong_cst SETA $const 4280c1bc742181ded4930842b46e9507372f0b1b963James Dong IF _cst=0 4290c1bc742181ded4930842b46e9507372f0b1b963James Dong $op $rd, $rn, #_cst 4300c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 4310c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 4320c1bc742181ded4930842b46e9507372f0b1b963James Dong WHILE (_cst:AND:3)=0 4330c1bc742181ded4930842b46e9507372f0b1b963James Dong_cst SETA _cst>>2 4340c1bc742181ded4930842b46e9507372f0b1b963James Dong_sh SETA _sh+2 4350c1bc742181ded4930842b46e9507372f0b1b963James Dong WEND 4360c1bc742181ded4930842b46e9507372f0b1b963James Dong $op $rd, $rn, #(_cst:AND:0x000000FF)<<_sh 4370c1bc742181ded4930842b46e9507372f0b1b963James Dong IF _cst>=256 4380c1bc742181ded4930842b46e9507372f0b1b963James Dong $op $rd, $rd, #(_cst:AND:0xFFFFFF00)<<_sh 4390c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 4400c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 4410c1bc742181ded4930842b46e9507372f0b1b963James Dong 4420c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Macro to perform a data access operation 4430c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Such as LDR or STR 4440c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// The addressing mode is modified such that 4450c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// 1. If no address is given then the name is taken 4460c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// as a stack offset 4470c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// 2. If the addressing mode is not available for the 4480c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// state being assembled for (eg Thumb) then a suitable 4490c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// addressing mode is substituted. 4500c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// 4510c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// On Entry: 4520c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $i = Instruction to perform (eg "LDRB") 4530c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $a = Required byte alignment 4540c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $r = Register(s) to transfer (eg "r1") 4550c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $a0,$a1,$a2. Addressing mode and condition. One of: 4560c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// label {,cc} 4570c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// [base] {,,,cc} 4580c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// [base, offset]{!} {,,cc} 4590c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// [base, offset, shift]{!} {,cc} 4600c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// [base], offset {,,cc} 4610c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// [base], offset, shift {,cc} 4620c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 4630c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DATA $i,$a,$r,$a0,$a1,$a2,$a3 4640c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$a0":LEFT:1="[" 4650c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$a1"="" 4660c1bc742181ded4930842b46e9507372f0b1b963James Dong $i$a3 $r, $a0 4670c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 4680c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$a0":RIGHT:1="]" 4690c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$a2"="" 4700c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_POSTIND $i$a3, "$r", $a0, $a1 4710c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 4720c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_POSTIND $i$a3, "$r", $a0, "$a1,$a2" 4730c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 4740c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 4750c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$a2"="" 4760c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_PREIND $i$a3, "$r", $a0, $a1 4770c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 4780c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_PREIND $i$a3, "$r", $a0, "$a1,$a2" 4790c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 4800c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 4810c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 4820c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 4830c1bc742181ded4930842b46e9507372f0b1b963James Dong LCLA _Offset 4840c1bc742181ded4930842b46e9507372f0b1b963James Dong_Offset SETA _Workspace + $a0$_F 4850c1bc742181ded4930842b46e9507372f0b1b963James Dong ASSERT (_Offset:AND:($a-1))=0 4860c1bc742181ded4930842b46e9507372f0b1b963James Dong $i$a1 $r, [sp, #_Offset] 4870c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 4880c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 4890c1bc742181ded4930842b46e9507372f0b1b963James Dong 4900c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Handle post indexed load/stores 4910c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// op reg, [base], offset 4920c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 4930c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_POSTIND $i,$r,$a0,$a1 4940c1bc742181ded4930842b46e9507372f0b1b963James Dong LCLS _base 4950c1bc742181ded4930842b46e9507372f0b1b963James Dong LCLS _offset 4960c1bc742181ded4930842b46e9507372f0b1b963James Dong IF {CONFIG}=16 ;// Thumb 4970c1bc742181ded4930842b46e9507372f0b1b963James Dong_base SETS ("$a0":LEFT:(:LEN:"$a0"-1)):RIGHT:(:LEN:"$a0"-2) ;// remove [] 4980c1bc742181ded4930842b46e9507372f0b1b963James Dong_offset SETS "$a1" 4990c1bc742181ded4930842b46e9507372f0b1b963James Dong IF _offset:LEFT:1="+" 5000c1bc742181ded4930842b46e9507372f0b1b963James Dong_offset SETS _offset:RIGHT:(:LEN:_offset-1) 5010c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 5020c1bc742181ded4930842b46e9507372f0b1b963James Dong $i $r, $a0 5030c1bc742181ded4930842b46e9507372f0b1b963James Dong IF _offset:LEFT:1="-" 5040c1bc742181ded4930842b46e9507372f0b1b963James Dong_offset SETS _offset:RIGHT:(:LEN:_offset-1) 5050c1bc742181ded4930842b46e9507372f0b1b963James Dong SUB $_base, $_base, $_offset 5060c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 5070c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD $_base, $_base, $_offset 5080c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 5090c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE ;// ARM 5100c1bc742181ded4930842b46e9507372f0b1b963James Dong $i $r, $a0, $a1 5110c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 5120c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 5130c1bc742181ded4930842b46e9507372f0b1b963James Dong 5140c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Handle pre indexed load/store 5150c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// op reg, [base, offset]{!} 5160c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 5170c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_PREIND $i,$r,$a0,$a1 5180c1bc742181ded4930842b46e9507372f0b1b963James Dong LCLS _base 5190c1bc742181ded4930842b46e9507372f0b1b963James Dong LCLS _offset 5200c1bc742181ded4930842b46e9507372f0b1b963James Dong IF ({CONFIG}=16):LAND:(("$a1":RIGHT:2)="]!") 5210c1bc742181ded4930842b46e9507372f0b1b963James Dong_base SETS "$a0":RIGHT:(:LEN:("$a0")-1) 5220c1bc742181ded4930842b46e9507372f0b1b963James Dong_offset SETS "$a1":LEFT:(:LEN:("$a1")-2) 5230c1bc742181ded4930842b46e9507372f0b1b963James Dong $i $r, [$_base, $_offset] 5240c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD $_base, $_base, $_offset 5250c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 5260c1bc742181ded4930842b46e9507372f0b1b963James Dong $i $r, $a0, $a1 5270c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 5280c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 5290c1bc742181ded4930842b46e9507372f0b1b963James Dong 5300c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Load unsigned byte from stack 5310c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 5320c1bc742181ded4930842b46e9507372f0b1b963James Dong M_LDRB $r,$a0,$a1,$a2,$a3 5330c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DATA "LDRB",1,$r,$a0,$a1,$a2,$a3 5340c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 5350c1bc742181ded4930842b46e9507372f0b1b963James Dong 5360c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Load signed byte from stack 5370c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 5380c1bc742181ded4930842b46e9507372f0b1b963James Dong M_LDRSB $r,$a0,$a1,$a2,$a3 5390c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DATA "LDRSB",1,$r,$a0,$a1,$a2,$a3 5400c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 5410c1bc742181ded4930842b46e9507372f0b1b963James Dong 5420c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Store byte to stack 5430c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 5440c1bc742181ded4930842b46e9507372f0b1b963James Dong M_STRB $r,$a0,$a1,$a2,$a3 5450c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DATA "STRB",1,$r,$a0,$a1,$a2,$a3 5460c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 5470c1bc742181ded4930842b46e9507372f0b1b963James Dong 5480c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Load unsigned half word from stack 5490c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 5500c1bc742181ded4930842b46e9507372f0b1b963James Dong M_LDRH $r,$a0,$a1,$a2,$a3 5510c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DATA "LDRH",2,$r,$a0,$a1,$a2,$a3 5520c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 5530c1bc742181ded4930842b46e9507372f0b1b963James Dong 5540c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Load signed half word from stack 5550c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 5560c1bc742181ded4930842b46e9507372f0b1b963James Dong M_LDRSH $r,$a0,$a1,$a2,$a3 5570c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DATA "LDRSH",2,$r,$a0,$a1,$a2,$a3 5580c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 5590c1bc742181ded4930842b46e9507372f0b1b963James Dong 5600c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Store half word to stack 5610c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 5620c1bc742181ded4930842b46e9507372f0b1b963James Dong M_STRH $r,$a0,$a1,$a2,$a3 5630c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DATA "STRH",2,$r,$a0,$a1,$a2,$a3 5640c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 5650c1bc742181ded4930842b46e9507372f0b1b963James Dong 5660c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Load word from stack 5670c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 5680c1bc742181ded4930842b46e9507372f0b1b963James Dong M_LDR $r,$a0,$a1,$a2,$a3 5690c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DATA "LDR",4,$r,$a0,$a1,$a2,$a3 5700c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 5710c1bc742181ded4930842b46e9507372f0b1b963James Dong 5720c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Store word to stack 5730c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 5740c1bc742181ded4930842b46e9507372f0b1b963James Dong M_STR $r,$a0,$a1,$a2,$a3 5750c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DATA "STR",4,$r,$a0,$a1,$a2,$a3 5760c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 5770c1bc742181ded4930842b46e9507372f0b1b963James Dong 5780c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Load double word from stack 5790c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 5800c1bc742181ded4930842b46e9507372f0b1b963James Dong M_LDRD $r0,$r1,$a0,$a1,$a2,$a3 5810c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DATA "LDRD",8,"$r0,$r1",$a0,$a1,$a2,$a3 5820c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 5830c1bc742181ded4930842b46e9507372f0b1b963James Dong 5840c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Store double word to stack 5850c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 5860c1bc742181ded4930842b46e9507372f0b1b963James Dong M_STRD $r0,$r1,$a0,$a1,$a2,$a3 5870c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_DATA "STRD",8,"$r0,$r1",$a0,$a1,$a2,$a3 5880c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 5890c1bc742181ded4930842b46e9507372f0b1b963James Dong 5900c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Get absolute address of stack allocated location 5910c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 5920c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ADR $a, $b, $cc 5930c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_OPC ADD$cc, $a, sp, (_Workspace + $b$_F) 5940c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 5950c1bc742181ded4930842b46e9507372f0b1b963James Dong 5960c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Get absolute address of stack allocated location and align the address to 16 bytes 5970c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 5980c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ADR16 $a, $b, $cc 5990c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_OPC ADD$cc, $a, sp, (_Workspace + $b$_F$_16) 6000c1bc742181ded4930842b46e9507372f0b1b963James Dong 6010c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Now align $a to 16 bytes 6020c1bc742181ded4930842b46e9507372f0b1b963James Dong BIC$cc $a,$a,#0x0F 6030c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 6040c1bc742181ded4930842b46e9507372f0b1b963James Dong 6050c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Get absolute address of stack allocated location and align the address to 32 bytes 6060c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 6070c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ADR32 $a, $b, $cc 6080c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_OPC ADD$cc, $a, sp, (_Workspace + $b$_F$_32) 6090c1bc742181ded4930842b46e9507372f0b1b963James Dong 6100c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Now align $a to 32 bytes 6110c1bc742181ded4930842b46e9507372f0b1b963James Dong BIC$cc $a,$a,#0x1F 6120c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 6130c1bc742181ded4930842b46e9507372f0b1b963James Dong 6140c1bc742181ded4930842b46e9507372f0b1b963James Dong;////////////////////////////////////////////////////////// 6150c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Function header and footer macros 6160c1bc742181ded4930842b46e9507372f0b1b963James Dong;////////////////////////////////////////////////////////// 6170c1bc742181ded4930842b46e9507372f0b1b963James Dong 6180c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Function Header Macro 6190c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Generates the function prologue 6200c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Note that functions should all be "stack-moves-once" 6210c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// The FNSTART and FNEND macros should be the only places 6220c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// where the stack moves. 6230c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// 6240c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $name = function name 6250c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $rreg = "" don't stack any registers 6260c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// "lr" stack "lr" only 6270c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// "rN" stack registers "r4-rN,lr" 6280c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $dreg = "" don't stack any D registers 6290c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// "dN" stack registers "d8-dN" 6300c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// 6310c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Note: ARM Archicture procedure call standard AAPCS 6320c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// states that r4-r11, sp, d8-d15 must be preserved by 6330c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// a compliant function. 6340c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 6350c1bc742181ded4930842b46e9507372f0b1b963James Dong M_START $name, $rreg, $dreg 6360c1bc742181ded4930842b46e9507372f0b1b963James Dong ASSERT :LNOT:_InFunc 6370c1bc742181ded4930842b46e9507372f0b1b963James Dong ASSERT "$name"!="" 6380c1bc742181ded4930842b46e9507372f0b1b963James Dong_InFunc SETL {TRUE} 6390c1bc742181ded4930842b46e9507372f0b1b963James Dong_RBytes SETA 0 6400c1bc742181ded4930842b46e9507372f0b1b963James Dong_Workspace SETA 0 6410c1bc742181ded4930842b46e9507372f0b1b963James Dong 6420c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Create an area for the function 6430c1bc742181ded4930842b46e9507372f0b1b963James Dong AREA |.text|, CODE 6440c1bc742181ded4930842b46e9507372f0b1b963James Dong EXPORT $name 6450c1bc742181ded4930842b46e9507372f0b1b963James Dong$name FUNCTION 6460c1bc742181ded4930842b46e9507372f0b1b963James Dong 6470c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Save R registers 6480c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_GETRREGLIST $rreg 6490c1bc742181ded4930842b46e9507372f0b1b963James Dong IF _RRegList<>"" 6500c1bc742181ded4930842b46e9507372f0b1b963James Dong STMFD sp!, {$_RRegList, lr} 6510c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 6520c1bc742181ded4930842b46e9507372f0b1b963James Dong 6530c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Save D registers 6540c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_GETDREGLIST $dreg 6550c1bc742181ded4930842b46e9507372f0b1b963James Dong IF _DRegList<>"" 6560c1bc742181ded4930842b46e9507372f0b1b963James Dong VSTMFD sp!, {$_DRegList} 6570c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 6580c1bc742181ded4930842b46e9507372f0b1b963James Dong 6590c1bc742181ded4930842b46e9507372f0b1b963James Dong 6600c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Ensure size claimed on stack is 8-byte aligned 6610c1bc742181ded4930842b46e9507372f0b1b963James Dong IF ((_SBytes:AND:7)!=0) 6620c1bc742181ded4930842b46e9507372f0b1b963James Dong_SBytes SETA _SBytes + (8 - (_SBytes:AND:7)) 6630c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 6640c1bc742181ded4930842b46e9507372f0b1b963James Dong 6650c1bc742181ded4930842b46e9507372f0b1b963James Dong IF (_SBytes!=0) 6660c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_OPC SUB, sp, sp, _SBytes 6670c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 6680c1bc742181ded4930842b46e9507372f0b1b963James Dong 6690c1bc742181ded4930842b46e9507372f0b1b963James Dong 6700c1bc742181ded4930842b46e9507372f0b1b963James Dong_ABytes SETA _SBytes + _RBytes - _Workspace 6710c1bc742181ded4930842b46e9507372f0b1b963James Dong 6720c1bc742181ded4930842b46e9507372f0b1b963James Dong 6730c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Print function name if debug enabled 6740c1bc742181ded4930842b46e9507372f0b1b963James Dong M_PRINTF "$name\n", 6750c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 6760c1bc742181ded4930842b46e9507372f0b1b963James Dong 6770c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Work out a list of R saved registers 6780c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 6790c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_GETRREGLIST $rreg 6800c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$rreg"="" 6810c1bc742181ded4930842b46e9507372f0b1b963James Dong_RRegList SETS "" 6820c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 6830c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 6840c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$rreg"="lr":LOR:"$rreg"="r4" 6850c1bc742181ded4930842b46e9507372f0b1b963James Dong_RRegList SETS "r4" 6860c1bc742181ded4930842b46e9507372f0b1b963James Dong_RBytes SETA _RBytes+8 6870c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 6880c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 6890c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$rreg"="r5":LOR:"$rreg"="r6" 6900c1bc742181ded4930842b46e9507372f0b1b963James Dong_RRegList SETS "r4-r6" 6910c1bc742181ded4930842b46e9507372f0b1b963James Dong_RBytes SETA _RBytes+16 6920c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 6930c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 6940c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$rreg"="r7":LOR:"$rreg"="r8" 6950c1bc742181ded4930842b46e9507372f0b1b963James Dong_RRegList SETS "r4-r8" 6960c1bc742181ded4930842b46e9507372f0b1b963James Dong_RBytes SETA _RBytes+24 6970c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 6980c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 6990c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$rreg"="r9":LOR:"$rreg"="r10" 7000c1bc742181ded4930842b46e9507372f0b1b963James Dong_RRegList SETS "r4-r10" 7010c1bc742181ded4930842b46e9507372f0b1b963James Dong_RBytes SETA _RBytes+32 7020c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 7030c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 7040c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$rreg"="r11":LOR:"$rreg"="r12" 7050c1bc742181ded4930842b46e9507372f0b1b963James Dong_RRegList SETS "r4-r12" 7060c1bc742181ded4930842b46e9507372f0b1b963James Dong_RBytes SETA _RBytes+40 7070c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 7080c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 7090c1bc742181ded4930842b46e9507372f0b1b963James Dong INFO 1, "Unrecognized saved r register limit '$rreg'" 7100c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 7110c1bc742181ded4930842b46e9507372f0b1b963James Dong 7120c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Work out a list of D saved registers 7130c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 7140c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_GETDREGLIST $dreg 7150c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$dreg"="" 7160c1bc742181ded4930842b46e9507372f0b1b963James Dong_DRegList SETS "" 7170c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 7180c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 7190c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$dreg"="d8" 7200c1bc742181ded4930842b46e9507372f0b1b963James Dong_DRegList SETS "d8" 7210c1bc742181ded4930842b46e9507372f0b1b963James Dong_RBytes SETA _RBytes+8 7220c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 7230c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 7240c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$dreg"="d9" 7250c1bc742181ded4930842b46e9507372f0b1b963James Dong_DRegList SETS "d8-d9" 7260c1bc742181ded4930842b46e9507372f0b1b963James Dong_RBytes SETA _RBytes+16 7270c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 7280c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 7290c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$dreg"="d10" 7300c1bc742181ded4930842b46e9507372f0b1b963James Dong_DRegList SETS "d8-d10" 7310c1bc742181ded4930842b46e9507372f0b1b963James Dong_RBytes SETA _RBytes+24 7320c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 7330c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 7340c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$dreg"="d11" 7350c1bc742181ded4930842b46e9507372f0b1b963James Dong_DRegList SETS "d8-d11" 7360c1bc742181ded4930842b46e9507372f0b1b963James Dong_RBytes SETA _RBytes+32 7370c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 7380c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 7390c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$dreg"="d12" 7400c1bc742181ded4930842b46e9507372f0b1b963James Dong_DRegList SETS "d8-d12" 7410c1bc742181ded4930842b46e9507372f0b1b963James Dong_RBytes SETA _RBytes+40 7420c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 7430c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 7440c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$dreg"="d13" 7450c1bc742181ded4930842b46e9507372f0b1b963James Dong_DRegList SETS "d8-d13" 7460c1bc742181ded4930842b46e9507372f0b1b963James Dong_RBytes SETA _RBytes+48 7470c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 7480c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 7490c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$dreg"="d14" 7500c1bc742181ded4930842b46e9507372f0b1b963James Dong_DRegList SETS "d8-d14" 7510c1bc742181ded4930842b46e9507372f0b1b963James Dong_RBytes SETA _RBytes+56 7520c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 7530c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 7540c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$dreg"="d15" 7550c1bc742181ded4930842b46e9507372f0b1b963James Dong_DRegList SETS "d8-d15" 7560c1bc742181ded4930842b46e9507372f0b1b963James Dong_RBytes SETA _RBytes+64 7570c1bc742181ded4930842b46e9507372f0b1b963James Dong MEXIT 7580c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 7590c1bc742181ded4930842b46e9507372f0b1b963James Dong INFO 1, "Unrecognized saved d register limit '$dreg'" 7600c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 7610c1bc742181ded4930842b46e9507372f0b1b963James Dong 7620c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Produce function return instructions 7630c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 7640c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_RET $cc 7650c1bc742181ded4930842b46e9507372f0b1b963James Dong IF _DRegList<>"" 7660c1bc742181ded4930842b46e9507372f0b1b963James Dong VPOP$cc {$_DRegList} 7670c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 7680c1bc742181ded4930842b46e9507372f0b1b963James Dong IF _RRegList="" 7690c1bc742181ded4930842b46e9507372f0b1b963James Dong BX$cc lr 7700c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 7710c1bc742181ded4930842b46e9507372f0b1b963James Dong LDM$cc.FD sp!, {$_RRegList, pc} 7720c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 7730c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 7740c1bc742181ded4930842b46e9507372f0b1b963James Dong 7750c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Early Function Exit Macro 7760c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// $cc = condition to exit with 7770c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// (Example: M_EXIT EQ) 7780c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 7790c1bc742181ded4930842b46e9507372f0b1b963James Dong M_EXIT $cc 7800c1bc742181ded4930842b46e9507372f0b1b963James Dong ASSERT _InFunc 7810c1bc742181ded4930842b46e9507372f0b1b963James Dong IF _SBytes!=0 7820c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Restore stack frame and exit 7830c1bc742181ded4930842b46e9507372f0b1b963James Dong B$cc _End$_F 7840c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 7850c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Can return directly 7860c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_RET $cc 7870c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 7880c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 7890c1bc742181ded4930842b46e9507372f0b1b963James Dong 7900c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Function Footer Macro 7910c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Generates the function epilogue 7920c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 7930c1bc742181ded4930842b46e9507372f0b1b963James Dong M_END 7940c1bc742181ded4930842b46e9507372f0b1b963James Dong ASSERT _InFunc 7950c1bc742181ded4930842b46e9507372f0b1b963James Dong_InFunc SETL {FALSE} 7960c1bc742181ded4930842b46e9507372f0b1b963James Dong_End$_F 7970c1bc742181ded4930842b46e9507372f0b1b963James Dong 7980c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Restore the stack pointer to its original value on function entry 7990c1bc742181ded4930842b46e9507372f0b1b963James Dong IF _SBytes!=0 8000c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_OPC ADD, sp, sp, _SBytes 8010c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 8020c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_RET 8030c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDFUNC 8040c1bc742181ded4930842b46e9507372f0b1b963James Dong 8050c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Reset the global stack tracking variables back to their 8060c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// initial values, and increment the function count 8070c1bc742181ded4930842b46e9507372f0b1b963James Dong_SBytes SETA 0 8080c1bc742181ded4930842b46e9507372f0b1b963James Dong_F SETA _F+1 8090c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 8100c1bc742181ded4930842b46e9507372f0b1b963James Dong 8110c1bc742181ded4930842b46e9507372f0b1b963James Dong 8120c1bc742181ded4930842b46e9507372f0b1b963James Dong;//========================================================================== 8130c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Debug Macros 8140c1bc742181ded4930842b46e9507372f0b1b963James Dong;//========================================================================== 8150c1bc742181ded4930842b46e9507372f0b1b963James Dong 8160c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLL DEBUG_ON 8170c1bc742181ded4930842b46e9507372f0b1b963James DongDEBUG_ON SETL {FALSE} 8180c1bc742181ded4930842b46e9507372f0b1b963James Dong GBLL DEBUG_STALLS_ON 8190c1bc742181ded4930842b46e9507372f0b1b963James DongDEBUG_STALLS_ON SETL {FALSE} 8200c1bc742181ded4930842b46e9507372f0b1b963James Dong 8210c1bc742181ded4930842b46e9507372f0b1b963James Dong ;//========================================================================== 8220c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Debug call to printf 8230c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// M_PRINTF $format, $val0, $val1, $val2 8240c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// 8250c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Examples: 8260c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// M_PRINTF "x=%08x\n", r0 8270c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// 8280c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// This macro preserves the value of all registers including the 8290c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// flags. 8300c1bc742181ded4930842b46e9507372f0b1b963James Dong ;//========================================================================== 8310c1bc742181ded4930842b46e9507372f0b1b963James Dong 8320c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 8330c1bc742181ded4930842b46e9507372f0b1b963James Dong M_PRINTF $format, $val0, $val1, $val2 8340c1bc742181ded4930842b46e9507372f0b1b963James Dong IF DEBUG_ON 8350c1bc742181ded4930842b46e9507372f0b1b963James Dong 8360c1bc742181ded4930842b46e9507372f0b1b963James Dong IMPORT printf 8370c1bc742181ded4930842b46e9507372f0b1b963James Dong LCLA nArgs 8380c1bc742181ded4930842b46e9507372f0b1b963James DongnArgs SETA 0 8390c1bc742181ded4930842b46e9507372f0b1b963James Dong 8400c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// save registers so we don't corrupt them 8410c1bc742181ded4930842b46e9507372f0b1b963James Dong STMFD sp!, {r0-r12, lr} 8420c1bc742181ded4930842b46e9507372f0b1b963James Dong 8430c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Drop stack to give us some workspace 8440c1bc742181ded4930842b46e9507372f0b1b963James Dong SUB sp, sp, #16 8450c1bc742181ded4930842b46e9507372f0b1b963James Dong 8460c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Save registers we need to print to the stack 8470c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$val2" <> "" 8480c1bc742181ded4930842b46e9507372f0b1b963James Dong ASSERT "$val1" <> "" 8490c1bc742181ded4930842b46e9507372f0b1b963James Dong STR $val2, [sp, #8] 8500c1bc742181ded4930842b46e9507372f0b1b963James DongnArgs SETA nArgs+1 8510c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 8520c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$val1" <> "" 8530c1bc742181ded4930842b46e9507372f0b1b963James Dong ASSERT "$val0" <> "" 8540c1bc742181ded4930842b46e9507372f0b1b963James Dong STR $val1, [sp, #4] 8550c1bc742181ded4930842b46e9507372f0b1b963James DongnArgs SETA nArgs+1 8560c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 8570c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$val0"<>"" 8580c1bc742181ded4930842b46e9507372f0b1b963James Dong STR $val0, [sp] 8590c1bc742181ded4930842b46e9507372f0b1b963James DongnArgs SETA nArgs+1 8600c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 8610c1bc742181ded4930842b46e9507372f0b1b963James Dong 8620c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Now we are safe to corrupt registers 8630c1bc742181ded4930842b46e9507372f0b1b963James Dong ADR r0, %FT00 8640c1bc742181ded4930842b46e9507372f0b1b963James Dong IF nArgs=1 8650c1bc742181ded4930842b46e9507372f0b1b963James Dong LDR r1, [sp] 8660c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 8670c1bc742181ded4930842b46e9507372f0b1b963James Dong IF nArgs=2 8680c1bc742181ded4930842b46e9507372f0b1b963James Dong LDMIA sp, {r1,r2} 8690c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 8700c1bc742181ded4930842b46e9507372f0b1b963James Dong IF nArgs=3 8710c1bc742181ded4930842b46e9507372f0b1b963James Dong LDMIA sp, {r1,r2,r3} 8720c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 8730c1bc742181ded4930842b46e9507372f0b1b963James Dong 8740c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// print the values 8750c1bc742181ded4930842b46e9507372f0b1b963James Dong MRS r4, cpsr ;// preserve flags 8760c1bc742181ded4930842b46e9507372f0b1b963James Dong BL printf 8770c1bc742181ded4930842b46e9507372f0b1b963James Dong MSR cpsr_f, r4 ;// restore flags 8780c1bc742181ded4930842b46e9507372f0b1b963James Dong B %FT01 8790c1bc742181ded4930842b46e9507372f0b1b963James Dong00 ;// string to print 8800c1bc742181ded4930842b46e9507372f0b1b963James Dong DCB "$format", 0 8810c1bc742181ded4930842b46e9507372f0b1b963James Dong ALIGN 8820c1bc742181ded4930842b46e9507372f0b1b963James Dong01 ;// Finished 8830c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD sp, sp, #16 8840c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Restore registers 8850c1bc742181ded4930842b46e9507372f0b1b963James Dong LDMFD sp!, {r0-r12,lr} 8860c1bc742181ded4930842b46e9507372f0b1b963James Dong 8870c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF ;// DEBUG_ON 8880c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 8890c1bc742181ded4930842b46e9507372f0b1b963James Dong 8900c1bc742181ded4930842b46e9507372f0b1b963James Dong 8910c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Stall Simulation Macro 8920c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Inserts a given number of NOPs for the currently 8930c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// defined platform 8940c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 8950c1bc742181ded4930842b46e9507372f0b1b963James Dong M_STALL $plat1stall, $plat2stall, $plat3stall, $plat4stall, $plat5stall, $plat6stall 8960c1bc742181ded4930842b46e9507372f0b1b963James Dong IF DEBUG_STALLS_ON 8970c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_STALL_SUB $plat1stall 8980c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_STALL_SUB $plat2stall 8990c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_STALL_SUB $plat3stall 9000c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_STALL_SUB $plat4stall 9010c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_STALL_SUB $plat5stall 9020c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_STALL_SUB $plat6stall 9030c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 9040c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 9050c1bc742181ded4930842b46e9507372f0b1b963James Dong 9060c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 9070c1bc742181ded4930842b46e9507372f0b1b963James Dong _M_STALL_SUB $platstall 9080c1bc742181ded4930842b46e9507372f0b1b963James Dong IF "$platstall"!="" 9090c1bc742181ded4930842b46e9507372f0b1b963James Dong LCLA _pllen 9100c1bc742181ded4930842b46e9507372f0b1b963James Dong LCLS _pl 9110c1bc742181ded4930842b46e9507372f0b1b963James Dong LCLL _pllog 9120c1bc742181ded4930842b46e9507372f0b1b963James Dong_pllen SETA :LEN:"$platstall" 9130c1bc742181ded4930842b46e9507372f0b1b963James Dong_pl SETS "$platstall":LEFT:(_pllen - 2) 9140c1bc742181ded4930842b46e9507372f0b1b963James Dong IF :DEF:$_pl 9150c1bc742181ded4930842b46e9507372f0b1b963James Dong IF $_pl 9160c1bc742181ded4930842b46e9507372f0b1b963James Dong LCLS _st 9170c1bc742181ded4930842b46e9507372f0b1b963James Dong LCLA _stnum 9180c1bc742181ded4930842b46e9507372f0b1b963James Dong_st SETS "$platstall":RIGHT:1 9190c1bc742181ded4930842b46e9507372f0b1b963James Dong_stnum SETA $_st 9200c1bc742181ded4930842b46e9507372f0b1b963James Dong WHILE _stnum>0 9210c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV sp, sp 9220c1bc742181ded4930842b46e9507372f0b1b963James Dong_stnum SETA _stnum - 1 9230c1bc742181ded4930842b46e9507372f0b1b963James Dong WEND 9240c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 9250c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 9260c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 9270c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 9280c1bc742181ded4930842b46e9507372f0b1b963James Dong 9290c1bc742181ded4930842b46e9507372f0b1b963James Dong 9300c1bc742181ded4930842b46e9507372f0b1b963James Dong 9310c1bc742181ded4930842b46e9507372f0b1b963James Dong;//========================================================================== 9320c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Endian Invarience Macros 9330c1bc742181ded4930842b46e9507372f0b1b963James Dong;// 9340c1bc742181ded4930842b46e9507372f0b1b963James Dong;// The idea behind these macros is that if an array is 9350c1bc742181ded4930842b46e9507372f0b1b963James Dong;// loaded as words then the SMUL00 macro will multiply 9360c1bc742181ded4930842b46e9507372f0b1b963James Dong;// array elements 0 regardless of the endianess of the 9370c1bc742181ded4930842b46e9507372f0b1b963James Dong;// system. For little endian SMUL00=SMULBB, for big 9380c1bc742181ded4930842b46e9507372f0b1b963James Dong;// endian SMUL00=SMULTT and similarly for other packed operations. 9390c1bc742181ded4930842b46e9507372f0b1b963James Dong;// 9400c1bc742181ded4930842b46e9507372f0b1b963James Dong;//========================================================================== 9410c1bc742181ded4930842b46e9507372f0b1b963James Dong 9420c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 9430c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 $comli, $combi, $a, $b, $c, $d, $cc 9440c1bc742181ded4930842b46e9507372f0b1b963James Dong IF {ENDIAN}="big" 9450c1bc742181ded4930842b46e9507372f0b1b963James Dong $combi.$cc $a, $b, $c, $d 9460c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 9470c1bc742181ded4930842b46e9507372f0b1b963James Dong $comli.$cc $a, $b, $c, $d 9480c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 9490c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 9500c1bc742181ded4930842b46e9507372f0b1b963James Dong 9510c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 9520c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI3 $comli, $combi, $a, $b, $c, $cc 9530c1bc742181ded4930842b46e9507372f0b1b963James Dong IF {ENDIAN}="big" 9540c1bc742181ded4930842b46e9507372f0b1b963James Dong $combi.$cc $a, $b, $c 9550c1bc742181ded4930842b46e9507372f0b1b963James Dong ELSE 9560c1bc742181ded4930842b46e9507372f0b1b963James Dong $comli.$cc $a, $b, $c 9570c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 9580c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 9590c1bc742181ded4930842b46e9507372f0b1b963James Dong 9600c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// SMLAxy macros 9610c1bc742181ded4930842b46e9507372f0b1b963James Dong 9620c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 9630c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLA00 $a, $b, $c, $d, $cc 9640c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLABB, SMLATT, $a, $b, $c, $d, $cc 9650c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 9660c1bc742181ded4930842b46e9507372f0b1b963James Dong 9670c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 9680c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLA01 $a, $b, $c, $d, $cc 9690c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLABT, SMLATB, $a, $b, $c, $d, $cc 9700c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 9710c1bc742181ded4930842b46e9507372f0b1b963James Dong 9720c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 9730c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLA0B $a, $b, $c, $d, $cc 9740c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLABB, SMLATB, $a, $b, $c, $d, $cc 9750c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 9760c1bc742181ded4930842b46e9507372f0b1b963James Dong 9770c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 9780c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLA0T $a, $b, $c, $d, $cc 9790c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLABT, SMLATT, $a, $b, $c, $d, $cc 9800c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 9810c1bc742181ded4930842b46e9507372f0b1b963James Dong 9820c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 9830c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLA10 $a, $b, $c, $d, $cc 9840c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLATB, SMLABT, $a, $b, $c, $d, $cc 9850c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 9860c1bc742181ded4930842b46e9507372f0b1b963James Dong 9870c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 9880c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLA11 $a, $b, $c, $d, $cc 9890c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLATT, SMLABB, $a, $b, $c, $d, $cc 9900c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 9910c1bc742181ded4930842b46e9507372f0b1b963James Dong 9920c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 9930c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLA1B $a, $b, $c, $d, $cc 9940c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLATB, SMLABB, $a, $b, $c, $d, $cc 9950c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 9960c1bc742181ded4930842b46e9507372f0b1b963James Dong 9970c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 9980c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLA1T $a, $b, $c, $d, $cc 9990c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLATT, SMLABT, $a, $b, $c, $d, $cc 10000c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10010c1bc742181ded4930842b46e9507372f0b1b963James Dong 10020c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10030c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLAB0 $a, $b, $c, $d, $cc 10040c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLABB, SMLABT, $a, $b, $c, $d, $cc 10050c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10060c1bc742181ded4930842b46e9507372f0b1b963James Dong 10070c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10080c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLAB1 $a, $b, $c, $d, $cc 10090c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLABT, SMLABB, $a, $b, $c, $d, $cc 10100c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10110c1bc742181ded4930842b46e9507372f0b1b963James Dong 10120c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10130c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLAT0 $a, $b, $c, $d, $cc 10140c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLATB, SMLATT, $a, $b, $c, $d, $cc 10150c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10160c1bc742181ded4930842b46e9507372f0b1b963James Dong 10170c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10180c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLAT1 $a, $b, $c, $d, $cc 10190c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLATT, SMLATB, $a, $b, $c, $d, $cc 10200c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10210c1bc742181ded4930842b46e9507372f0b1b963James Dong 10220c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// SMULxy macros 10230c1bc742181ded4930842b46e9507372f0b1b963James Dong 10240c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10250c1bc742181ded4930842b46e9507372f0b1b963James Dong SMUL00 $a, $b, $c, $cc 10260c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI3 SMULBB, SMULTT, $a, $b, $c, $cc 10270c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10280c1bc742181ded4930842b46e9507372f0b1b963James Dong 10290c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10300c1bc742181ded4930842b46e9507372f0b1b963James Dong SMUL01 $a, $b, $c, $cc 10310c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI3 SMULBT, SMULTB, $a, $b, $c, $cc 10320c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10330c1bc742181ded4930842b46e9507372f0b1b963James Dong 10340c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10350c1bc742181ded4930842b46e9507372f0b1b963James Dong SMUL0B $a, $b, $c, $cc 10360c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI3 SMULBB, SMULTB, $a, $b, $c, $cc 10370c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10380c1bc742181ded4930842b46e9507372f0b1b963James Dong 10390c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10400c1bc742181ded4930842b46e9507372f0b1b963James Dong SMUL0T $a, $b, $c, $cc 10410c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI3 SMULBT, SMULTT, $a, $b, $c, $cc 10420c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10430c1bc742181ded4930842b46e9507372f0b1b963James Dong 10440c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10450c1bc742181ded4930842b46e9507372f0b1b963James Dong SMUL10 $a, $b, $c, $cc 10460c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI3 SMULTB, SMULBT, $a, $b, $c, $cc 10470c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10480c1bc742181ded4930842b46e9507372f0b1b963James Dong 10490c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10500c1bc742181ded4930842b46e9507372f0b1b963James Dong SMUL11 $a, $b, $c, $cc 10510c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI3 SMULTT, SMULBB, $a, $b, $c, $cc 10520c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10530c1bc742181ded4930842b46e9507372f0b1b963James Dong 10540c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10550c1bc742181ded4930842b46e9507372f0b1b963James Dong SMUL1B $a, $b, $c, $cc 10560c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI3 SMULTB, SMULBB, $a, $b, $c, $cc 10570c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10580c1bc742181ded4930842b46e9507372f0b1b963James Dong 10590c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10600c1bc742181ded4930842b46e9507372f0b1b963James Dong SMUL1T $a, $b, $c, $cc 10610c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI3 SMULTT, SMULBT, $a, $b, $c, $cc 10620c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10630c1bc742181ded4930842b46e9507372f0b1b963James Dong 10640c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10650c1bc742181ded4930842b46e9507372f0b1b963James Dong SMULB0 $a, $b, $c, $cc 10660c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI3 SMULBB, SMULBT, $a, $b, $c, $cc 10670c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10680c1bc742181ded4930842b46e9507372f0b1b963James Dong 10690c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10700c1bc742181ded4930842b46e9507372f0b1b963James Dong SMULB1 $a, $b, $c, $cc 10710c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI3 SMULBT, SMULBB, $a, $b, $c, $cc 10720c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10730c1bc742181ded4930842b46e9507372f0b1b963James Dong 10740c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10750c1bc742181ded4930842b46e9507372f0b1b963James Dong SMULT0 $a, $b, $c, $cc 10760c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI3 SMULTB, SMULTT, $a, $b, $c, $cc 10770c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10780c1bc742181ded4930842b46e9507372f0b1b963James Dong 10790c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10800c1bc742181ded4930842b46e9507372f0b1b963James Dong SMULT1 $a, $b, $c, $cc 10810c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI3 SMULTT, SMULTB, $a, $b, $c, $cc 10820c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10830c1bc742181ded4930842b46e9507372f0b1b963James Dong 10840c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// SMLAWx, SMULWx macros 10850c1bc742181ded4930842b46e9507372f0b1b963James Dong 10860c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10870c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLAW0 $a, $b, $c, $d, $cc 10880c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLAWB, SMLAWT, $a, $b, $c, $d, $cc 10890c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10900c1bc742181ded4930842b46e9507372f0b1b963James Dong 10910c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10920c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLAW1 $a, $b, $c, $d, $cc 10930c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLAWT, SMLAWB, $a, $b, $c, $d, $cc 10940c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 10950c1bc742181ded4930842b46e9507372f0b1b963James Dong 10960c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 10970c1bc742181ded4930842b46e9507372f0b1b963James Dong SMULW0 $a, $b, $c, $cc 10980c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI3 SMULWB, SMULWT, $a, $b, $c, $cc 10990c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 11000c1bc742181ded4930842b46e9507372f0b1b963James Dong 11010c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 11020c1bc742181ded4930842b46e9507372f0b1b963James Dong SMULW1 $a, $b, $c, $cc 11030c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI3 SMULWT, SMULWB, $a, $b, $c, $cc 11040c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 11050c1bc742181ded4930842b46e9507372f0b1b963James Dong 11060c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// SMLALxy macros 11070c1bc742181ded4930842b46e9507372f0b1b963James Dong 11080c1bc742181ded4930842b46e9507372f0b1b963James Dong 11090c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 11100c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLAL00 $a, $b, $c, $d, $cc 11110c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLALBB, SMLALTT, $a, $b, $c, $d, $cc 11120c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 11130c1bc742181ded4930842b46e9507372f0b1b963James Dong 11140c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 11150c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLAL01 $a, $b, $c, $d, $cc 11160c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLALBT, SMLALTB, $a, $b, $c, $d, $cc 11170c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 11180c1bc742181ded4930842b46e9507372f0b1b963James Dong 11190c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 11200c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLAL0B $a, $b, $c, $d, $cc 11210c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLALBB, SMLALTB, $a, $b, $c, $d, $cc 11220c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 11230c1bc742181ded4930842b46e9507372f0b1b963James Dong 11240c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 11250c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLAL0T $a, $b, $c, $d, $cc 11260c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLALBT, SMLALTT, $a, $b, $c, $d, $cc 11270c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 11280c1bc742181ded4930842b46e9507372f0b1b963James Dong 11290c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 11300c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLAL10 $a, $b, $c, $d, $cc 11310c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLALTB, SMLALBT, $a, $b, $c, $d, $cc 11320c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 11330c1bc742181ded4930842b46e9507372f0b1b963James Dong 11340c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 11350c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLAL11 $a, $b, $c, $d, $cc 11360c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLALTT, SMLALBB, $a, $b, $c, $d, $cc 11370c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 11380c1bc742181ded4930842b46e9507372f0b1b963James Dong 11390c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 11400c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLAL1B $a, $b, $c, $d, $cc 11410c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLALTB, SMLALBB, $a, $b, $c, $d, $cc 11420c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 11430c1bc742181ded4930842b46e9507372f0b1b963James Dong 11440c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 11450c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLAL1T $a, $b, $c, $d, $cc 11460c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLALTT, SMLALBT, $a, $b, $c, $d, $cc 11470c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 11480c1bc742181ded4930842b46e9507372f0b1b963James Dong 11490c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 11500c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLALB0 $a, $b, $c, $d, $cc 11510c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLALBB, SMLALBT, $a, $b, $c, $d, $cc 11520c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 11530c1bc742181ded4930842b46e9507372f0b1b963James Dong 11540c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 11550c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLALB1 $a, $b, $c, $d, $cc 11560c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLALBT, SMLALBB, $a, $b, $c, $d, $cc 11570c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 11580c1bc742181ded4930842b46e9507372f0b1b963James Dong 11590c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 11600c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLALT0 $a, $b, $c, $d, $cc 11610c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLALTB, SMLALTT, $a, $b, $c, $d, $cc 11620c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 11630c1bc742181ded4930842b46e9507372f0b1b963James Dong 11640c1bc742181ded4930842b46e9507372f0b1b963James Dong MACRO 11650c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLALT1 $a, $b, $c, $d, $cc 11660c1bc742181ded4930842b46e9507372f0b1b963James Dong LIBI4 SMLALTT, SMLALTB, $a, $b, $c, $d, $cc 11670c1bc742181ded4930842b46e9507372f0b1b963James Dong MEND 11680c1bc742181ded4930842b46e9507372f0b1b963James Dong 11690c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF ;// ARMCOMM_S_H 11700c1bc742181ded4930842b46e9507372f0b1b963James Dong 11710c1bc742181ded4930842b46e9507372f0b1b963James Dong END 1172