- 28 Jul, 2021 5 commits
-
-
Jeffrey Lee authored
Also make lazy task swapping aborts to use IFAR where possible, to ensure any Thumb-2/Jazelle instructions which cross page boundaries are handled correctly.
-
Jeffrey Lee authored
OS_ReadSysInfo 7 is meant to record the details of the last data or prefetch abort that was passed to the environment handlers. This was implemented in Ursula, but the code for recording the prefetch abort details got lost somewhere during the 32 bit conversion process. Restore it.
-
Jeffrey Lee authored
This supports all the load/store instructions, including FPA & VFP/NEON. Most instructions are handled directly via the base version of the AbortTrap API that was first implemented in RISC OS Select. However, to properly cope with LDREX/STREX, and future support for prefetch aborts, the API has been extended to allow the kernel to request that a block of memory is mapped in with certain permissions. For LDREX/STREX the kernel will then rewind the PC so that the instruction can be retried directly. Test code in Dev/AbortTrap exists in order to allow checking of all major functionality, along with code for building the code in a softloadable module for easier/quicker testing.
-
Jeffrey Lee authored
If lazy task swapping is active, but it isn't a lazy task swapping abort, AMB_LazyFixUp will force all of application space to be mapped in, in order to protect the data/prefetech abort environment handlers from triggering unexpected recursive aborts (which could easily happen if the handlers make use of application space in any way). Recursive aborts generally aren't tolerated by these handlers because they're entered in ABT32 mode and may rely on the DFSR/DFAR registers being correct. To allow for more stages to be added to the abort handler inbetween lazy task swapping fixup & invoking the abort environment handler, AMB_LazyFixUp has now been split in two so that the code which maps in all of application space can be excuted at a more suitable time.
-
Jeffrey Lee authored
There was some redundant code needlessly pushing & popping various registers to the stack, left behind from when we removed the code that dealt with 26-bit processor vector reads on StrongARM & processed the proto-OS_AbortTrap "abort indirection nodes".
-
- 13 Dec, 2016 2 commits
-
-
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'
-
Jeffrey Lee authored
Detail: With this set of changes, each AMB node is now the owner of a fake DANode which is linked to a PMP. From a user's perspective the behaviour of AMBControl is the same as before, but rewriting it to use PMPs internally offers the following (potential) benefits: * Reduction in the amount of code which messes with the CAM & page tables, simplifying future work/maintenance. Some of the AMB ops (grow, shrink) now just call through to OS_ChangeDynamicArea. However all of the old AMB routines were well-optimised, so to avoid a big performance hit for common operations not all of them have been removed (e.g. mapslot / mapsome). Maybe one day these optimal routines will be made available for use by regular PMP DAs. * Removal of the slow Service_MemoryMoved / Service_PagesSafe handlers that had to do page list fixup after the core kernel had reclaimed/moved pages. Since everything is a PMP, the kernel will now deal with this on behalf of AMB. * Removal of a couple of other slow code paths (e.g. Do_AMB_MakeUnsparse calls from OS_ChangeDynamicArea) * Potential for more flexible mapping of application space in future, e.g. sparse allocation of memory to the wimp slot * Simpler transition to an ASID-based task swapping scheme on ARMv6+? Other changes of note: * AMB_LazyMapIn switch has been fixed up to work correctly (i.e. turning it off now disables lazy task swapping and all associated code instead of producing a build error) * The DANode for the current app should be accessed via the GetAppSpaceDANode macro. This will either return the current AMB DANode, or AppSpaceDANode (if e.g. pre-Wimp). However be aware that AppSpaceDANode retains the legacy behaviour of having a base + size relative to &0, while the AMB DANodes (identifiable via the PMP flag) are sane and have their base + size relative to &8000. * Mostly-useless DebugAborts switch removed * AMBPhysBin (page number -> phys addr lookup table) removed. Didn't seem to give any tangible performance benefit, and was imposing hidden restrictions on memory usage (all phys RAM fragments in PhysRamTable must be multiple of 512k). And if it really was a good optimisation, surely it should have been applied to all areas of the kernel, not just AMB! Other potential future improvements: * Turn the fake DANodes into real dynamic areas, reducing the amount of special code needed in some places, but allow the DAs to be hidden from OS_DynamicArea 3 so that apps/users won't get too confused * Add a generic abort trapping system to PMPs/DAs (lazy task swapping abort handler is still a special case) File changes: - s/ARM600, s/VMSAv6, s/ExtraSWIs - Remove DebugAborts - s/ArthurSWIs - Remove AMB service call handler dispatch - s/ChangeDyn - AMB_LazyMapIn switch fixes. Add alternate internal entry points for some PMP ops to allow the DANode to be specified (used by AMB) - s/Exceptions - Remove DebugAborts, AMB_LazyMapIn switch fixes - s/Kernel - Define GetAppSpaceDANode macro, AMB_LazyMapIn switch fix - s/MemInfo - AMB_LazyMapIn switch fixes - s/AMBControl/AMB - Update GETs - s/AMBControl/Memory - Remove block size quantisation, AMB_BlockResize (page list blocks are now allocated by PMP code) - s/AMBControl/Options - Remove PhysBin definitions, AMBMIRegWords (moved to Workspace file), AMB_LimpidFreePool switch. Add AMB_Debug switch. - s/AMBControl/Workspace - Update AMBNode to contain an embedded DANode. Move AMBMIRegWords here from Options file. - s/AMBControl/allocate - Fake DA node initialisation - s/AMBControl/deallocate - Add debug output - s/AMBControl/growp, growshrink, mapslot, mapsome, shrinkp - Rewrite to use PMP ops where possible, add debug output - s/AMBControl/main - Remove PhysBin initialisation. Update the enumerate/mjs_info call. - s/AMBControl/memmap - Low-level memory mapping routines updated or rewritten as appropriate. - s/AMBControl/readinfo - Update to cope with DANode - s/AMBControl/service - Remove old service call handlers - s/AMBControl/handler - DA handler for responding to PMP calls from OS_ChangeDynamicArea; just calls through to growpages/shrinkpages as appropriate. Admin: Tested on pretty much everything currently supported Version 5.66. Tagged as 'Kernel-5_66'
-
- 30 Jun, 2016 1 commit
-
-
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'
-