1. 21 Oct, 2023 1 commit
    • Phil Pemberton's avatar
      Add symbolic names for VIDC20 device-specific flags · 55f1c8fd
      Phil Pemberton authored
      Add VCO, TV, NTSC video flag to VDU VideoDevice descriptor for Bush IBX (and
      possibly others later). Allows the HAL to convey hardware settings to
      the VIDC20Driver at run time.
      Also add the Lazarus machine name to the list of machines for abort trap.
      
      Version 6.69. Tagged as 'Kernel-6_69'
      55f1c8fd
  2. 19 Aug, 2023 1 commit
  3. 14 Jan, 2023 1 commit
  4. 05 Jan, 2023 1 commit
  5. 01 Jun, 2022 1 commit
    • Ben Avison's avatar
      Add symbols for access privileges to Hdr:OSMem · cf78d2c9
      Ben Avison authored
      These are the 4 common access privilege values in bits 0-3 of OS_DynamicArea 0
      and word 3 of the entries used with OS_Read/SetMemMapEntries. They are
      equivalent to the kernel's internal OSAP_* symbols.
      
      Version 6.59. Not tagged
      cf78d2c9
  6. 07 Aug, 2021 1 commit
  7. 28 Jul, 2021 7 commits
    • Jeffrey Lee's avatar
      Add AP 1 emulation for long descriptor page tables · f93d930d
      Jeffrey Lee authored
      The long descriptor page table format doesn't support RISC OS access
      privilege 1 (user RX, privileged RWX). Previously we were downgrading
      this to AP 0 (user RWX, privielged RWX), which obviously weakens the
      security of the memory. However now that we have an AbortTrap
      implementation, we can map the memory as "user none, privileged RWX" and
      provide user read support via AbortTrap's instruction decode & execute
      logic.
      
      There's no support for executing usermode code from the memory, but the
      compatibility issues caused by that are likely to be minimal.
      f93d930d
    • Jeffrey Lee's avatar
      Add abortable DA support · fccd5e2f
      Jeffrey Lee authored
      This implementation should be compatible with RISCOS Ltd's
      implementation.
      fccd5e2f
    • Jeffrey Lee's avatar
      Add OS_AbortTrap implementation · c199c178
      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.
      c199c178
    • Jeffrey Lee's avatar
      OS_PlatformFeatures 34: Report presence of some CP15 regs · 3d5802b0
      Jeffrey Lee authored
      Report whether:
      * DFAR & DFSR are writable
      * IFAR, IFSR, AIFSR, ADFSR are implemented
      3d5802b0
    • Jeffrey Lee's avatar
      Add extra ops to hdr/Copro15ops · 994013b4
      Jeffrey Lee authored
      More data & prefetch abort registers
      994013b4
    • Jeffrey Lee's avatar
      Tidy up data abort handling · 876079a4
      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".
      876079a4
    • Jeffrey Lee's avatar
      Allow RW/ZI sections to be used · 2b665896
      Jeffrey Lee authored
      * Instruct the linker to place any RW/ZI data sections in the last ~16MB
      of the memory map, starting from &ff000000 (with the current toolchain,
      giving it a fixed base address is much easier than giving it a variable
      base address)
      * The RW/ZI section is mapped as completely inaccessible to user mode
      * The initial content of the RW section is copied over shortly after MMU
      startup (in Continue_after_HALInit)
      * Since link's -bin option produces a file containing a copy of the
      (zero-initialised) ZI section, the kernel binary is now produced from a
      "binary with AIF header" AIF with the help of the new 'kstrip' tool.
      kstrip extracts just the RO and RW sections, ensuring the ROM doesn't
      contain a redundant block of zeros for the ZI section.
      
      This should make it easier to use C code & arbitrary libraries within
      the kernel, providing they're compiled with suitable settings (e.g.
      non-module, no FP, no stack checking, like HALs typically use)
      2b665896
  8. 28 Apr, 2021 6 commits
    • Jeffrey Lee's avatar
      Log -> phys conversion improvements · 46081bca
      Jeffrey Lee authored
      * RISCOS_LogToPhys upgraded to allow it to cope with all page types
      (added support for 64KB "large" pages and lazily-mapped pages)
      
      * Added OS_Memory 65, which calls through to RISCOS_LogToPhys, to allow
      regular software to do logical-to-physical conversions for all page
      types (other calls, like OS_Memory 0/64, typically only work with 4KB
      pages)
      
      * LoadAndDecodeL2Entry updated to always return a page/entry size, like
      LoadAndDecodeL1Entry
      
      Version 6.56. Tagged as 'Kernel-6_56'
      46081bca
    • Jeffrey Lee's avatar
      Support runtime selection of pagetable format · ba993cb5
      Jeffrey Lee authored
      Runtime selection between long descriptor and short descriptor page
      table format is now possible (with the decision based on whether the HAL
      registers any high RAM or not). The main source changes are as follows:
      
      * LongDesc and ShortDesc switches are in hdr.Options to control what
      kernel variant is built
      * PTOp and PTWhich macros introduced in hdr.ARMops to allow for
      invocation of functions / code blocks which are specific to the page
      table format. If the kernel is being built with only one page table
      format enabled, PTOp is just a BL instruction, ensuring there's no
      performance loss compared to the old code.
      * _LongDesc and _ShortDesc suffixes added to various function names, to
      allow both versions of the function to be included at once if runtime
      selection is enabled
      * Most of the kernel / MMU initialisation code in s.HAL is now encased
      in a big WHILE loop, allowing it to be duplicated if runtime switching
      is enabled (easier than adding dynamic branches all over the place, and
      only costs a few KB of ROM/RAM)
      * Some more functions (notably AccessPhysicalAddress,
      ReleasePhysicalAddress, and MapInIO) have been moved to s.ShortDesc /
      s.LongDesc since they were already 90% specific to page table format
      ba993cb5
    • Jeffrey Lee's avatar
      Extend OS_Memory 19 for 64bit phys addresses · b53b73cd
      Jeffrey Lee authored
      Bit 11 of R0 can be used to indicate that the callback functions use
      64bit physical addresses instead of 32bit ones.
      b53b73cd
    • Jeffrey Lee's avatar
      Add OS_Memory 64, to supersede OS_Memory 0 · d5e91a02
      Jeffrey Lee authored
      OS_Memory 64 is an extended form of OS_Memory 0 which uses 64bit
      addresses instead of 32bit. Using 64bit physical addresses allows
      conversions to/from physical addresses to be performed on pages with
      large physical addresses. Using 64bit logical addresses provides us some
      future-proofing for an AArch64 version of RISC OS, with a 64bit logical
      memory map.
      d5e91a02
    • Jeffrey Lee's avatar
      Add MaxCamEntry32 & CPUFlag_HighRAM · 5bd42912
      Jeffrey Lee authored
      MaxCamEntry32 is an internal variable which the kernel can use to
      quickly determine whether a RAM page has a 32bit physical address or
      something larger, by comparing with the physical page number (currently
      entries in PhysRamTable are sorted such that all 32bit pages come first)
      
      CPUFlag_HighRAM (aka OS_PlatformFeatures 0 bit 21) is a flag that
      external code can use to detect whether any high RAM is present, and
      thus whether 64bit physical address APIs should be preferred over 32bit
      ones (once the new APIs are implemented!). Using APIs which only support
      32bit physical addresses will result in functionality being limited.
      5bd42912
    • Jeffrey Lee's avatar
      Support RAM banks with high physical addresses · df4efb68
      Jeffrey Lee authored
      This changes PhysRamTable to store the address of each RAM bank in terms
      of (4KB) pages instead of bytes, effectively allowing it to support a 44
      bit physical address space. This means that (when the long descriptor
      page table format is used) the OS can now make use of memory located
      outside the lower 4GB of the physical address space. However some
      public APIs still need extending to allow for all operations to be
      supported on high RAM (e.g. OS_Memory logical to physical address
      lookups)
      
      OS_Memory 12 (RecommendPage) has been extended to allow R4-R7 to be used
      to specify a (64bit) physical address range which the recommended pages
      must lie within. For backwards compatibility this defaults to 0-4GB.
      df4efb68
  9. 20 Mar, 2021 1 commit
    • Jeffrey Lee's avatar
      Fix MaxInterrupts for Pi 4 · 7f1f637a
      Jeffrey Lee authored
      Value needs to be increased from 256 to 320, so that the IRQ table is
      large enough to allow the core 2 & 3 private interrupts to be managed.
      7f1f637a
  10. 17 Mar, 2021 3 commits
    • Jeffrey Lee's avatar
      Initial large phys addr support for RISCOS_AddRAM · 21a340f4
      Jeffrey Lee authored
      Define that bit 12 of the RISCOS_AddRAM flags indicates that the
      supplied start, end, and sigbits values are in 4KB units instead of byte
      units. This allows a 44 bit address space to be used, higher than the 40
      bit LPAE limit.
      
      The page list that RISCOS_AddRAM constructs will now store everything in
      4KB page units, however any RAM above 4GB will currently be thrown away
      when the list is later transferred to the PhysRamTable which the OS uses
      at runtime.
      
      Version 6.54. Tagged as 'Kernel-6_54'
      21a340f4
    • Jeffrey Lee's avatar
      Remove CAM size limit · 79bc3343
      Jeffrey Lee authored
      Previously the CAM sat inside a fixed 16MB window, restricting it to
      storing the details of 1 million pages, i.e. 4GB of RAM. Shuffle things
      around a bit to allow this restriction to be removed: the CAM is now
      located just above the IO region, and the CAM start address /
      IO top will calculated appropriately during kernel init. This change
      paves the way for us to support machines with over 4GB of RAM.
      
      FixedAreasTable has also been removed, since it's no longer really
      necessary (DAs can only be created between the top of application space
      and the bottom of the used IO space, and it's been a long time since
      we've had any fixed bits in the middle of there)
      79bc3343
    • Jeffrey Lee's avatar
      Initial long descriptor support · b51b5540
      Jeffrey Lee authored
      This adds initial support for the "long descriptor" MMU page table
      format, which allows the CPU to (flexibly) use a 40-bit physical address
      space.
      
      There are still some features that need fixing (e.g. RISCOS_MapInIO
      flags), and the OS doesn't yet support RAM above the 32bit limit, but
      this set of changes is enough to allow for working ROMs to be produced.
      
      Also, move MMUControlSoftCopy initialisation out of ClearWkspRAM, since
      it's unrelated to whether the HAL has cleared the RAM or not.
      b51b5540
  11. 30 Jan, 2021 3 commits
    • Jeffrey Lee's avatar
      Expose ABTSTK via OS_ReadSysInfo 6 · 02e5e4dc
      Jeffrey Lee authored
      It's the only privileged-mode stack which doesn't have its address
      exposed via OS_ReadSysInfo 6. Expose it so that software which wants to
      know its address can read it instead of relying on hardcoded values.
      
      Tested on Raspberry Pi 4
      
      Version 6.50. Tagged as 'Kernel-6_50'
      02e5e4dc
    • Jeffrey Lee's avatar
      Remove some quirks from the memory map · d0c4b0c1
      Jeffrey Lee authored
      The correct amount of space is now reserved for Kbuffs, and there's no
      need to have a 1MB gap where the old PhysicalAccess window was.
      
      Tested on Raspberry Pi 4
      d0c4b0c1
    • Jeffrey Lee's avatar
      More declarative memory map · ee6d31a3
      Jeffrey Lee authored
      Although storage maps are useful for allowing the fixed areas of the
      memory map to be relocated, it isn't clear in the current definition
      what the size of each area is, and it's hard to ensure that all the
      areas are kept at the correct alignment.
      
      Replace the current basic workspace definition with one which makes use
      of the new ASpace macro, to allow addresses to be calculated
      automatically based on the size & alignment of each area. Also output
      the address of each area in the build log for easy
      debugging/verification.
      
      Binary unchanged.
      ee6d31a3
  12. 16 Jan, 2021 2 commits
  13. 23 May, 2020 1 commit
    • Ben Avison's avatar
      Mirror OS_AMBControl changes from Pyromaniac · 2991e2df
      Ben Avison authored
      * Create new header file defining symbolic name for OS_AMBControl
        reason codes and flags
      * Implement OS_AMBControl 9 (used to determine required size of buffer
        passed to OS_AMBControl 8 - potential thread safety issue not addressed)
      * Return allocated error numbers in various failure cases
      
      Version 6.38. Tagged as 'Kernel-6_38'
      2991e2df
  14. 23 Mar, 2020 1 commit
    • ROOL's avatar
      Resync with allocations database · b5d0e2dc
      ROOL authored
      Edits to the RISCOS header file should really have gone through the
      allocations system. Fortunately, no harm was done in this case, but a
      minor syntactical change is required in order to bring it in line with
      the automatic redaction scripts used when exporting the header from the
      allocations database.
      
      Version 6.37. Not tagged
      b5d0e2dc
  15. 21 Mar, 2020 1 commit
    • Jeffrey Lee's avatar
      Add scroll mouse support · 66b2aac7
      Jeffrey Lee authored
      * Listen out for PointerV 9, which (RISC OS 5) mouse drivers use to
      indicate scroll wheel updates + extra button status
      * Changes in the state of the extra buttons are treated the same as
      changes to normal mouse buttons: signalled via Event_Mouse, and stored
      in the mouse buffer (for reading via OS_Mouse).
      * Changes in the scroll wheel(s) are signalled via Event_Expansion,4. If
      the event vector call is unclaimed, the kernel's wheel position
      accumulators will be updated
      * Wheel position accumulators can be read via OS_Pointer 2
      * Wheel position accumulators implement "wrap to zero" logic on overflow
      
      This matches RISCOS Ltd's implementation
      (http://www.riscos.com/support/developers/riscos6/input/pointerdevices.html),
      except that:
      
      * The kernel currently doesn't call PointerV 4, so PointerV 9 is the
      only way drivers can report wheel + extra button status
      * Extra mouse buttons don't generate KeyV transitions
      * Our implementation is in the kernel, not an OSPointer module
      
      Version 6.37. Tagged as 'Kernel-6_37'
      66b2aac7
  16. 02 Mar, 2020 2 commits
    • Robert Sprowson's avatar
      Add aligned RMA claim subreason · fd81a66c
      Robert Sprowson authored
      OS_Module
      => R0=24
         R3=size in bytes
         R4=alignment in bytes (must be a power of 2)
      <= R2=base of request
         or error
      Tested with a handful of valid and invalid alignments, and with one grossly larger than the free RMA to trigger an RMA extend to occur.
      
      Version 6.35. Tagged as 'Kernel-6_35'
      fd81a66c
    • ROOL's avatar
      Record various numbers used in other strands of RISC OS and compatible systems · 81b079e8
      ROOL authored
      Detail:
        * various low-numbered dynamic areas used by RISC OS 6 and Pyromaniac
        * OS_ReadSysInfo 8 host platform classes for VirtualRPC, A9Home, Pyromaniac
        * OS_Byte 0,<not 0> MosVer values for various systems since the BBC micro
        * OS_Byte 129,0,255 (BASIC INKEY -256) values for various RISC OS systems
      
      Admin:
        Discovered that these weren't really recorded anywhere during recent
        allocation request. Some information gleaned from http://beebwiki.mdfs.net
      
      Version 6.34. Not tagged
      81b079e8
  17. 27 Feb, 2020 1 commit
    • Robert Sprowson's avatar
      Assign a USB flag · 56230247
      Robert Sprowson authored
      The XHCIDriver module adds 64k to get the register address. In an attempt to phase this out (so the registers are the true base address), assign a flag so that loading a suitable XHCIDriver on an old HAL still works.
      
      Version 6.33. Not tagged
      56230247
  18. 12 Feb, 2020 1 commit
    • Jeffrey Lee's avatar
      Be more forgiving of GraphicsV init failures · e4a8bac2
      Jeffrey Lee authored
      * Update OS_ScreenMode 11's handling of drivers which fail to
      initialise. If there was no previous driver, then instead of trying to
      restore that nonexistant driver, stick with the new one. This is mainly
      to help with the case where the kernel's built in modes aren't accepted
      by the driver, and valid modes only become available once an MDF is
      loaded (this can happen with early OMAP3 chip revisions, which have very
      tight sync & porch limits, causing 90% of the kernel's modes to be
      rejected). If the kernel was to revert to the "no driver" state, then
      loading the MDF would still leave you with no video output.
      * Since we can now end up in a state where a driver is selected but
      hasn't been programmed yet, update OS_Byte 19 to detect this (via the
      magic ScreenBlankDPMSState value of 255) and avoid waiting for VSync
      * Update RemovePages & InsertRemovePagesExit (screen DA handlers) to
      avoid infinite loops if the screen DA gets shrunk to zero size (was seen
      while attempting to complete the !Boot sequence while no driver was
      active)
      
      Version 6.33. Tagged as 'Kernel-6_33'
      e4a8bac2
  19. 24 Nov, 2019 2 commits
    • Jeffrey Lee's avatar
      Add OS_DynamicArea 27+28, for supporting lots of RAM · 9224a6ca
      Jeffrey Lee authored
      OS_DynamicArea 27 is the same as OS_DynamicArea 5 ("return free
      memory"), except the result is measured in pages instead of bytes,
      allowing it to behave sensibly on machines with many gigabytes of RAM.
      
      Similarly, OS_DynamicArea 28 is the same as OS_DynamicArea 7 (internal
      DA enumeration call used by TaskManager), except the returned size
      values are measured in pages instead of bytes. A flags word has also
      been added to allow for more expansion in the future.
      
      Hdr:OSMem now also contains some more definitions which external code
      will find useful.
      
      Version 6.29. Tagged as 'Kernel-6_29'
      9224a6ca
    • Robert Sprowson's avatar
      Add GENET to the list of HAL devices · a5db413c
      Robert Sprowson authored
      Version 6.28. Not tagged
      a5db413c
  20. 19 Nov, 2019 1 commit
    • Jeffrey Lee's avatar
      Allow reservation of memory pages · 1f84ad9f
      Jeffrey Lee authored
      This change adds a new OS_Memory reason code, 23, for reserving memory
      without actually assigning it to a dynamic area. Other dynamic areas can
      still use the memory, but only the code that reserved it will be allowed
      to claim exclusive use over it (i.e. PageFlags_Unavailable).
      
      This is useful for systems such as the PCI heap, where physically
      contiguous memory is required, but the memory isn't needed all of the
      time. By reserving the pages, it allows other regular DAs to make use of
      the memory when the PCI heap is small. But when the PCI heap needs to
      grow, it guarantees that (if there's enough free memory in the system)
      the previously reserved pages can be allocated to the PCI heap.
      
      Notes:
      
      * Reservations are handled on an honour system; there's no checking that
      the program that reserved the memory is the one attempting to map it in.
      
      * For regular NeedsSpecificPages DAs, reserved pages can only be used if
      the special "RESV" R0 return value is used.
      
      * For PMP DAs, reserved pages can only be made Unavailable if the entry
      in the page block also specifies the Reserved page flag. The actual
      state of the Reserved flag can't be modified via PMP DA ops, the flag is
      only used to indicate the caller's permission/intent to make the page
      Unavailable.
      
      * If a PMP DA tries to make a Reserved page Unavailable without
      specifying the Reserved flag, the kernel will try to swap it out for a
      replacement page taken from the free pool (preserving the contents and
      generating Service_PagesUnsafe / Service_PagesSafe, as if another DA
      had claimed the page)
      
      Version 6.28. Tagged as 'Kernel-6_28'
      1f84ad9f
  21. 05 Nov, 2019 1 commit
    • Jeffrey Lee's avatar
      Add support for HeapReason_GetSkewAligned · b954559e
      Jeffrey Lee authored
      Detail:
      Similar to HeapReason_GetAligned, GetSkewAligned is used for allocating
      aligned blocks (with optional boundary limit). However instead of using
      the logical address of the user portion of the block for the alignment
      calculation, it uses an arbitrary offset specified in R5. This makes
      it useful for clients such as the PCI module, which care about the
      physical alignment of blocks rather than logical alignment.
      
      Admin:
      Tested with heaptest
      b954559e
  22. 30 Sep, 2019 1 commit
    • Jeffrey Lee's avatar
      Allow runtime adjustment of AplWorkMaxSize · 0aeea07f
      Jeffrey Lee authored
      Detail:
      This adds a new OS_DynamicArea reason code, 26, for adjusting
      AplWorkMaxSize at runtime. This allows compatibility tools such as
      Aemulor to adjust the limit without resorting to patching the kernel.
      Any adjustment made to the value will affect the upper limit of
      application space, and the lower limit of dynamic area placement.
      Attempting to adjust beyond the compile-time upper/default limit, or
      such that it will interfere with existing dynamic areas / wimpslots,
      will result in an error.
      
      Relevant forum thread:
      https://www.riscosopen.org/forum/forums/11/topics/14734
      
      Admin:
      Tested on BB-xM, desktop active & inactive
      
      Version 6.24. Tagged as 'Kernel-6_24'
      0aeea07f