• Jeffrey Lee's avatar
    Add new PSR manipulation macros, optimised for 32bit machines · 71306206
    Jeffrey Lee authored
    Detail:
      Many of our existing PSR manipulation macros (specifically, ones used for changing mode or controlling interrupts) are based around the code sequences you'd typically use on a 26bit system. Although this has worked well in terms of producing a 32bit version of the OS, it's also left us with macros that can be sub-optimal for 32bit machines, or are inconvenient to use due to the potential of corrupting other PSR flags
      This change adds a new set of macros which are designed and optimised for 32bit-only targets, but can still fall back to 26/32bit neutral or 26bit-only configurations
      hdr/CPU/Generic32:
      - Add the new macros (SEI, CLI, SetModeSEI, SetModeCLI & variants).
      - Improve existing SetMode macro to add 26bit compatibility, and to add an extra optimisation for pre-ARMv6 (emit single MSR if IRQ state is known)
      - Improve SCPSR to allow the source mode to be any 32bit mode
      - Fix conditional 26bit/32bit neutral SCPSR - the 32bit check TEQ corrupts NZCV so we can't do conditional execution on $cond after it (and we've already branched on the opposite condition anyway)
      - Fix 26bit/32bit neutral SCPSR to preserve NZCV when following the MSR code path
      - Make CLRPSR and SETPSR just call through to SCPSR - in terms of output the first two have no advantages over SCPSR
      - Update WritePSRc documentation to reflect that it can now be used in any (non-USR) source mode
      hdr/CPU/Generic26:
      - Update WritePSRc documentation to match Generic32
    Admin:
      Tested on Raspberry Pi
      Output of new macros manually checked for various machine types (RPi, Tungsten, All, 26)
    
    
    Version 2.65. Tagged as 'HdrSrc-2_65'
    71306206
VersionNum 810 Bytes