home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine 1996 / ARCHIVE_96.iso / discs / mag_discs / volume_9 / issue_12 / clippings / StrongARM < prev   
Text File  |  1996-08-02  |  41KB  |  1,025 lines

  1. Introduction to the StrongARM                        Revision 2, 31-Jul-96
  2. =============================
  3.  
  4.  
  5. The StrongARM 110 is a new high-performance processor from Digital
  6. Semiconductor. It offers performance improvements over the ARM710 ranging
  7. from 100% to 1000%, depending on the application.
  8.  
  9. A StrongARM processor card will available for the Risc PC later this year.
  10. It will come with a new ROM set containing RISC OS 3.70, a new StrongARM-
  11. compatible version of RISC OS. These documents provide information on
  12. writing software, and modifying existing software, for StrongARM-based
  13. machines.
  14.  
  15.  
  16. Significant StrongARM features
  17. ------------------------------
  18.  
  19.     * 202MHz core clock
  20.       
  21.     * 5-stage pipeline (Fetch, Issue, Execute, Buffer, Write)
  22.       
  23.     * Separate 16K write-back data cache and 16K instruction cache
  24.       
  25.     * 8 entry write buffer, each entry holding 1-16 bytes
  26.       
  27.     * Fast 32 and 64 bit result multiply instructions
  28.     
  29.     * Averages fewer cycles per instruction than previous ARMs
  30.       
  31.  
  32. Incompatibilities
  33. -----------------
  34. The StrongARM has two significant differences from previous ARMs that
  35. can affect existing programs. Firstly, the split caches mean that
  36. instructions written into memory may linger in the data cache, and not
  37. be in real memory when the instruction cache comes to fetch them. Likewise
  38. if some code is already in the instruction cache, and it is altered, the
  39. changed code will not be noticed. Thus existing self-modifying code and
  40. dynamic code creation or loading will generally not work.
  41.  
  42. RISC OS 3.7 provides a call to synchronise the instruction and data caches,
  43. but this is a slow operation on the StrongARM. Self-modifying code should
  44. therefore be avoided. The most common failures here arise from custom
  45. SWI veneers that assemble code on the stack, dynamic code loading
  46. and linking and custom code squeezing and encryption.
  47.  
  48. The other significant StrongARM change is that storing the PC to memory
  49. (using STR or STM) stores PC+8 rather than PC+12. This can generally be
  50. catered for by judicious use of NOPs to allow for both possibilities.
  51. This affects, for example, APCS stack backtraces and vector claimants
  52. (the example code on PRM page 1-107 will not work, for example).
  53.  
  54. There are other differences that are only likely to be encountered by
  55. low-level system code.
  56.  
  57. Most applications will run unmodified on StrongARM, especially those
  58. written in C and BASIC, but some code will inevitably need modification.
  59.  
  60.  
  61. What to read next
  62. -----------------
  63. The file "Guidelines" gives a general overview of guidelines for authoring
  64. software for use on StrongARM based machines.
  65.  
  66. The file "SAsupport" details the new and extended SWIs in RISC OS 3.7
  67. to support the StrongARM.
  68.  
  69. The file "MiscChange" details other changes in RISC OS 3.7 that are not
  70. related to StrongARM compatibility.
  71.  
  72. The file "Performanc" gives hints on how to improve performance of code
  73. on StrongARM.
  74.  
  75. The file "FIQs" shows how to get FIQ code working on StrongARM.
  76.  
  77. Introduction to the StrongARM                        Revision 2, 31-Jul-96
  78. =============================
  79.  
  80.  
  81. The StrongARM 110 is a new high-performance processor from Digital
  82. Semiconductor. It offers performance improvements over the ARM710 ranging
  83. from 100% to 1000%, depending on the application.
  84.  
  85. A StrongARM processor card will available for the Risc PC later this year.
  86. It will come with a new ROM set containing RISC OS 3.70, a new StrongARM-
  87. compatible version of RISC OS. These documents provide information on
  88. writing software, and modifying existing software, for StrongARM-based
  89. machines.
  90.  
  91.  
  92. Significant StrongARM features
  93. ------------------------------
  94.  
  95.     * 202MHz core clock
  96.       
  97.     * 5-stage pipeline (Fetch, Issue, Execute, Buffer, Write)
  98.       
  99.     * Separate 16K write-back data cache and 16K instruction cache
  100.       
  101.     * 8 entry write buffer, each entry holding 1-16 bytes
  102.       
  103.     * Fast 32 and 64 bit result multiply instructions
  104.     
  105.     * Averages fewer cycles per instruction than previous ARMs
  106.       
  107.  
  108. Incompatibilities
  109. -----------------
  110. The StrongARM has two significant differences from previous ARMs that
  111. can affect existing programs. Firstly, the split caches mean that
  112. instructions written into memory may linger in the data cache, and not
  113. be in real memory when the instruction cache comes to fetch them. Likewise
  114. if some code is already in the instruction cache, and it is altered, the
  115. changed code will not be noticed. Thus existing self-modifying code and
  116. dynamic code creation or loading will generally not work.
  117.  
  118. RISC OS 3.7 provides a call to synchronise the instruction and data caches,
  119. but this is a slow operation on the StrongARM. Self-modifying code should
  120. therefore be avoided. The most common failures here arise from custom
  121. SWI veneers that assemble code on the stack, dynamic code loading
  122. and linking and custom code squeezing and encryption.
  123.  
  124. The other significant StrongARM change is that storing the PC to memory
  125. (using STR or STM) stores PC+8 rather than PC+12. This can generally be
  126. catered for by judicious use of NOPs to allow for both possibilities.
  127. This affects, for example, APCS stack backtraces and vector claimants
  128. (the example code on PRM page 1-107 will not work, for example).
  129.  
  130. There are other differences that are only likely to be encountered by
  131. low-level system code.
  132.  
  133. Most applications will run unmodified on StrongARM, especially those
  134. written in C and BASIC, but some code will inevitably need modification.
  135.  
  136.  
  137. What to read next
  138. -----------------
  139. The file "Guidelines" gives a general overview of guidelines for authoring
  140. software for use on StrongARM based machines.
  141.  
  142. The file "SAsupport" details the new and extended SWIs in RISC OS 3.7
  143. to support the StrongARM.
  144.  
  145. The file "MiscChange" details other changes in RISC OS 3.7 that are not
  146. related to StrongARM compatibility.
  147.  
  148. The file "Performanc" gives hints on how to improve performance of code
  149. on StrongARM.
  150.  
  151. The file "FIQs" shows how to get FIQ code working on StrongARM.
  152.  
  153. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  154.  
  155.  
  156.  
  157. * Code written in C or BASIC will generally work, but see issues below.
  158.  
  159. * Code using the shared C library or Toolbox is generally fine. Using
  160.   RISCOS_Lib may cause problems, depending on the variant - re-linking
  161.   to a revised implementation will typically be sufficient. Anything linked
  162.   with ANSILib will not work. Products should _not_ be linked with ANSILib.
  163.  
  164. * Proprietary code squeezers may cause problems. Unsqueezed code or standard
  165.   squeezed code with AIF headers (eg code produced with our Squeeze system)
  166.   is generally fine. A new module, UnsqueezeAIF, detects squeezed images and
  167.   unsqueezes them itself with a negligible performance penalty.
  168.  
  169. * An application patcher will be supplied with RISC OS 3.7 that is capable
  170.   of detecting some known StrongARM-incompatible code sequences in an AIF image
  171.   and replacing them before the image is executed. This is only a temporary
  172.   solution though. If you find your software works only because the patcher
  173.   is patching it, you should modify it so it does not need patching.
  174.  
  175. * All Absolute files must have valid AIF headers. Absolute files without AIF
  176.   headers and untyped files are deprecated.
  177.   
  178. When writing in Assembler:
  179.  
  180. * Any self-modifying code or dynamically generated code is a problem. RISC OS
  181.   3.7 provides a SWI to support StrongARM synchronisation to dynamic code, but
  182.   the performance penalty is typically severe; cleaning the data cache will take
  183.   some time, and the entire instruction cache must be flushed. Hence, most cases
  184.   of dynamic code can no longer be justified, and should be reimplemented in a
  185.   static manner. One common reason for dynamic code is the calling of a SWI by
  186.   SWI code passed in a register. RISC OS 3.7 provides a new SWI which implements
  187.   this in an entirely static manner.
  188.  
  189. * The StrongARM pipeline is generally not a problem (even though it is now
  190.   5 levels deep rather than 3). The main issue is storing of the PC to memory
  191.   using STR and STM; this now stores PC+8 instead of PC+12. Code should be made
  192.   to work whether PC+8 or PC+12 is stored (so that ARM 6,7 are still supported).
  193.   Use of the PC in data processing instructions (MOV, ADD etc) remains
  194.   unaltered on StrongARM.
  195.  
  196. * STRB PC has an undefined result. This has sometimes been used as a shortcut
  197.   for storing a non-zero semaphore value in speed critical code. This
  198.   instruction should no longer be used. Use STR PC or STRB of some other
  199.   register.
  200.  
  201. Other differences at the assembler level, which affect RISC OS itself but
  202. are unlikely to affect applications are:
  203.  
  204. * StrongARM does not support 26 bit configuration. It does support 26 bit
  205.   mode within a 32 bit configuration.
  206.  
  207. * The control of architecture functions via coprocessor #15 is significantly
  208.   different. The requirements for context switching are significantly more
  209.   complex.
  210.  
  211. * The 'abort timing' (definition of values in affected registers) for data
  212.   aborts has changed.
  213.  
  214. * Reading from the processor vector area (words 00 to 1C inclusive) in
  215.   26 bit mode now causes an abort. In some circumstances this is trapped by
  216.   RISC OS 3.7 and the old behaviour simulated, but this must not be relied upon.
  217.  
  218. At the hardware level:
  219.  
  220. * When storing a byte, previous ARMs replicate the byte across the
  221.   entire 32 bit data bus. StrongARM only outputs the byte on the
  222.   relevant byte lane. The StrongARM processor card implements a compatibility
  223.   fix for pre-Risc PC style podules as follows: bytes stored to word aligned
  224.   addresses (byte 0) will be replicated on byte 2.  This should allow most podules
  225.   to work without firmware changes.
  226.  
  227. Backwards compatibility:
  228.  
  229. * Much StrongARM-ready code (especially in libraries, such as the aforementioned
  230.   revised RISC_OSLib) may use the new SWI-calling mechanism. Therefore a new module
  231.   "CallASWI" will be made available for use on RISC OS 3.1, 3.5 and 3.6 to provide
  232.   the SWIs OS_CallASWI, OS_CallASWIR12, OS_PlatformFeatures and
  233.   OS_SynchroniseCodeAreas.
  234.  
  235.  
  236. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  237.  
  238.  
  239.  
  240. This note describes the new or revised SWIs in the StrongARM-aware version
  241. of RISC OS, and gives some guidance on use.
  242.  
  243.  
  244.                           CHANGES TO EXISTING SWIS
  245.                           ========================
  246.                        
  247. OS_MMUControl (page 5a-70)
  248. --------------------------
  249.  
  250.     This SWI has a new reason code, to support platform independent cache
  251.     and/or TLB flushing:
  252.  
  253. OS_MMUControl 1 (SWI &6B)
  254. -------------------------
  255.  
  256.     Cache flush request
  257.     
  258. On entry
  259.     R0 = reason code and flags
  260.            bits 0-7  = 1 (reason code)
  261.            bits 8-28 reserved (must be zero)
  262.            bit 29 set if flush of single entry, else complete flush
  263.            bit 30 set if processor TLBs are to be flushed
  264.            bit 31 set if processor caches are to be flushed
  265.     R1 = logical address, if R0 bit 29 set
  266.  
  267. On exit
  268.     R0,R1 preserved
  269.  
  270. Interrupts
  271.     Interrupt status is not altered
  272.     Fast interrupts are enabled
  273.  
  274. Processor mode
  275.     Processor is in SVC mode
  276.  
  277. Re-entrancy
  278.     SWI is not re-entrant
  279.     
  280. Use
  281.     This call implements platform independent cache and/or TLB flushing.
  282.     
  283.     WARNING: This SWI reason code is only intended for occasional, unavoidable
  284.              requirements for cache/TLB flushing. You should respect the
  285.              performance implications of this SWI reason code, in a similar
  286.              way to SWI OS_SynchroniseCodeAreas.
  287.              
  288.     Currently, bit 29 is ignored, so that only whole flushing of caches
  289.     and/or TLBs are supported. A cache will be cleaned before flushing,
  290.     where the processor supports a write-back cache.
  291.  
  292.     This reason code is not re-entrant. Interrupts are not disabled during
  293.     the flush, so the cache or TLB flush can only be considered to be complete
  294.     with respect to logical addresses that are not currently involved in
  295.     interrupts.
  296.  
  297.  
  298. OS_File 12, 14, 16 and 255 (page 2-40)
  299. --------------------------------------
  300. If R3 bit 31 is set on entry, the file being loaded will be treated as code,
  301. and the relevant area will be synchronised using OS_SynchroniseCodeAreas if
  302. necessary.
  303.  
  304. A filetype for Code (&F95) has been allocated, with the intention that it
  305. be a parallel of Data (&FFD), and when it is loaded a synchronise is
  306. automatically performed. However this functionality has _not_ been implemented
  307. in RISC OS 3.70; you will still need to set bit 31 as described above.
  308.  
  309.  
  310. DMA (page 5a-83)
  311. ----------------
  312. The DMA Manager now marks pages uncacheable for both transfers from device
  313. to memory and transfers from memory to device. This is to ensure StrongARM's
  314. write-back cache is cleaned before the transfer starts.
  315.  
  316.  
  317.  
  318.                              NEW SERVICE CALLS
  319.                              =================
  320.  
  321. Service_UKCompression (Service call &B7)
  322. ----------------------------------------
  323.  
  324.     An application that may need unsqueezing/patching has just been loaded
  325.     
  326. On entry
  327.     R0 = subreason code
  328.            0 -> first pass (unsqueeze)
  329.            1 -> second pass (patch)
  330.            all other codes reserved
  331.     R1 = &B7 (reason code)
  332.     R2 = load address
  333.     R3 = size
  334.     R4 = execute address
  335.     R5 = filename (as passed to FileSwitch, not canonicalised)
  336.  
  337. On exit
  338.     R1 preserved to pass on, or 0 to claim if you know you have performed
  339.     all required unsqueezeing/patching for this pass.
  340.     R3 may be modified to indicate an altered size (eg after unsqueezing)
  341.     R4 may be modified to specify an new execute address
  342.     Other registers preserved
  343.  
  344. Use
  345.     This service call is passed around when an Absolute (&FF8) file is run.
  346.     The sequence of events is as follows.
  347.     
  348.       1) The image is loaded.
  349.       2) If it does not contain an unsqueezed AIF header, then
  350.          Service_UKCompression 0 is issued.
  351.       3) Service_UKCompression 1 is issued.
  352.       4) OS_SynchroniseCodeAreas is called.
  353.     
  354.     Therefore unsqueezers and patchers need not do any synchronisation
  355.     except that necessary for their internal working (they may want to alter
  356.     some code, synchronise, and call it before returning from the service
  357.     call).
  358.     
  359.     Two modules are supplied with RISC OS 3.7 that use this service call:
  360.     
  361.         UnsqueezeAIF will unsqueeze squeezed AIF images on the first pass, and
  362.         squeezed non-AIF images by code modification (so the unsqueeze will
  363.         not occur until after stage 5 above)
  364.     
  365.         AppPatcher will patch squeezed and unsqueezed AIF images containing
  366.         certain common code sequences that are known to fail on StrongARM.
  367.  
  368.     Scanning an application for code sequences is a relatively slow operation.
  369.     Therefore a bit has been allocated in the AIF header to indicate that
  370.     a program is "StrongARM-ready". If bit 31 of the 13th word of the AIF
  371.     header (ie bit 31 of location &8030 in the loaded image) is set, the
  372.     patching stage will be skipped (in RISC OS 3.7 by AppPatcher claiming
  373.     the service call and doing nothing; in a future version of RISC OS
  374.     FileSwitch may not issue the service call). The program will still be
  375.     automatically unsqueezed; it is recommended that you continue to use the
  376.     existing Squeeze utility provided with Acorn C/C++, and rely on the
  377.     operating system to unsqueeze the image for you.
  378.    
  379.    
  380. Service_ModulePreInit (Service call &B9)
  381. ----------------------------------------
  382.  
  383.     A module is about to be initialised
  384.     
  385. On entry
  386.     R0 = module address
  387.     R1 = &B9 (reason code)
  388.     R2 = module length
  389.  
  390. On exit
  391.     R1 preserved to pass on
  392.  
  393. Use
  394.     This service is called just before a module is initialised. When a
  395.     module is *RMLoaded:
  396.     
  397.        1) The module is loaded into memory
  398.        2) The module is unsqueezed if necessary
  399.        3) Service_ModulePreInit is called
  400.        4) OS_SynchroniseCodeAreas is called
  401.     
  402.     This service call is intended to allow run-time patching of modules.
  403.     
  404.     
  405.                                   NEW SWIS
  406.                                   ========
  407.  
  408. OS_PlatformFeatures (SWI &6D)
  409. -----------------------------
  410.  
  411.     Determine various features of the host platform
  412.  
  413. On entry
  414.     R0 = reason code (bits 0-15) and flags (bits 16-31, reason code specific)
  415.     Other registers depend upon the reason code
  416.  
  417. On exit
  418.     Registers depend upon the reason code
  419.  
  420. Interrupts
  421.     Interrupt status is unaltered
  422.     Fast interrupts are enabled
  423.     
  424. Processor mode
  425.     Processor is in SVC mode
  426.  
  427. Re-entrancy
  428.     SWI is re-entrant
  429.  
  430. Use
  431.     This new SWI is used to determine various feaures of the platform that the
  432.     application or module is running on.
  433.  
  434.     The particular action of OS_PlatformFeatures is given by the reason code in
  435.     bits 0-15 of R0 as follows:
  436.     
  437.         R0    Action
  438.         0     Read code features
  439.  
  440.  
  441. OS_PlatformFeatures 0 (SWI &6D)
  442. -------------------------------
  443.  
  444.     Read code features
  445.  
  446. On entry
  447.     R0 = 0 (reason code); all flags are reserved, so bits 16-31 must be clear
  448.  
  449. On exit
  450.     R0 = bit mask of features:
  451.            Bits     Meaning
  452.            0        Must tell OS when code areas change (by calling
  453.                     OS_SynchroniseCodeAreas)
  454.            1        Enabling, then immediately disabling interrupts will _not_
  455.                     give interrupts a chance to occur
  456.            2        Must be in 32 bit mode to read hardware vectors
  457.            3        Storing PC to memory (eg with STR or STM) stores PC+8
  458.                     rather than PC+12
  459.            4        Data aborts occur with 'full early' timing (ie. as defined
  460.                     by ARM architecture 4)
  461.                                 
  462.    If bit 1 of R0 set then                             
  463.      R1 -> routine to call (with BL) between IRQ enable & disable.
  464.  
  465. Use
  466.     This call determines features of the host processor's instruction set.
  467.     
  468.     Platforms running ARM 6 or 7 cores will return with R0 bits 0-4 clear;
  469.     platforms running StrongARM will return with bits 0-4 set. For
  470.     compatibility with older versions of RISC OS, you should call this SWI in
  471.     the X form; if V is set on return and the error is 'SWI not known', then
  472.     this can be taken as equivalent to a return with R0 bits 0-4 clear. Note
  473.     that the easiest way to deal with the PC+8/PC+12 issue across all
  474.     platforms is to make sure that the code is valid in either case (typically
  475.     with judicious use of NOPs).
  476.     
  477.     The routine pointed to by R1 is suitable for calling from any 26-bit mode;
  478.     it preserves all flags and registers, and is reentrant.
  479.  
  480.  
  481. OS_SynchroniseCodeAreas (SWI &6E)
  482. ---------------------------------
  483.  
  484.     Inform the OS that code has been altered
  485.  
  486. On entry
  487.     R0 = flags
  488.            bit 0 clear  Entire address space to be synchronised.
  489.            bit 0 set    Address range to be synchronised.
  490.            bits 1-31    Reserved
  491.  
  492.     If R0 bit 0 is set then:
  493.         R1 = low address of range (word aligned)
  494.         R2 = high address (word aligned, _inclusive_)
  495.  
  496. On exit
  497.     R0-R2 preserved
  498.  
  499. Interrupts
  500.     Interrupt status is not altered
  501.     Fast interrupts are enabled
  502.  
  503. Processor mode
  504.     Processor is in SVC mode
  505.  
  506. Re-entrancy
  507.     SWI is not re-entrant
  508.  
  509. Use
  510.     This new SWI informs the OS that code has been newly generated or
  511.     modified in memory, before any attempt is made to execute the code.
  512.  
  513.     WARNING: This SWI is only intended for synchronisation with unavoidable
  514.              use of dynamic code, because of the potential for large
  515.              performance penalties. There is no longer any justification in
  516.              RISC OS applications for frequent code modification. This call
  517.              must never be used in an interrupt routine. Examples of
  518.              reasonable use include one-off loading, relocation etc. of
  519.              subsidiary code or libraries.
  520.      
  521.     When using this SWI, you should use the ranged variant wherever possible,
  522.     in order to minimise the performance penalty.
  523.     
  524.     The call may take a long time to return (up to around 0.5ms), so it should
  525.     not be called with interrupts disabled.
  526.  
  527.     For compatibility with older versions of RISC OS, you should either have
  528.     determined (with OS_PlatformFeatures) that this SWI should not be called,
  529.     or always call this SWI in the X form, and ignore any error returned. On
  530.     platforms that do not require code synchronisation (as indicated by
  531.     OS_PlatformFeatures 0), OS_SynchroniseCodeAreas will do nothing.
  532.  
  533.     Note that standard loading of applications or modules (and the standard C
  534.     overlay system) are automatically handled by the OS, and do not require
  535.     synchronisation. This may be defeated by custom squeezing, failure to use
  536.     a standard AIF header for applications, and so on.
  537.  
  538.  
  539. OS_CallASWI (SWI &6F)
  540. ---------------------
  541.  
  542.     Call a run-time determined SWI
  543.  
  544. On entry
  545.     R0-R9 as required for target SWI
  546.     R10 = target SWI number
  547.  
  548. On exit
  549.     R0-R9 as defined by target SWI
  550.     R10 preserved
  551.  
  552. Interrupt status
  553.    As defined by target SWI
  554.  
  555. Processor mode
  556.    As defined by target SWI
  557.  
  558. Re-entrancy
  559.    As defined by target SWI
  560.  
  561. Use
  562.     This new SWI allows a target SWI number to be determined at run time, and
  563.     passed in a register. This removes the need for a common idiom of
  564.     dynamic code, in language library SWI veneers for example. In an APCS-R
  565.     library, OS_CallASWIR12 may be more appropriate (see below).
  566.  
  567.     Note that OS_CallASWI is merely an alias for calling the target SWI.
  568.     It has no entry/exit conditions of its own, except for the special
  569.     use of R10. To call a target SWI with X bit set, us the X form of
  570.     the SWI number in R10; there is no distinction between OS_CallASWI
  571.     and XOS_CallASWI.
  572.  
  573.     You cannot call OS_CallASWI or OS_CallASWIR12 via OS_CallASWI, since there
  574.     is no defined final target SWI in this case.
  575.  
  576.     You cannot usefully call OS_BreakPt or OS_CallAVector using OS_CallASWI,
  577.     as OS_CallASWI will corrupt the processor flags before entering the
  578.     target SWI.
  579.     
  580.     For future compatibility, you should always use this SWI in preference
  581.     to any local construction for calling a SWI by number. For compatibility
  582.     with older versions of RISC OS, a new CallASWI module will be made available
  583.     (see below).
  584.     
  585.     Note that this SWI calling mechanism is almost certainly faster than
  586.     any other alternative implementation, including the original _kernel_swi
  587.     and _swix code contained in older versions of the SharedCLibrary. The
  588.     new SharedCLibrary now simply uses OS_CallASWIR12 for _kernel_swi and
  589.     _swix.
  590.     
  591.     OS_CallASWI cannot be called from BASIC as BASIC only passes registers
  592.     R0-R7 via its SYS instruction. It would not be useful anyway.
  593.  
  594.  
  595. OS_AMBControl (SWI &70)
  596. -----------------------
  597.  
  598.     This SWI is for system use only; you must not use it in your own code.
  599.  
  600.  
  601. OS_CallASWIR12 (SWI &71)
  602. ------------------------
  603.  
  604.     Call a run-time determined SWI
  605.  
  606. On entry
  607.     R0-R9 as required for target SWI
  608.     R12 = target SWI number
  609.  
  610. On exit
  611.     R0-R9 as defined by target SWI
  612.     R12 preserved
  613.  
  614. Interrupt status
  615.    As defined by target SWI
  616.  
  617. Processor mode
  618.    As defined by target SWI
  619.  
  620. Re-entrancy
  621.    As defined by target SWI
  622.  
  623. Use
  624.     This call is identical to OS_CallASWI, except that it uses R12 to specify
  625.     the target SWI. This may be more convenient in some environments. In
  626.     particular under APCS-R, R10 is the stack limit pointer, which must be
  627.     preserved at all times; if a SWI called using OS_CallASWI were to abort
  628.     or generate an error the run-time library would usually examine R10
  629.     and decide that it had no stack to handle the abort or error. Therefore
  630.     APCS-R libraries must use OS_CallASWIR12 (R12 being a scratch register
  631.     under APCS-R).
  632.  
  633.  
  634.                       THE CALLASWI MODULE
  635.                       ===================
  636.  
  637. The CallASWI module provides support under RISC OS 3.1, 3.5 and 3.6 for
  638. the following SWIs:
  639.  
  640.               OS_CallASWI
  641.               OS_CallASWIR12
  642.               OS_PlatformFeatures
  643.               OS_SynchroniseCodeAreas
  644.  
  645. This will enable application programmers and library writers to use the
  646. new calls freely without any worries about backwards compatibility. There
  647. is no performance penalty for the use of these SWIs via the CallASWI
  648. module. One slight caveat is that older machines will not know the
  649. _names_ of these SWIs; they would have to be called by number from BASIC.
  650.  
  651.  
  652.  
  653. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  654.  
  655.  
  656.  
  657. This section documents miscellaneous other changes in RISC OS 3.7
  658. that are not directly related to the need to support StrongARM.
  659.  
  660. The Kernel
  661. ==========
  662. The System ROM is now marked read-only in the MMU page tables of machines
  663. with an ARM7 or later processor. Attempts to write to ROM space will cause
  664. a data abort.
  665.  
  666. The kernel is now aware of multiple applications (see below).
  667.  
  668. FileSwitch
  669. ==========
  670. FileSwitch now supports 2048-byte buffers (see FSEntry_Open on
  671. page 2-531).
  672.  
  673. The Window Manager
  674. ==================
  675. The Window Manager has now delegated application memory management
  676. to the kernel. The kernel is now aware of multiple application memory
  677. blocks (AMBs) and pages them in and out when requested by the Window
  678. Manager. This improves task switching performance, as the kernel is
  679. able to remap AMBs far faster than the Window Manager was able to
  680. using OS_SetMemMapEntries.
  681.  
  682. The Font Manager
  683. ================
  684. The Font Manager now supports background blending in modes with
  685. 256 colours or more. This blending causes the anti-aliased pixel
  686. data to be blended with the background colour rather than using the
  687. fixed colour specified in the various colour setting SWIs.
  688.  
  689. To use the blending, you should set bit 11 of R2 in the call to Font_Paint.
  690. However, you need to ensure the following:
  691.  
  692.     1) The font colours specify that there is >= 1 anti-aliasing colour,
  693.        otherwise the Font Manager will attempt to paint from 1bpp cache
  694.        data rather than the 4bpp anti-aliased data.
  695.     
  696.     2) The Font Manager you are calling supports this bit, as previous
  697.        versions of the Font Manager will complain if they find this bit
  698.        set. You should call Font_CacheAddr to check the version of
  699.        the Font Manager your application is running on, and only set
  700.        the bit on Font Manager 3.35 or later.
  701.  
  702. There is a noticeable speed hit in using blending, so you should not
  703. use it if you know you are plotting onto a uniform background.
  704.  
  705. Debugger
  706. ========
  707. SWI Debugger_Disassemble is now aware of the complete ARMv4 instruction
  708. set.
  709.  
  710. Note that the LDRH, LDRSH and STRH instructions are not supported by the
  711. Risc PC memory system; although they will often work in a cached area
  712. because memory is accessed a 4 or 8 words at a time, they will not work
  713. reliably. LDRSB, MULL and MLAL may be freely used (except of course they
  714. won't be backwards-compatible). 
  715.  
  716. Econet
  717. ======
  718. A StrongARM-compatible Econet module has been placed in the System ROM,
  719. rather than the RiscPC/A7000 Econet card firmware being upgraded.
  720.  
  721. The Internet module
  722. ===================
  723. The Internet module supplied with RISC OS 3.70 is a major new version
  724. based on FreeBSD, a 4.4BSD-derived Unix. It offers improved performance,
  725. and a wider API, including support for multicasting and T/TCP. All calls
  726. documented in chapter 123 of the Programmer's Reference Manual continue
  727. to work as documented, but some of the lower-level socketioctl calls,
  728. particularly those to do with route manipulation have been withdrawn.
  729. More details will be made available later.
  730.  
  731. A revised !Internet application is supplied as part of the !Boot structure
  732. and a new application provides an easy interface for configuring the
  733. various networking components built in to RISC OS 3.7
  734.  
  735. Access
  736. ======
  737. Access Plus is now in the System ROM, instead of being supplied in the
  738. System application on the hard disc.
  739.  
  740. AUN
  741. ===
  742. A new subreason code of Service_InternetStatus has been added;
  743. Service_InternetStatus 1 is issued when the Net module receives a
  744. network map from a gateway station.
  745.  
  746.  
  747.  
  748. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  749.  
  750.  
  751.  
  752. Performance issues
  753. ==================
  754.  
  755. The StrongARM has significantly different performance characteristics to
  756. older ARM processors. It is clocked 5 times faster than any previous ARM,
  757. and many instructions execute in fewer cycles. In particular
  758.  
  759.     *  B/BL take 2 cycles, rather than 3
  760.     *  MOV PC,Rn and ADD PC,PC,Rn,LSL #2 etc take 2 cycles rather than 3
  761.     *  LDR takes 2 cycles (from the cache) rather than 3, and will take
  762.        only 1 cycle if the result is not used in the next instruction.
  763.     *  STR takes 1 cycle rather than 2, if the write buffer isn't full
  764.     *  MUL/MLA take 1-3 cycles rather than 2-17 cycles.
  765.     *  Many instructions will in fact take only one cycle provided the
  766.        result is not used in the next instruction.
  767.  
  768. For fuller information see the StrongARM Technical Reference Manual,
  769. available from Digital Semiconductor's WWW site (currently at
  770. http://www.digital.com/info/semiconductor/dsc-strongarm.html)
  771.  
  772. The StrongARM's cache and write buffer are also significantly better than
  773. previous ARMs, allowing an average fivefold speed increase, despite the
  774. unaltered system bus. Pumping large amounts of data will still be limited
  775. by the system bus, but advantage can be taken of the write buffer to
  776. interleave a large amount of processing with memory accesses. For example
  777. on StrongARM it is quicker to plot a 4bpp sprite to a 32bpp mode than to
  778. plot a 32bpp sprite to a 32bpp mode; the latter case is pure data transfer,
  779. while the former is less data transfer with interleaved (ie effectively
  780. free) processing.
  781.  
  782. The long cache lines of the ARM710 and StrongARM can impact performance.
  783. A random read or instruction fetch from a cached area will load 8 words
  784. into the cache; this can make traversal of a long linked list inefficient.
  785. It is also often worth aligning code to an 8-word boundary. In current
  786. versions of RISC OS modules are loaded at an address 16*n+4. Future
  787. versions of RISC OS will probably load modules at an address 32*n+4, so it
  788. is worth aligning your service call entries appropriately in preparation
  789. for this change.
  790.  
  791. Two significant disadvantages of StrongARM over previous processors
  792. are:
  793.  
  794.     1) Burst reads are not performed from uncached areas. In particular
  795.        this means that reads from the screen are slower on the StrongARM
  796.        than on previous ARMs. A future version of RISC OS may address this
  797.        by marking the screen cacheable before reading (eg in a block copy
  798.        operation). Also, burst writes are not performed to unbuffered
  799.        areas.
  800.        
  801.     2) Code modification is expensive. You can modify code, but a
  802.        complete SynchroniseCodeAreas can take of the order of half
  803.        a millisecond (ie 100000 processor cycles) to execute, and will
  804.        flush the entire instruction cache. Thus use of self-modifying
  805.        code is strongly deprecated; a static alternative will almost
  806.        always be faster. Synchronisation of a single word (eg modifying
  807.        a hardware vector) is cheaper (of the order of 100 processor
  808.        cycles) but still requires the whole instruction cache to be
  809.        flushed.
  810.  
  811. Note that future processors will no doubt have different performance
  812. characteristics again; you shouldn't optimise your code too much for one
  813. particular architecture at the expense of others. However, hopefully you
  814. will now have a better idea how to get better performance from your
  815. StrongARM.
  816.  
  817.  
  818.  
  819. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  820.  
  821.  
  822.  
  823. Use of FIQs
  824. ===========
  825.  
  826. FIQ usage is now deprecated. When you modify the FIQ vector, you will need
  827. to synchronise the code. However, as FIQ routines cannot call SWIs you are
  828. unable to call OS_SynchroniseCodeAreas. For StrongARM compatibility we
  829. recommend you use the FIQ vector as follows:
  830.  
  831.      0000001C: LDR PC,&00000020
  832.      00000020: <address of FIQ handler>
  833.      
  834. and use the following code to do the synchronise manually when you write
  835. the instruction at location &1C (no synchronise is required when you alter
  836. the address at &20).
  837.  
  838.         .
  839.         <alter FIQ vector>
  840.         .
  841.         MRC    CP15,0,R0,C0,C0           ; get processor ID
  842.         AND    R0,R0,#&F000
  843.         TEQ    R0,#&A000
  844.         BNE    NotStrongARM
  845.         MOV    R0,#&1C           
  846.         MCR    CP15,0,R0,C7,C10,1        ; clean data cache entry for FIQ vector
  847.         MOV    R0,#0
  848.         MCR    CP15,0,R0,C7,C10,4        ; drain write buffer
  849.         MCR    CP15,0,R0,C7,C5           ; flush whole instruction cache
  850.   NotStrongARM
  851.         .
  852.         .
  853.         .
  854.  
  855. If you want to write a complete FIQ handler into locations &1C to &FC, you
  856. should clean each 32-byte data cache line containing written code thus:
  857.  
  858.   replace
  859.         MOV     R0,#&1C
  860.         MCR     CP15,0,R0,C7,C10,1
  861.         
  862.   with
  863.         MOV     R0,#&E0              ; clean complete FIQ area
  864.   01    MCR     CP15,0,R0,C7,C10,1   ; 32 bytes (1 cache line) at a time
  865.         SUBS    R0,R0,#&20
  866.         BGE     %BT01
  867.         
  868. This will usually be slower than the approach recommended above.
  869.  
  870. This is, of course, not a future-proof solution. We recommend that no new
  871. products use FIQ code. If you feel you have a pressing need to use FIQs,
  872. contact ART Developer Support for advice.
  873.  
  874.  
  875. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  876.  
  877.  
  878.  
  879. <Acorn Risc Technologies>
  880. ----------------------------------------------------------------------
  881. ART's Latest Arrival
  882. ----------------------------------------------------------------------
  883.  
  884. We have now had the opportunity to do some more work with the StrongARM samples and RISC OS. 
  885. New test results below.
  886.  
  887. The part currently under test is running at 200MHz; this is the clock speed of the forthcoming production 
  888. version.
  889.  
  890. Press comment see below
  891.  
  892. Developer performance results following testing 
  893.  
  894. Want to know more?
  895. If your questions about StrongARM are not answered by the information on this page, try the StrongARM 
  896. FAQ.
  897.  
  898. Please note that this page (as with all pages on our Web site) and the pictures connected to it are 
  899. covered by copyright restrictions. The information and pictures provided may not be used external 
  900. to Acorn without specific permission
  901.  
  902. Original announcement
  903. Acorn Risc Technologies is proud to announce that at 11:12 on Tuesday 26th March 1996, the first 
  904. prototype Risc PC StrongARM Processor Card was powered up.
  905.  
  906. This experimental card, using a first release of prototype silicon managed to achieve an internal clock 
  907. speed of 228MHz, produced a first bench mark reading of 290,000 Dhrystones whilst running Risc OS.  
  908. The prototype card came up far quicker than anticipated due to the large amount of design work that had 
  909. already taken place.  At the time of writing, the StrongARM card is running RISC OS and supporting a 
  910. number of applications such as !Draw and !ChangeFSI, Artworks viewer, Network stack, Intertalk web 
  911. Browser.
  912.  
  913. Based on the experience gained with the PC cards and the multiprocessor cards, ART are now confident 
  914. that a cacheless Strong ARM processor card will offer dramatic and significant performance 
  915. improvements. As a result of this ART confirm that they will be producing a cacheless StrongARM 
  916. upgrade card for the Risc PC for sale when large quantities of silicon are availiable.
  917.  
  918. More information and ordering details will be available shortly on this web site.  
  919.  
  920. <Picture of StrongARM processor card>Click here for a 93k JPEG copy of this picture
  921.  
  922. <Picture of Risc PC complete with StrongARM card
  923. and RISC OS desktop>Click here for a 52k annotated JPEG of this picture
  924.  
  925. <picture of StrongARM processor card and 586 card>Click here for a 155k JPEG of this image.
  926.  
  927. ----------------------------------------------------------------------
  928. So what's it like to use?
  929. Quick - and seriously responsive. Following further optimisations, it is now even faster than the previous 
  930. set of benchmarks indicated; new benchmarks are below. While testing and setting up the pictures above 
  931. and dragging the Mona Lisa JPEG around in !Draw there was no waiting for it to redraw and resize.
  932.  
  933. Applications timings are given below and are approximate.
  934.  
  935.           Test               A           B        C     D      E
  936. ARM 710 40MHz             50,000 (28)   2.98    1.78  12.1   13.7   
  937. StrongARM 110 200MHz      355,000 (202) 0.50    0.32   2.2    2.7
  938.  
  939.   Test A 
  940.         Dhrystone 2.1 rating. Figure in brackets indicates Dhrystone MIPS. 
  941.   Test B 
  942.         Mona Lisa JPEG processed by !ChangeFSI into 256 colour sprite. Timings (in seconds) 
  943.         obtained from !ChangeFSI. 
  944.   Test C 
  945.         As test B, but into 32,000 colour sprite. Timings (in seconds) obtained from !ChangeFSI. 
  946.   Test D 
  947.         Screen redraw including !AWRender (Artworks renderer) "Apple" file in 256 colours. 
  948.         Timings (in seconds) obtained manually. 
  949.   Test E 
  950.         As test D but in 32,000 colours. Timings (in seconds) obtained manually.
  951. ----------------------------------------------------------------------
  952. Press comment
  953. On 10th April THE TIMES (London) published an article about this card entitled "Acorn's cracking card". 
  954. It is in the Interface section of the Times and also on the Times Web Site. (You will need to register to 
  955. read this, but registration is free at the current time). 
  956.  
  957. <>
  958. Comments on these pages are welcome and can be made by using the 
  959. <>comment facility or by emailing webmaster@art.acorn.co.uk
  960. ----------------------------------------------------------------------
  961. Return to Acorn Risc Technologies home page
  962. Return to HOTSTUFF
  963. E&OE All trademarks acknowledged
  964. File HOTSTUFF/StrongARM.html last modified on 25th July 1996 by DW
  965. Acorn Risc Technologies is an operating division of Acorn Computers Limited, part of the Acorn 
  966. Computer Group plc
  967. Copyright (c) 1996 Acorn Computer Group plc
  968.                                                                                                                                                                
  969.  
  970. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  971.  
  972.  
  973. <Acorn Risc Technologies>
  974. ----------------------------------------------------------------------
  975. Software Tested and Working on StrongARM
  976. ----------------------------------------------------------------------
  977.  
  978. We have now had the opportunity to do some testing with the StrongARM samples and third-party 
  979. software. This is showing very encouraging results - both in terms of speed and overall software 
  980. compatibility with StrongARM. We hope to have more information in due course, both as to compatibility 
  981. and to performance.
  982.  
  983. The information below is subject to continuous update as developers come to ART and test their software; 
  984. all results below are published with the permission of the developer involved:
  985.  
  986. Information from Beebug
  987.   Sleuth 2
  988. The file "kidsbook" as supplied with Sleuth 2 takes 72 seconds to convert on a Risc PC 700. It takes 20 
  989. seconds on StrongARM - at a conversion rate of 1,944 words per minute. 
  990.   Ovation Pro
  991. Picture runaround Dolphin image takes 9 seconds on a Risc PC 700, reduced to less than 2 seconds on a 
  992. StrongARM. 
  993. Sleuth, Masterfile 3, Hard Disc Companion, TypeStudio, Desktop Thesaurus, PlayBack, ArcScan, 
  994. Chartwell, DeskEdit and MenuBar have also been tested with successful results. 
  995.  
  996. Information from Gnome
  997.   !X
  998. The !X X server runs approximately twice as fast as on a Risc PC 700. 
  999.  
  1000. Information from David Pilling
  1001.  
  1002. Chess II, Trace, d2font, Snap and Spark have been tested and are known to work (Chess II and Trace both 
  1003. exhibit an impressive increase in speed); SparkFS required a small patch to be implemented, and the patch 
  1004. kit is now available via http://www.netlink.co.uk/users/pilling/ 
  1005.  
  1006. Information from Spacetech
  1007.   Photodesk
  1008. Photodesk runs successfully on StrongARM, at a speed significantly higher than on a Risc PC 700 (up to a 
  1009. factor of 10 times faster). 
  1010.  
  1011. <>
  1012. Comments on these pages are welcome and can be made by using the 
  1013. <>comment facility or by emailing webmaster@art.acorn.co.uk
  1014. ----------------------------------------------------------------------
  1015. Return to Acorn Risc Technologies home page
  1016. Return to HOTSTUFF
  1017. E&OE All trademarks acknowledged
  1018. File HOTSTUFF/sacompat.html last modified on 25th July 1996 by DW
  1019. Acorn Risc Technologies is an operating division of Acorn Computers Limited, part of the Acorn 
  1020. Computer Group plc
  1021. Copyright (c) 1996 Acorn Computer Group plc
  1022.                                                                                                                                                                
  1023. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  1024.  
  1025.