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