1. 07 Jul, 2018 1 commit
  2. 31 May, 2018 1 commit
    • Jeffrey Lee's avatar
      Update mode variable definitions · 7e7901c8
      Jeffrey Lee authored
      Detail:
        hdr/VduExt:
        - Introduce mode variable 13, for specifying the minimum number of screen banks that are guaranteed to be available. Eventually the kernel will make use of this during mode vetting & selection, to give programs a simple and reliable way of selecting banked screen modes. Currently however it's only supported by VideoOverlay and the corresponding GraphicsV overlay APIs.
        - Extend the mode flags to allow display rotation & flipping to be specified. This is used to indicate that the framebuffer accessed by the CPU is not in the same orientation as what the user is seeing. Again, currently this is only supported by VideoOverlay and the corresponding GraphicsV overlay APIs.
      Admin:
        Tested on OMAP3, OMAP4
      
      
      Version 6.06. Tagged as 'Kernel-6_06'
      7e7901c8
  3. 13 May, 2018 1 commit
  4. 24 Apr, 2018 1 commit
    • Jeffrey Lee's avatar
      Disable error block validity checks · 3c60aa69
      Jeffrey Lee authored
      Detail:
        The error block checks introduced in Kernel-5_35-4_79_2_313 are generating a few too many false positives and edge cases, so take the safe option of just disabling them rather than trying to tweak the rules further. Error pointers will still be checked, but the content of the error blocks will not.
        hdr/Options - Add CheckErrorBlocks switch so we can easily turn the code back on again in the future if necessary
        s/Kernel - Switch out all the code relating to error number checks, except for the dummy load of the first word of the error block, since that's still useful as a pointer validity check
        hdr/KernelWS - Revise SWIDespatch_Size definition so it's easier for it to cope with the various factors which may affect the despatcher size
      Admin:
        Tested on PandaBoard
        Relevant discussion:
        https://www.riscosopen.org/forum/forums/11/topics/11133
      
      
      Version 6.04. Tagged as 'Kernel-6_04'
      3c60aa69
  5. 19 Apr, 2018 1 commit
  6. 15 Apr, 2018 1 commit
    • Ben Avison's avatar
      Resync with allocations database · cc37d347
      Ben Avison authored
      Detail:
        Resolve allocation clash for vector &2C.  It appears that RISCOS Ltd used
        this vector in RISC OS 6 without getting it allocated - they really should
        have known better, since Hdr:RISCOS has always one of the header files
        centrally managed and coordinated between the two forks of RISC OS.
        Resolved by moving SeriousErrorV to &2D since it is a relatively recent
        addition (April 2016) and hasn't yet featured in a stable RISC OS 5
        release.
        Also correct some comments elsewhere in Hdr:RISCOS.
      
      
      Version 6.01. Tagged as 'Kernel-6_01'
      cc37d347
  7. 25 Mar, 2018 1 commit
  8. 03 Feb, 2018 1 commit
    • Robert Sprowson's avatar
      Recover gracefully from a completely blank set of CMOS · 1033074e
      Robert Sprowson authored
      Newly born boards have all 0xFF's in their CMOS (EEPROM), but the new order of keyboard scan did
        Init -> Scan keyboard -> Check (or wipe) CMOS
      and would therefore leave 0xFF's in a select few kernel workspace areas and OS_Byte values.
      Defer the init which reads CMOS until after the check/wipe step. Only the screen area size is now done early, but MassageScreenSize clamps that properly anyway.
      
      Arthur3.s: Relocate stranded function SetupPrinterBuffer to osinit.
      PMF/key.s: Drop support for SoftReset.
      PMF/osinit.s: Stuff in hardcoded defaults at early init. Retrieve the proper ones later. Take ownership of SystemSprite/RamFS/Font Manager dynamic areas (deferrable).
      vdudriver.s: Use symbolic name.
      NewReset.s: Defer SystemSprite/RamFS/Font Manager area creation, MouseInit, Read(Hard)CMOSDefaults until later.
      hdr/Options: Delete unused IgnoreVRAM. Remove MaxRAMFS_Size now PMPs make it not useful. Shuffle ARM6Support/XScaleMiniCache/XScaleJTAGDebug to be adjacent to their definitions.
      
      Tested by filling first 256 bytes with 0xFF and powering up. Reset now completes, OS_Byte variables look sensible.
      
      Version 5.95. Tagged as 'Kernel-5_95'
      1033074e
  9. 07 Oct, 2017 1 commit
    • Jeffrey Lee's avatar
      Tweak handling of zero page compatibility page · 36062ff5
      Jeffrey Lee authored
      Detail:
        s/MemInfo, hdr/KernelWS - Rather than peeking L2PT to determine if the compatibility page is enabled, use a workspace var to track its state. This ensures we won't get confused if other software decides to map something of its own to &0.
        s/NewReset - Ensure the CompatibilityPageEnabled flag is initialised correctly
      Admin:
        Tested in Iyonix ROM softload
      
      
      Version 5.90. Tagged as 'Kernel-5_90'
      36062ff5
  10. 09 Sep, 2017 1 commit
    • ROOL's avatar
      Change module initialisation to be a two pass scheme · ac1ea0f5
      ROOL authored
      Detail:
        To make it easier to support arbitrary complexity keyboard controllers (eg. USB via DWCDriver on the Pi) have the kernel do the early keyboard recovery key press detection instead of the HAL.
        During the first pass those modules used for reading the keyboard are started, ignoring the CMOS frugal bits.
        The keyboard is then scanned for 3s, during which time the RAM is cleared (unless the HAL indicated it has already been done).
        During the second pass the remaining modules are started respecting the CMOS frugal bits. Any which were already started in the first pass are inserted into the new chain, so the keyboard is reset once and only once.
      
        Boot times, with a 300cs key scan time in NewReset.
        Risc PC with 160MB RAM (128+32+0).
        Times from turning on power to initial "beep", using a stopwatch.
                      RISC OS 3.70 RISC OS 5.22 This OS
        ARM610        12.5         10.4         10.3
        ARM710        11.8         10.2         9.7
        StrongARM 233 11.1         9.5          8.4
      
        In NewReset.s:
        Remove old KbdScan code (leave Reset_IRQ_Handler for IIC only)
        If HAL_KbdScanDependencies returns a null string then present KbdDone flag and skip to full init.
        A few vestiges of soft resets removed.
        Do RAM clear when waiting for INKEY (being careful not to trash the running modules...).
        Clearing just the freepool on a 2GB Titanium cleared 7EFD6 pages (99.2%).
      
        In ModHand.s:
        2nd pass need to sneaky renumber the nodes (so *ROMModules is in the right order, frugal bits line up) without resetting the chain
      
        In HAL.s:
        Change ClearPhysRAM to ClearWkspRAM, such that it only clears the kernel workspace rather than all RAM. The bulk of the RAM is cleared during the keyboard scan by new function ClearFreePoolSection.
        Add a variant of Init_MapInRAM which clears the mapped in RAM too (as these very early claims will not be in the free pool when the RAM is cleared later).
        Remove HAL keyboard scan setup & IRQ handler.
        Fix bug in HALDebugHexTX2, the input value needs pre-shifting by 16b before continuing.
      
        In GetAll.s, PMF/osbyte.s:
        Use Hdr:Countries and Hdr:OsBytes for constants.
      
        In PMF/key.s, PMF/osinit.s:
        Relocate the key post init from PostInit to KeyPostInit.
        Changed PostInit to not tail call KeyPostInit so they can be called independently.
      
        In hdr/KernelWs:
        Improve comments, add InitWsStart label to refer to.
      
        In hdr/HALEntries:
        Add HAL_KbdScanDependencies.
        Delete KbdFlag exports.
        Took the opportunity to reorder some of the higher numbered HAL entries and re-grouping, specifically (112,120) (84,106,108,117).
      Admin:
        Tested on an ARM6/ARM7/SA Risc PC, BeagleBoard xM, Iyonix, Pandaboard ES, Wandboard Quad, IPEGv5, Titanium, Pi 2 and 3.
        Requires corresponding HAL change.
        Submission for USB bounty.
      
      Version 5.89. Tagged as 'Kernel-5_89'
      ac1ea0f5
  11. 25 Aug, 2017 1 commit
  12. 19 Aug, 2017 1 commit
    • Jeffrey Lee's avatar
      Add a compatibility page zero for high processor vectors / zero page relocation builds · ffac5791
      Jeffrey Lee authored
      Detail:
        When HiProcVecs is enabled, there will now be a read-only page located at &0 in order to ease compatibility with buggy software which reads from null pointers
        Although most of the page is zero-filled, the start of the page contains a few words which are invalid pointers, discouraging dereferencing them, and a warning message if the memory is interpreted as a string.
        On ARMv6+ the page is also made non-executable, to deal with branch-through-zero type situations
        OS_Memory 20 has been introduced as a way of determining whether the compatibility page is present, and also to enable/disable it
        File changes:
        - hdr/Options - Add CompatibilityPage option
        - hdr/OSMem - Declare OS_Memory reason code 20
        - hdr/KernelWS - When CompatibilityPage is enabled, make sure nothing else is located at &0
        - s/NewReset - Enable compatibility page just before Service_PostInit (try and keep zero-tolerance policy for null pointer dereferencing during ROM init)
        - s/MemInfo - OS_Memory 20 implementation. Add knowledge of the compatibility page to OS_Memory 16 and 24.
      Admin:
        Tested on BB-xM
      
      
      Version 5.87. Tagged as 'Kernel-5_87'
      ffac5791
  13. 12 Aug, 2017 1 commit
    • Jeffrey Lee's avatar
      Add OS_Memory 19, which is intended to replace the OS_Memory 0 "make... · b47fdbb1
      Jeffrey Lee authored
      Add OS_Memory 19, which is intended to replace the OS_Memory 0 "make uncacheable" feature, when used for DMA
      
      Detail:
        Making pages uncacheable to allow them to be used with DMA can be troublesome for a number of reasons:
        * Many processors ignore cache hits for non-cacheable pages, so to avoid breaking any IRQ handlers the page table manipulation + cache maintenance must be performed with IRQs disabled, impacting the IRQ latency of the system
        * Some processors don't support LDREX/STREX to non-cacheable pages
        * In SMP setups it may be necessary to temporarily park the other cores somewhere safe, or perform some other explicit synchronisation to make sure they all have consistent views of the cache/TLB
        The above issues are most likely to cause problems when the page is shared by multiple programs; a DMA operation which targets one part of a page could impact the programs which are using the other parts.
        To combat these problems, OS_Memory 19 is being introduced, which allows DMA cache coherency/address translation to be performed without altering the attributes of the pages.
        Files changed:
        - hdr/OSMem - Add definitions for OS_Memory 19
        - s/MemInfo - Add OS_Memory 19 implementation
      Admin:
        Tested on Raspberry Pi 3, iMx6
      
      
      Version 5.86, 4.129.2.3. Tagged as 'Kernel-5_86-4_129_2_3'
      b47fdbb1
  14. 29 Jul, 2017 1 commit
    • Jeffrey Lee's avatar
      Initial SMP changes · 9944afaf
      Jeffrey Lee authored
      Detail:
        This commit lays some of the groundwork for SMP support within the HAL, kernel, and OS.
        Makefile, hdr/HALDevice, hdr/DBellDevice - Add definitions for a doorbell HAL device, to allow CPU cores to signal each other via interrupts
        hdr/HALEntries - Repurpose HAL_Matrix and HAL_Touchscreen entry points for new SMP-related entry points. Add a couple of IRQ-related definitions.
        hdr/KernelWS - Boost MaxInterrupts to 256
        hdr/Options - Add new SMP build switch to control whether the kernel is built in SMP-friendly mode or not. SMP-friendly kernels should still run on single-core machines, but may behave slightly differently.
        s/ARMops - Make as many ARMops SMP-safe as possible, relying on hardware support for broadcasting of cache/TLB maintenance operations
        s/ExtraSWIs - Make SMP-friendly full OS_SynchroniseCodeAreas only sync application space and the RMA (full-cache IMB not really possible with SMP)
        s/NewIRQs - Update IRQ despatcher comments to (hopefully) reflect reali...
      9944afaf
  15. 18 Jul, 2017 1 commit
  16. 07 Jun, 2017 1 commit
    • Jeffrey Lee's avatar
      Initial support for the ExtraBytes VIDC control list item · 90cc1d38
      Jeffrey Lee authored
      Detail:
        The ExtraBytes control list item can be used to add padding between framebuffer rows.
        When the kernel sees a VIDC list containing this item, it will now adjust the LineLength and ScreenSize mode variables accordingly, with the end result that the correct amount of memory will be allocated for the framebuffer and the OS will render into it correctly.
        Files changed:
        - hdr/KernelWS - Add DisplayLineLength variable to allow the correct LineLength value to be preserved when screen output is redirected to a sprite
        - s/vdu/vdudriver - Make ModeChangeSub initialise DisplayLineLength before calling SwitchOutputToSprite. Update PushModeInfo to take ExtraBytes into account when calculating LineLength and ScreenSize.
        - s/vdu/vdugrafl - Adjust SwitchOutputToSprite to use DisplayLineLength when restoring screen output
        - s/vdu/vduwrch - Fix full-screen CLS to not write to the padding bytes
      Admin:
        Tested on Raspberry Pi 3
      
      
      Version 5.82. Tagged as 'Kernel-5_82'
      90cc1d38
  17. 03 Jun, 2017 1 commit
  18. 09 Feb, 2017 1 commit
    • Robert Sprowson's avatar
      Expose CLREX via OS_PlatformFeatures · a7892833
      Robert Sprowson authored
      To account for ARM changing their minds about how to clear the exclusive lock on different architectures, provide a function pointer with a known good implementation. This is similar to the run of NOPs returned by OS_PlatformFeatures 0 for those that need it.
      If in the future any errata or similar are needed, then there's only 1 place to change it, plus clients don't need their own CPU type detection logic.
      
      Version 5.77. Tagged as 'Kernel-5_77'
      a7892833
  19. 17 Dec, 2016 1 commit
    • Jeffrey Lee's avatar
      Fix screen redirection when in teletext modes. Fix *ScreenLoad buffer overflow. · 06079048
      Jeffrey Lee authored
      Detail:
        s/vdu/vdugrafl, s/vdu/vduttx - Adjust initialisation & shutdown of TTX workspace to fix workspace being erroneously freed/reinitialised when redirecting output to a sprite
        s/vdu/vdugrafk - If ScreenLoad needs to load one row at a time (e.g. when graphics window width != sprite width), allocate a block from the RMA instead of assuming that ScrLoaBuffer is large enough
        hdr/KernelWS - Get rid of ScrLoaBuffer, and shrink LargeCommon to a suitable size. Frees about 2K of VDU workspace.
        s/GetAll - Move Hdr:Sprite earlier in list of GETs
      Admin:
        Tested on Raspberry Pi
      
      
      Version 5.75. Tagged as 'Kernel-5_75'
      06079048
  20. 15 Dec, 2016 1 commit
    • Jeffrey Lee's avatar
      Add support for custom teletext modes · 92e90b01
      Jeffrey Lee authored
      Detail:
        This set of changes:
        * Adds support for the T, TX and TY mode string elements (as per RISCOS Ltd)
        * Adds support for entering arbitrary-resolution teletext modes by using mode selector blocks with the Teletext mode flag set
        * ScrRCol and ScrBRow mode variables can be provided in the mode selector in order to restrict the number of text rows/columns in teletext modes (as per RISCOS Ltd)
        * If the rows / columns are restricted in this manner then the text window will be centered on the screen, to try and avoid things looking too ugly (no variable text scaling implemented)
        * For HiResTTX, all colour depths >= 4bpp are now supported by teletext. This essentially makes the TTX256 switch obsolete.
        * If the "native" mode 7 is unavailable then the kernel will try a series of fallback resolutions & colour depths in an effort to find a combination that works
        Known bugs/issues:
        * Teletext column count has a max limit of 255 due to TTXDoubleCounts being a byte array
        * If there's a border around the text window, the border will not be refreshed when changing transparency modes using a VDU 23,18,0 sequence
        * ScreenLoad looks like it can overflow the LargeCommon buffer (no buffer size check) - needs fixing before LargeCommon can be safely shrunk below (Old)TTXMapSize
        File changes:
        - hdr/KernelWS - Make CharWidth non-conditional. Adjust handling of teletext workspace; it's now allocated from the system heap to allow it to cope with arbitrary screen sizes
        - s/vdu/vdu23 - Make CharWidth non-conditional
        - s/vdu/vducursoft - Make CursorTeletext cope with arbitrary colour depths, make CharWidth non-conditional, remove hard-coded teletext values
        - s/vdu/vdudriver - Deal with teletext workspace allocation during ModeChangeSub. Deal with selecting teletext modes (and validating colour depth) in GenerateModeSelectorVars.
        - s/vdu/vdugrafl - Make CharWidth non-conditional. Calculate offset required for text window centering.
        - s/vdu/vdumodes - Remove TTX256
        - s/vdu/vduswis - Try other teletext modes if native mode 7 not available. Extend OS_ScreenMode reason codes to cope with teletext mode strings.
        - s/vdu/vduttx - Update to use dynamic workspace. Replace various hardcoded values with variable lookups. Update character plotting + colour/palette selection to work with true-colour modes if HiResTTX.
        - s/vdu/vduwrch - Move some useful code into a subroutine. Update FastCLS to cope with true-colour teletext. Update AddressR0R1 to cope with text window centering offset. Make CharWidth non-conditional.
      Admin:
        Tested on Raspberry Pi, BB-xM
        VDU 23,18,0 in 256-colour teletext now works correctly (previously 64-colour mode was in use, causing palette update to be ruined by VIDC1-mangling)
      
      
      Version 5.74. Tagged as 'Kernel-5_74'
      92e90b01
  21. 13 Dec, 2016 3 commits
    • Jeffrey Lee's avatar
      Disable public use of new ARMops until ready · 5cfe8f63
      Jeffrey Lee authored
      Detail:
        hdr/OSMisc, s/ARMops - Don't expose the new ARMops via OS_MMUControl 2, they haven't been fully tested/developed yet
      Admin:
        Builds, untested
      
      
      Version 5.73. Tagged as 'Kernel-5_73'
      5cfe8f63
    • Jeffrey Lee's avatar
      Implement support for cacheable pagetables · 65fa6a28
      Jeffrey Lee authored
      Detail:
        Modern ARMs (ARMv6+) introduce the possibility for the page table walk hardware to make use of the data cache(s) when performing memory accesses. This can significantly reduce the cost of a TLB miss on the system, and since the accesses are cache-coherent with the CPU it allows us to make the page tables cacheable for CPU (program) accesses also, improving the performance of page table manipulation by the OS.
        Even on ARMs where the page table walk can't use the data cache, it's been measured that page table manipulation operations can still benefit from placing the page tables in write-through or bufferable memory.
        So with that in mind, this set of changes updates the OS to allow cacheable/bufferable page tables to be used by the OS + MMU, using a system-appropriate cache policy.
        File changes:
        - hdr/KernelWS - Allocate workspace for storing the page flags that are to be used by the page tables
        - hdr/OSMem - Re-specify CP_CB_AlternativeDCache as having a different behaviour on ARMv6+ (inner write-through, outer write-back)
        - hdr/Options - Add CacheablePageTables option to allow switching back to non-cacheable page tables if necessary. Add SyncPageTables var which will be set {TRUE} if either the OS or the architecture requires a DSB after writing to a faulting page table entry.
        - s/ARM600, s/VMSAv6 - Add new SetTTBR & GetPageFlagsForCacheablePageTables functions. Update VMSAv6 for wider XCBTable (now 2 bytes per element)
        - s/ARMops - Update pre-ARMv7 MMU_Changing ARMops to drain the write buffer on entry if cacheable pagetables are in use (ARMv7+ already has this behaviour due to architectural requirements). For VMSAv6 Normal memory, change the way that the OS encodes the cache policy in the page table entries so that it's more compatible with the encoding used in the TTBR.
        - s/ChangeDyn - Update page table page flag handling to use PageTable_PageFlags. Make use of new PageTableSync macro.
        - s/Exceptions, s/AMBControl/memmap - Make use of new PageTableSync macro.
        - s/HAL - Update MMU initialisation sequence to make use of PageTable_PageFlags + SetTTBR
        - s/Kernel - Add PageTableSync macro, to be used after any write to a faulting page table entry
        - s/MemInfo - Update OS_Memory 0 page flag conversion. Update OS_Memory 24 to use new symbol for page table access permissions.
        - s/MemMap2 - Use PageTableSync. Add routines to enable/disable cacheable pagetables
        - s/NewReset - Enable cacheable pagetables once we're fully clear of the MMU initialision sequence (doing earlier would be trickier due to potential double-mapping)
      Admin:
        Tested on pretty much everything currently supported
        Delivers moderate performance benefits to page table ops on old systems (e.g. 10% faster), astronomical benefits on some new systems (up to 8x faster)
        Stats: https://www.riscosopen.org/forum/forums/3/topics/2728?page=2#posts-58015
      
      
      Version 5.71. Tagged as 'Kernel-5_71'
      65fa6a28
    • Jeffrey Lee's avatar
      Add new ARMops. Add macros which map the ARMv7/v8 cache/TLB maintenance... · 48485eee
      Jeffrey Lee authored
      Add new ARMops. Add macros which map the ARMv7/v8 cache/TLB maintenance mnemonics (as featured in recent ARM ARMs) to MCR ops.
      
      Detail:
        - Docs/HAL/ARMop_API - Document the new ARMops. These ops are intended to help with future work (DMA without OS_Memory 0 "make temp uncacheable", and minimising cache maintenance when unmapping pages) and aren't in use just yet.
        - hdr/Copro15ops - Add new macros for ARMv7+ which map the mnemonics seen in recent ARM ARMs to the corresponding MCR ops. This should make things easier when cross-referencing docs and reduce the risk of typos.
        - hdr/KernelWS - Shuffle kernel workspace a bit to make room for the new ARMops
        - hdr/OSMisc - Expose new ARMops via OS_MMUControl 2
        - s/ARMops - Implement the new ARMops. Change the ARMv7+ ARMops to use the new mnemonic macros. Also get rid of myDSB / myISB usage from ARMv7+ code paths; use DSB/ISB/etc. directly to ensure correct behaviour
        - s/HAL - Mnemonic + ISB/DSB updates. Change software RAM clear to do 16 bytes at a time for kernel workspace instead of 32 to allow the kernel workspace tweaks to work.
      Admin:
        Binary diff shows that mnemonics map to the original MCR ops correctly
        Note: Raspberry Pi builds will now emit lots of warnings due to increased DSB/ISB instruction use. However it should be safe to ignore these as they should only be present in v7+ code paths.
        Note: New ARMops haven't been tested yet, will be disabled (or at least hidden from user code) in a future checkin
      
      
      Version 5.68. Tagged as 'Kernel-5_68'
      48485eee
  22. 17 Oct, 2016 1 commit
    • Jeffrey Lee's avatar
      Prevent disabling of the D-cache on Cortex-A53. Other OS_MMUControl 0 fixes. · d7299988
      Jeffrey Lee authored
      Detail:
        On Cortex-A53, a load/store exclusive instruction will abort if it targets non-cacheable memory or if the D-cache is disabled. Since the correct operation of these instructions is important to the OS and apps, it makes sense to prevent *Cache Off / OS_MMUControl 0 from being able to disable the D-cache on such systems.
        hdr/OSMisc, s/ARMops - Add new OS_PlatformFeatures 0 flag to indicate when disabling of the D-cache isn't allowed
        s/VMSAv6 - Update MMUControl_ModifyControl to force the D-cache to always be on when the "unsafe to disable D-cache" PlatformFeatures flag is set. Also, disallow mismatched I+D cache settings if we have an L2 cache (causes issues due to IMB ops only flushing to PoU), and fix dangerous D-cache invalidation when it's only the I-cache which is being disabled
        s/ARM600 - Clean up MMUControl_ModifyControl a bit so that it's a closer match to the VMSAv6 version, and fix the dangerous D-cache invalidation.
      Admin:
        Tested on ARM11, Cortex-A7, Cortex-A53
      
      
      Version 5.62. Tagged as 'Kernel-5_62'
      d7299988
  23. 02 Aug, 2016 1 commit
    • Jeffrey Lee's avatar
      Add support for shareable pages and additional access privileges · 9cd4cbe4
      Jeffrey Lee authored
      Detail:
        This set of changes:
        * Refactors page table entry encoding/decoding so that it's (mostly) performed via functions in the MMU files (s.ARM600, s.VMSAv6) rather than on an ad-hoc basis as was the case previously
        * Page table entry encoding/decoding performed during ROM init is also handled via the MMU functions, which resolves some cases where the wrong cache policy was in use on ARMv6+
        * Adds basic support for shareable pages - on non-uniprocessor systems all pages will be marked as shareable (however, we are currently lacking ARMops which broadcast cache maintenance operations to other cores, so safe sharing of cacheable regions isn't possible yet)
        * Adds support for the VMSA XN flag and the "privileged ROM" access permission. These are exposed via RISC OS access privileges 4 and above, taking advantage of the fact that 4 bits have always been reserved for AP values but only 4 values were defined
        * Adds OS_Memory 17 and 18 to convert RWX-style access flags to and from RISC OS access privelege numbers; this allows us to make arbitrary changes to the mappings of AP values 4+ between different OS/hardware versions, and allows software to more easily cope with cases where the most precise AP isn't available (e.g. no XN on <=ARMv5)
        * Extends OS_Memory 24 (CheckMemoryAccess) to return executability information
        * Adds exported OSMem header containing definitions for OS_Memory and OS_DynamicArea
        File changes:
        - Makefile - export C and assembler versions of hdr/OSMem
        - Resources/UK/Messages - Add more text for OS_Memory errors
        - hdr/KernelWS - Correct comment regarding DCacheCleanAddress. Allocate workspace for MMU_PPLTrans and MMU_PPLAccess.
        - hdr/OSMem - New file containing exported OS_Memory and OS_DynamicArea constants, and public page flags
        - hdr/Options - Reduce scope of ARM6support to only cover builds which require ARMv3 support
        - s/AMBControl/Workspace - Clarify AMBNode_PPL usage
        - s/AMBControl/growp, mapslot, mapsome, memmap - Use AreaFlags_ instead of AP_
        - s/AMBControl/main, memmap - Use GetPTE instead of generating page table entry manually
        - s/ARM600 - Remove old coments relating to lack of stack. Update BangCam to use GetPTE. Update PPL tables, removing PPLTransL1 (L1 entries are now derived from L2 table on demand) and adding a separate table for ARM6. Implement the ARM600 versions of the Get*PTE ('get page table entry') and Decode*Entry functions
        - s/ARMops - Add Init_PCBTrans function to allow relevant MMU_PPLTrans/MMU_PCBTrans pointers to be set up during the pre-MMU stage of ROM init. Update ARM_Analyse to set up the pointers that are used post MMU init.
        - s/ChangeDyn - Move a bunch of flags to hdr/OSMem. Rename the AP_ dynamic area flags to AreaFlags_ to avoid name clashes and confusion with the page table AP_ values exported by Hdr:MEMM.ARM600/Hdr:MEMM.VMSAv6. Also generate the relevant flags for OS_Memory 24 so that it can refer to the fixed areas by their name instead of hardcoding the permissions.
        - s/GetAll - GET Hdr:OSMem
        - s/HAL - Change initial page table setup to use DA/page flags and GetPTE instead of building page table entries manually. Simplify AllocateL2PT by removing the requirement for the user to supply the access perimssions that will be used for the area; instead for ARM6 we just assume that cacheable memory is the norm and set L1_U for any L1 entry we create here.
        - s/Kernel - Add GetPTE macro (for easier integration of Get*PTE functions) and GenPPLAccess macro (for easy generation of OS_Memory 24 flags)
        - s/MemInfo - Fixup OS_Memory 0 to not fail on seeing non-executable pages. Implement OS_Memory 17 & 18. Tidy up some error generation. Make OS_Memory 13 use GetPTE. Extend OS_Memory 24 to return (non-) executability information, to use the named CMA_ constants generated by s/ChangeDyn, and to use the Decode*Entry functions when it's necessary to decode page table entries.
        - s/NewReset - Use AreaFlags_ instead of AP_
        - s/VMSAv6 - Remove old comments relating to lack of stack. Update BangCam to use GetPTE. Update PPL tables, removing PPLTransL1 (L1 entries are now derived from L2 table on demand) and adding a separate table for shareable pages. Implement the VMSAv6 versions of the Get*PTE and Decode*Entry functions.
      Admin:
        Tested on Raspberry Pi 1, Raspberry Pi 3, Iyonix, RPCEmu (ARM6 & ARM7), comparing before and after CAM and page table dumps to check for any unexpected differences
      
      
      Version 5.55. Tagged as 'Kernel-5_55'
      9cd4cbe4
  24. 24 Jul, 2016 1 commit
    • Robert Sprowson's avatar
      Resolve 2x header clashes · 8cfe216b
      Robert Sprowson authored
      hdr/AHCIDevice:
        Remove this, since it clashes with the (differing API version number) copy exported by SATADriver. Post merging the Kernel back to the trunk the newer file datestamp has meant the wrong one gets exported during any ROM build which includes both components. Since the Kernel doesn't need AHCIDevice itself, it is left to the respective client (SATADriver or AHCIDriver in this case) to export them.
      hdr/ModHand:
        Resolve the longstanding clash of Module_Title with the same named symbol that CMHG uses. There are very few assembler needing to look at the module header (Kernel, FileCore, Debugger, Podule) directly, but every C module which uses CMHG and wants one of the ModHandReason values ends up with a duplicate define.
        Obsolete Arthur era Module_LoadAddr value.
      ArthurSWIs.s/MoreComms.s/NewReset.s/SWINaming.s/SysComms.s/Utility.s:
        Module_Title->Module_TitleStr.
      ModHand.s:
        Module_Title->Module_TitleStr.
        Recode Module_LoadAddr using the file type from Hdr:FileTypes.
      GetAlls.s:
        Drop unused NVRAM and PortMan headers. Add Hdr:FileTypes.
      
      Version 5.54. Tagged as 'Kernel-5_54'
      8cfe216b
  25. 30 Jun, 2016 4 commits
    • Jeffrey Lee's avatar
      Tidy things up a bit · 055b24c3
      Jeffrey Lee authored
      Detail:
        hdr/Options - Reduce the scope of SASTMhatbroken and InterruptDelay switches so that they're only enabled when we're building for ARMv4 targets
        s/ARM600, s/VMSAv6, s/ExtraSWIs, s/Exceptions - Move duplicate code out of s/ARM600 & s/VMSAv6 and into shared locations. OS_UpdateMEMC, the bulk of OS_MMUControl, and OS_SynchroniseCodeAreas are now located in s/ExtraSWIs. Meanwhile the data & prefetch abort veneers have been moved to the new file s/Exceptions. s/ARM600 and s/VMSAv6 are now almost purely to do with the different page table formats.
        s/GetAll - GET s/Exceptions
      Admin:
        Tested on Raspberry Pi
      
      
      Version 5.52. Tagged as 'Kernel-5_52'
      055b24c3
    • Jeffrey Lee's avatar
      Delete lots of old switches · f655fcf6
      Jeffrey Lee authored
      Detail:
        This change gets rid of the following switches from the source (picking appropriate code paths for a 32bit HAL build):
        * FixCallBacks
        * UseProcessTransfer
        * CanLiveOnROMCard
        * BleedinDaveBell
        * NewStyleEcfs
        * DoVdu23_0_12
        * LCDPowerCtrl
        * HostVdu
        * Print
        * EmulatorSupport
        * TubeInfo
        * AddTubeBashers
        * TubeChar, TubeString, TubeDumpNoStack, TubeNewlNoStack macros
        * FIQDebug
        * VCOstartfix
        * AssemblingArthur (n.b. still defined for safety with anything in Hdr: which uses it, but not used explicitly by the kernel)
        * MouseBufferFix
        * LCDInvert
        * LCDSupport
        * DoInitialiseMode
        * Interruptible32bitModes
        * MouseBufferManager
        * StrongARM (new CacheCleanerHack and InterruptDelay switches added to hdr/Options to cover some functionality that StrongARM previously covered)
        * SAcleanflushbroken
        * StrongARM_POST
        * IrqsInClaimRelease
        * CheckProtectionLink
        * GSWorkspaceInKernelBuffers
        * EarlierReentrancyInDAShrink
        * LongCommandLines
        * ECC
        * NoSPSRcorruption
        * RMTidyDoesNowt
        * RogerEXEY
        * StorkPowerSave
        * DebugForcedReset
        * AssembleKEYV
        * AssemblePointerV
        * ProcessorVectors
        * Keyboard_Type
        Assorted old files have also been deleted.
      Admin:
        Identical binary to previous revision for IOMD & Raspberry Pi builds
      
      
      Version 5.51. Tagged as 'Kernel-5_51'
      f655fcf6
    • Jeffrey Lee's avatar
      Delete STB code · 9a571a08
      Jeffrey Lee authored
      Detail:
        This change gets rid of the following switches from the source (picking appropriate code paths for a desktop build):
        * STB
        * RO371Timings
        * NormalSpeedROMS
        * AutoSpeedROMS
        * RISCPCBurstMode
        * InterlacedPointer
        * ParallelFlashUpgrade (and s/FlashROM file)
        * Embedded_UI
        Some of the deleted code might be worth revisiting in future:
        * OS_ReadSysInfo 4 support for storing the MAC in alternate CMOS locations (including 2nd copy for error checking) or fetching via Service_MachineAddress
        * Mouse handling changes, possibly aimed at hiding the mouse pointer if a mouse isn't connected
        * More strict CMOS validation in s/NewReset
      Admin:
        Identical binary to previous revision for IOMD & Raspberry Pi builds
      
      
      Version 5.50. Tagged as 'Kernel-5_50'
      9a571a08
    • Jeffrey Lee's avatar
      Delete pre-HAL and 26bit code · 7d5bfc66
      Jeffrey Lee authored
      Detail:
        This change gets rid of the following switches from the source (picking appropriate code paths for a 32bit HAL build):
        * HAL
        * HAL26
        * HAL32
        * No26bitCode
        * No32bitCode
        * IncludeTestSrc
        * FixR9CorruptionInExtensionSWI
        Various old files have also been removed (POST code, Arc/STB keyboard drivers, etc.)
      Admin:
        Identical binary to previous revision for IOMD & Raspberry Pi builds
      
      
      Version 5.49. Tagged as 'Kernel-5_49'
      7d5bfc66
  26. 24 May, 2016 1 commit
    • Jeffrey Lee's avatar
      Add OS_PlatformFeatures 0 flag to indicate that the "Unknown... · 417d0f7c
      Jeffrey Lee authored
      Add OS_PlatformFeatures 0 flag to indicate that the "Unknown OS_PlatformFeatures reason codes always raise an error" bug has been fixed
      
      Detail:
        hdr/OSMisc - Use bit 31 to indicate that the error reporting bug has been fixed
        s/ARMops - Make sure the flag is set when preparing ProcessorFlags (i.e. the OS_PlatformFeatures 0 flags)
      Admin:
        Tested on Raspberry Pi
      
      
      Version 5.35, 4.79.2.325. Tagged as 'Kernel-5_35-4_79_2_325'
      417d0f7c
  27. 19 May, 2016 1 commit
    • Jeffrey Lee's avatar
      Add new OS_PlatformFeatures reason code for reading CPU features (inspired by... · 9944f0f8
      Jeffrey Lee authored
      Add new OS_PlatformFeatures reason code for reading CPU features (inspired by ARMv6+ CPUID scheme). Add OS_ReadSysInfo 8 flags for indicating the alignment mode the ROM was built with. Fix long-standing bug with OS_PlatformFeatures when an unknown reason code is used.
      
      Detail:
        s/CPUFeatures, hdr/OSMisc, hdr/KernelWS - Code and definitions for reading CPU features and reporting them via OS_PlatformFeatures 34. All the instruction set features which are exposed by the CPUID scheme and which are relevant to RISC OS are exposed, along with a few extra flags which we derive ourselves (e.g. things relating to < ARMv4, and some register usage restrictions in instructions). s/CPUFeatures is designed to be easily copyable into a future version of CallASWI without requiring any changes.
        s/ARMops - Read and cache CPU features during ARMop initialisation
        s/GetAll - GET new file
        s/Kernel - Hook up the CPU features code to OS_PlatformFeatures. Fix a long standing stack imbalance bug (fixed in RISC OS 3.8, but never merged back to our main branch) which meant that calling OS_PlatformFeatures with an invalid reason code would raise an error, even if it was the X form of the SWI that was called. Similar fix also applied to the unused service call code, along with a fix for the user's R1-R9 being corrupt (shuffled up one place) should an error have been generated.
        s/MemInfo - Extra LTORG needed to keep things happy
        s/Middle - Extend OS_ReadSysInfo 8 to include flags for indicating what memory alignment mode (if any) the OS relies upon. Together with OS_PlatformFeatures 34 this could e.g. be used by !CPUSetup to determine which options should be offered to the user.
      Admin:
        Tested on Raspberry Pi 1, 2, 3
      
      
      Version 5.35, 4.79.2.319. Tagged as 'Kernel-5_35-4_79_2_319'
      9944f0f8
  28. 06 Apr, 2016 1 commit
    • Jeffrey Lee's avatar
      Revise error pointer validity checks · 67837a43
      Jeffrey Lee authored
      Detail:
        s/Kernel, hdr/KernelWS - Avoid performing error pointer checks for XOS_GenerateError, since (a) it's a no-op as far as errors are concerned, and (b) many programs take advantage of that fact and abuse the SWI for other purposes (triggering callbacks, BASIC string conversion, etc.)
      Admin:
        Tested on Raspberry Pi
        Fixes issue reported on forums with Sunfish crashing:
        https://www.riscosopen.org/forum/forums/5/topics/4060
      
      
      Version 5.35, 4.79.2.314. Tagged as 'Kernel-5_35-4_79_2_314'
      67837a43
  29. 05 Apr, 2016 1 commit
    • Jeffrey Lee's avatar
      Add SWI error pointer validation, SeriousErrorV hooks, and OS_ReadSysInfo 15 · b4cf3959
      Jeffrey Lee authored
      Detail:
        Resources/UK/Messages, hdr/KernelWS, s/Kernel - On return from a SWI with V set, do some basic validity checks on the error pointer in order to try and catch buggy SWIs that return bad pointers or invalid error blocks. If a bad pointer is found we'll substitute it with a pointer to a different error block, which has the SWI number in the error message, to allow the user to identify the source of the problem. (There's also a chance we'll crash when investigating a bad pointer, but crashing here in the kernel is preferable to crashing elsewhere because R12 should still contain the SWI number)
        hdr/OSMisc - Define SeriousErrorV reason codes and extended ROM footer entry IDs
        hdr/Options - Remove HangWatch integration flag, obsolete now that SeriousErrorV is available
        s/ArthurSWIs - Keep defaultvectab up to date with vector allocations
        s/Middle - Update serious error handling to call SeriousErrorV at several key points. This allows for accurate crash dumps to be obtained, along with a mechanism to warn low-level components such as RTSupport that the privileged mode stacks are being flattened.
        s/Middle - Add OS_ReadSysInfo 15, for enumerating extended ROM footer entries
        s/PMF/osbyte - Update InitNewFX0Error to use the ROM footer entry ID defined in hdr/OSMisc
      Admin:
        Tested on Pi 1B, 2B, 3B
      
      
      Version 5.35, 4.79.2.313. Tagged as 'Kernel-5_35-4_79_2_313'
      b4cf3959
  30. 04 Apr, 2016 1 commit
  31. 25 Mar, 2016 1 commit
    • Jeffrey Lee's avatar
      New HAL device ID reservations · ff04e525
      Jeffrey Lee authored
      Detail:
        hdr/HALDevice - Reserve device IDs for BCM283x CPU clock device and GPU mailbox device
      Admin:
        Tested on Raspberry Pi 1B/2B/3B
      
      
      Version 5.35, 4.79.2.310. Tagged as 'Kernel-5_35-4_79_2_310'
      ff04e525
  32. 17 Mar, 2016 1 commit
  33. 10 Mar, 2016 1 commit
    • Jeffrey Lee's avatar
      Cache maintenance fixes · b0682acb
      Jeffrey Lee authored
      Detail:
        This set of changes tackles two main issues:
        * Before mapping out a cacheable page or making it uncacheable, the OS performs a cache clean+invalidate op. However this leaves a small window where data may be fetched back into the cache, either accidentally (dodgy interrupt handler) or via agressive prefetch (as allowed for by the architecture). This rogue data can then result in coherency issues once the pages are mapped out or made uncacheable a short time later.
          The fix for this is to make the page uncacheable before performing the cache maintenance (although this isn't ideal, as prior to ARMv7 it's implementation defined whether address-based cache maintenance ops affect uncacheable pages or not - and on ARM11 it seems that they don't, so for that CPU we currently force a full cache clean instead)
        * Modern ARMs generally ignore unexpected cache hits, so there's an interrupt hole in the current OS_Memory 0 "make temporarily uncacheable" implementation where the cache is being flushed after the page has been made uncacheable (consider the case of a page that's being used by an interrupt handler, but the page is being made uncacheable so it can also be used by DMA). As well as affecting ARMv7+ devices this was found to affect XScale (and ARM11, although untested for this issue, would have presumably suffered from the "can't clean uncacheable pages" limitation)
          The fix for this is to disable IRQs around the uncache sequence - however FIQs are currently not being dealt with, so there's still a potential issue there.
        File changes:
        - Docs/HAL/ARMop_API, hdr/KernelWS, hdr/OSMisc - Add new Cache_CleanInvalidateRange ARMop
        - s/ARM600, s/VMSAv6 - BangCam updated to make the page uncacheable prior to flushing the cache. Add GetTempUncache macro to help with calculating the page flags required for making pages uncacheable. Fix abort in OS_MMUControl on Raspberry Pi - MCR-based ISB was resetting ZeroPage pointer to 0
        - s/ARMops - Cache_CleanInvalidateRange implementations. PL310 MMU_ChangingEntry/MMU_ChangingEntries refactored to rely on Cache_CleanInvalidateRange_PL310, which should be a more optimal implementation of the cache cleaning code that was previously in MMU_ChangingEntry_PL310.
        - s/ChangeDyn - Rename FastCDA_UpFront to FastCDA_Bulk, since the cache maintenance is no longer performed upfront. CheckCacheabilityR0ByMinusR2 now becomes RemoveCacheabilityR0ByMinusR2. PMP LogOp implementation refactored quite a bit to perform cache/TLB maintenance after making page table changes instead of before. One flaw with this new implementation is that mapping out large areas of cacheable pages will result in multiple full cache cleans while the old implementation would have (generally) only performed one - a two-pass approach over the page list would be needed to solve this.
        - s/GetAll - Change file ordering so GetTempUncache macro is available earlier
        - s/HAL - ROM decompression changed to do full MMU_Changing instead of MMU_ChangingEntries, to make sure earlier cached data is truly gone from the cache. ClearPhysRAM changed to make page uncacheable before flushing cache.
        - s/MemInfo - OS_Memory 0 interrupt hole fix
        - s/AMBControl/memmap - AMB_movepagesout_L2PT now split into cacheable+non-cacheable variants. Sparse map out operation now does two passes through the page list so that they can all be made uncacheable prior to the cache flush + map out.
      Admin:
        Tested on StrongARM, XScale, ARM11, Cortex-A7, Cortex-A9, Cortex-A15, Cortex-A53
        Appears to fix the major issues plaguing SATA on IGEPv5
      
      
      Version 5.35, 4.79.2.306. Tagged as 'Kernel-5_35-4_79_2_306'
      b0682acb
  34. 29 Feb, 2016 1 commit
    • Ben Avison's avatar
      Support for ARMv8 · 66b90f9d
      Ben Avison authored
      Detail:
        * Filled in CPU tables for publicly documented ARMv8 cores (Cortex-A53,57,72).
        * Recent ARM ARMs (e.g. section B1.9.2 of the ARMv7AR ARM) permit the core to
          take an undefined instruction exception upon encountering even not-taken
          conditional undefined instructions. This option is exercised by the
          Cortex-A53, unlike all ARMv7 cores previously supported by RISC OS. This
          unfortunately trips up a lot of kernel code that adapts to different
          architectures at runtime. These have now all been replaced with branches
          over the affected code on the opposite condition.
        * Fixed bug in HAL_InvalidateCache_ARMvF: for the main body of the loop,
          which was written as though to act on the CLIDR register, r8 actually
          contained the CTR register instead.
      Admin:
        Tested on Raspberry Pi 3
      
      Version 5.35, 4.79.2.304. Tagged as 'Kernel-5_35-4_79_2_304'
      66b90f9d
  35. 28 Feb, 2016 1 commit
    • Robert Sprowson's avatar
      Define some extra platform feature flags · 96546b5a
      Robert Sprowson authored
      For disc based applications (ie. those that don't know the architecture at build time, like a ROM would) we have OS_PlatformFeatures to provide an abstract way of seeing when new chunks of instructions get added. Back at ARMv6 ARM deprecated SWP, but currently we have no way of knowing that at runtime without grubbing round the coprocessor registers.
      Add 3 new flags
      * One to say LDR/STREX is (not) available
      * One to say that SWP/SWPB is (not) available
      * One to say that CLREX and LDR/STREX[B|H|D] is (not) available
      shame it took a few goes for ARM to bring in these variants, requiring 3 flags not 1.
      
      Also:
      Condition the exception on vector read code on No32bitCode, rather than just having it permanently disabled.
      Improve the HAL device docs.
      
      Tested on a StrongARM Risc PC, Model B Pi, and Titanium.
      
      Version 5.35, 4.79.2.303. Tagged as 'Kernel-5_35-4_79_2_303'
      96546b5a