1. 10 Jun, 2018 1 commit
    • Jeffrey Lee's avatar
      Try and avoid blocking callbacks · 73fd8884
      Jeffrey Lee authored
      Detail:
        The kernel has a 'callback postponement flag' which will be set whenever an X SWI, called from user mode, returns a pointer to an error (and the error block looks like it's in RAM).
        Although this flag will help prevent the error buffer from being overwritten by any errors generated by callbacks, it will also have the effect of blocking Alt-Break and CLib's Escape handler, due to them both being reliant on callbacks.
        Since the flag may persist for a long time, it can be dangerous to leave the OS in this state (the flag can only be cleared by a SWI call from user mode - which may never happen if the program is stuck in a bad state).
        So to combat this, CLib will now make some effort to try and avoid leaving the postponement flag in situations where it shouldn't be needed.
        File changes:
        - c/armsys:
          - Change _sys_flen to return 0 for TTY streams, since calling OS_Args for them isn't going to generate any useful result (previously it was generating an error, causing the postponement flag to be left set on entry to main())
          - Be extra vigilant when entering main() to make sure the callback postponement flag isn't set, just in case other checks don't resolve it
        - kernel/s/k_body:
          - Change CopyError to attempt to clear the callback postponement flag if we suspect it's set. We've just copied the error to our own buffer, so it should be our job to worry about preventing that buffer being prematurely overwritten, not the kernel's.
      Admin:
        Tested on BB-xM
        'while (1) {}' (and similar variants) now multitasks in task windows and is no longer unkillable
        Fixes issue reported on forums:
        https://www.riscosopen.org/forum/forums/4/topics/11542#posts-79767
      
      
      Version 5.96. Tagged as 'RISC_OSLib-5_96'
      73fd8884
  2. 14 Apr, 2018 1 commit
    • Jeffrey Lee's avatar
      Make abort handling more robust · e4577090
      Jeffrey Lee authored
      Detail:
        kernel/s/k_body - Update AbortFindHandler to check that SP & SL are both word aligned, especially because the code will attempt to load from SL to check for the stack chunk magic marker.
      Admin:
        Tested on BB-xM
        Avoids some "abort while in abort handler" type scenarios if an abort occurs while SP/SL are invalid
      
      
      Version 5.95. Tagged as 'RISC_OSLib-5_95'
      e4577090
  3. 03 Sep, 2017 1 commit
    • Jeffrey Lee's avatar
      Eliminate some global OS_SynchroniseCodeAreas calls · d89ca652
      Jeffrey Lee authored
      Detail:
        kernel/s/k_body - Eliminate a couple of global OS_SynchroniseCodeAreas calls in _kernel_init and _kernel_system
        s/initmodule - Eliminate a global OS_SynchroniseCodeAreas call in _Shared_Lib_Module_SWI_Code
      Admin:
        Tested on iMx6
        Improves performance with SMP ROMs, where global D-cache clean isn't really possible
      
      
      Version 5.93. Tagged as 'RISC_OSLib-5_93'
      d89ca652
  4. 28 May, 2016 1 commit
    • Jeffrey Lee's avatar
      Remove ARM2 NOPs · e52669b7
      Jeffrey Lee authored
      Detail:
        kernel/s/k_body, s/initmodule - Remove NOPs from after PSR manipulation macros; the macros now fully take care of ARM2 & StrongARM compatibility for us
      Admin:
        Tested PlingSystem build on (ARM3) RISC OS 3.1
        Requires HdrSrc-2_63 for ARM2 compatibility
      
      
      Version 5.92. Tagged as 'RISC_OSLib-5_92'
      e52669b7
  5. 24 May, 2016 1 commit
    • Jeffrey Lee's avatar
      When multiple CPU architectures are supported, allow dynamically linked... · f3f167bc
      Jeffrey Lee authored
      When multiple CPU architectures are supported, allow dynamically linked clients to be given optimal versions of routines where possible
      
      Detail:
        This set of changes adds support for representing architecture-specific variants of routines within the export tables which the shared C library uses to fill in the client's stubs.
        This allows builds of the module which target multiple architectures (e.g. IOMD, Raspberry Pi, or softloads) to offer the most optimal versions of routines to clients wherever multiple variants exist.
        If only one architecture is supported, only one version of each routine will be built, and no variant tables will be generated.
        Currently routine selection for staticly linked clients isn't supported - staticly linked targets will only use the most backwards-compatible version of the routines, as before. Also not all routines are catered for yet (e.g. _ll_udiv)
        File changes:
        - s/h_common - New file containing macros used during variant table construction
        - Makefile - Set SHARED_C_LIBRARY to {TRUE} for SCL builds of assembler code, as per the SHARED_C_LIBRARY #define
        - kernel/s/k_body, s/longlong - For routines which have multiple variants available for the target architectures, build all variants, and generate variant table entries using the new RoutineVariant macro. This has required some reordering of the different variants to make sure that when both versions are built, the most backwards-compatible one will be first (and thus will be called by staticly linked clients)
        - s/h_modmacro - "Entry" macro (when building SCL export tables) changed to use DCD instead of B, to allow byte-aligned symbols to be represented (low bits of symbol address is now used as 'is a variant table' flag)
        - s/initmodule - Client stub initialisation rewritten to take into account the B -> DCD change, and to detect and evaluate variant entries
        - clib/s/cl_entries, kernel/s/k_entries, kernel/s/k_entries2 - Update library entry tables to reference the variant forms of routines where relevant
      Admin:
        Tested on Raspberry Pi 1, 2, 3 (ROM), RISC OS 3.1 & StrongARM 3.7 (softload 26bit build)
        Requires Kernel-5_35-4_79_2_325
      
      
      Version 5.91. Tagged as 'RISC_OSLib-5_91'
      f3f167bc
  6. 08 May, 2016 1 commit
    • Jeffrey Lee's avatar
      Prefer CPS over MSR for PSR manipulation. Use UDIV/SDIV for general-purpose... · 377852c3
      Jeffrey Lee authored
      Prefer CPS over MSR for PSR manipulation. Use UDIV/SDIV for general-purpose division, and UMULL for /10.
      
      Detail:
        s/k_body:
        - _kernel_irqs_off and _kernel_irqs_on now use CPS for disabling/enabling IRQs as opposed to MSR. Apart from being shorter code sequences, it's generally a faster instruction.
        - __rt_udiv and __rt_sdiv (and aliases) now use the UDIV and SDIV instructions if building for ARMv7VE
        - __rt_udiv10 and __rt_sdiv10 (and aliases) now use UMULL to multiply by 1/10 when building for targets with long multiply support, as this is faster than the old method. UDIV/SDIV can be fast too, but only for small numbers, making UMULL the best for the general case.
      Admin:
        Tested on Cortex-A15
        Prototyping of division routines on assorted CPUs shows that UDIV/SDIV is generally between 20% and 400% faster than the old routine (Cortex-A7, Cortex-A53), or up to 1300% faster on Cortex-A15 (the CPU does not like the old routine!)
        Division by 10 is now about 20% faster across all appropriate CPUs
      
      
      Version 5.89. Tagged as 'RISC_OSLib-5_89'
      377852c3
  7. 01 Mar, 2016 2 commits
  8. 29 Feb, 2016 1 commit
    • Ben Avison's avatar
      Support for ARMv8 · 9b78d05f
      Ben Avison authored
      Detail:
        The SWP and SWPB instructions have finally been removed in ARMv8, after
        having been deprecated for a very long time. This version adds alternative
        versions of code that used to use them with ones that use LDREX/STREX and
        LDREXB/STREXB instead. Soft-loadable C libraries will choose between
        implementations at runtime using OS_PlatformFeatures; ROM builds only
        include the appropriate version for the target hardware.
      Admin:
        Tested on Raspberry Pi 3.
      
      Version 5.88. Tagged as 'RISC_OSLib-5_88'
      9b78d05f
  9. 16 Jan, 2015 1 commit
    • Jeffrey Lee's avatar
      Escape some dollars · 4733881f
      Jeffrey Lee authored
      Detail:
        kernel/s/k_body, s/initmodule - Escape some dollars contained in strings to avoid warnings from objasm
      Admin:
        Resulting binary unchanged
      
      
      Version 5.83. Retagged as 'RISC_OSLib-5_83'
      4733881f
  10. 20 Jan, 2014 1 commit
    • Jeffrey Lee's avatar
      Fix 32bitification error · a654e89d
      Jeffrey Lee authored
      Detail:
        kernel/s/k_body - At CopyUpDone in _kernel_system(), a big block of conditional code was converted to unconditional as part of the 32bit conversion process. However one line for setting up the error handler remained conditional, potentially preventing the correct error buffer pointer being set when about to start the child task.
      Admin:
        Tested on BB-xM
      
      
      Version 5.79. Tagged as 'RISC_OSLib-5_79'
      a654e89d
  11. 26 Jun, 2012 1 commit
    • Jeffrey Lee's avatar
      Improve sanity checks in default_unwind_handler · 7289ddae
      Jeffrey Lee authored
      Detail:
        kernel/s/k_body - Now ignores unaligned PC values, as they either indicate stack corruption or Thumb use (which the unwind handler doesn't support anyway)
      Admin:
        Tested on Raspberry Pi with high processor vectors
      
      
      Version 5.70. Tagged as 'RISC_OSLib-5_70'
      7289ddae
  12. 16 Feb, 2012 1 commit
  13. 26 Nov, 2011 1 commit
    • Robert Sprowson's avatar
      Review use of StrongARM switch. · 8988adae
      Robert Sprowson authored
      Was being used to conditionalise things which aren't really StrongARM related, now should be read as "support split I+D caches" switch.
      
      Version 5.65. Tagged as 'RISC_OSLib-5_65'
      8988adae
  14. 28 Oct, 2011 1 commit
    • Ben Avison's avatar
      File handling improvements · 8dcb6880
      Ben Avison authored
      Detail:
        * Added 64-bit file pointer API support, following the LFS spec v1.5
          (see Docs directory). Internally, now uses 64-bit file pointers
          exclusively. For now, the backend still limits you to 4GB-1 files, but
          clients of the C library won't need recompiling again to support larger
          files than this once they use the new API.
        * Fixed a large number of warnings produced in compilation, assembly and
          linking, many of them new and resulting from the improved checks in the
          latest toolchain.
        * Increased the maximum stream buffer size from 16MB to 1GB.
        * Added Hdr:SDFS and Hdr:SDIO to the list of headers used to build swis.h
          if they are present.
      Admin:
        Verified that the new 64-bit file pointer buffering code works using a
        ROM build (since the toolchain makes extensive use of reading, writing
        and seeking internally).
      
      Version 5.64. Tagged as 'RISC_OSLib-5_64'
      8dcb6880
  15. 06 Aug, 2011 1 commit
    • Jeffrey Lee's avatar
      Update to work with zero page relocation · 14a49538
      Jeffrey Lee authored
      Detail:
        clib/s/cl_stub, kernel/s/k_body, s/initmodule - Use OS_ReadSysInfo 6 to look up CLibWord/RISCOSLibWord/CLibCounter location each time it's needed instead of using hardcoded addresses. SWI overhead shouldn't be too bad since the zero page areas are rarely used.
        rlib/c/menu - Fix null pointer access when attempting to clear a submenu pointer via menu_submenu(...,...,NULL)
        s/h_workspc - Remove old local definitions of CLibCounter, RISCOSLibWorkSpace and CLibWorkSpace. Use Hdr:PublicWS instead.
      Admin:
        Tested on rev A2 BB-xM
      
      
      Version 5.60. Tagged as 'RISC_OSLib-5_60'
      14a49538
  16. 28 Nov, 2009 1 commit
    • Jeffrey Lee's avatar
      Improve safety & reliability of callback handling in SharedCLibrary · 96b4a3c3
      Jeffrey Lee authored
      Detail:
        CallBackHandler in kernel.s.k_body now ensures that the stored 'sp' and 'sl' values are word-aligned before attempting to read from 'sl' to verify that it points to a stack chunk. This avoids an exception being triggered in certain situations when alignment exceptions are turned on and a piece of hand-written assembler is using the sl register to store data.
      Admin:
        Further checks should be added to check that 'fp' is valid before calling _kernel_unwind, as _kernel_unwind currently only performs minimal checks that are not always sufficient.
        Tested on rev C2 beagleboard with KinoAmp pre-release.
      
      
      Version 5.56. Tagged as 'RISC_OSLib-5_56'
      96b4a3c3
  17. 31 May, 2009 1 commit
    • Peter Naulls's avatar
      Normalise C and assembler include paths · ca954eea
      Peter Naulls authored
      Detail:
       This changes all the C and assembler includes to be a canoncial Unix format.
       Also match include paths to previous commit for EditIntern/DrawIntern/VerIntern
       Finally, also include some minor type fixes (NULL vs 0)
      Admin:
       May be some other paths elsewhere in the source I'm not immediately able to fix.  Will address any issues ASAP, since this is a huge change.
      
      Version 5.54. Not tagged
      ca954eea
  18. 27 Oct, 2004 1 commit
    • Ben Avison's avatar
      Bugfix and system mode support. · 38e071b3
      Ben Avison authored
      Detail:
        * Fixed signed pointer comparison: most top-bit-set pointers passed to
          _kernel_raise_error() were being translated into "Exit called"
        * Stack extension is now permitted in SYS mode; includes support in longjmp()
      Admin:
        Verified that stack extension works.
      
      Version 5.51. Tagged as 'RISC_OSLib-5_51'
      38e071b3
  19. 02 Dec, 2003 1 commit
    • Ben Avison's avatar
      Changes for Customer W; also suitable for building on an Iyonix. · 20ee3c3f
      Ben Avison authored
      Detail:
        * No longer uses aasm to build h.swis.
        * (Only) compatible with new C compilers: assumes const static data is
          placed in separate read-only areas, and suitable command-line switch
          is used to ensure that library static data is never placed in a zero-
          init area.
        * Stack extension code now thread-safe.
        * Heap thread-safety code (in clib) now uses SWP instruction test results
          from stack extension code (in kernel) - as a side effect, the exported
          symbol _swp_available now exists, if you need to use it elsewhere.
        * Slightly closer to having top-bit-set heap addresses working.
      Admin:
        Tested in a Tungsten build, and with Customer W's test suite.
      
      Version 5.48. Tagged as 'RISC_OSLib-5_48'
      20ee3c3f
  20. 03 Nov, 2003 1 commit
    • Ben Avison's avatar
      Ansilib improvements, and a bugfix to system() · 1c7c8124
      Ben Avison authored
      Detail:
        * _kernel_irqs_disabled() is included in ansilib build, now needed for
          ARM 2 SWP replacement in c.alloc
        * _kernel_entrypoint() for ansilib now initialises relocation offsets in
          root stack chunk, necessary if linking with -zm object code
        * system() implementation now calls DDEUtils_FlushCL if starting a
          short command line - necessary in case previous system() call was a
          long command line directed at a DDE-unaware application
      Admin:
        Ansilib changes tested, DDE change not expected to cause problems.
      
      Version 5.47. Not tagged
      1c7c8124
  21. 09 Oct, 2003 1 commit
    • Ben Avison's avatar
      Changes required for Customer W. · d08d7612
      Ben Avison authored
      Detail:
        * Implemented the thread-safety mutex macros for the user mode heap.
        * Created ansilibm, a version of ansilib suitable for building modules.
        * Fixed an overestimation of the size of the workspace passed to
          SharedCLibrary_LibInitModule[APCS_32] by the stubs.
        * Fixed bug in SharedCLibrary_LibInitModule[APCS_32] regarding handling of
          non-reentrant modules - if module code was at a higher address than the
          module data, then all the intervening data would be pointlessly copied
          back over itself with no allowance for volatility.
        * Removed the bsearch source file, since it was only required for APCS-A
          which the library has not supported since the year 2000, and which the
          compiler is now no longer able to build.
      Admin:
        ansilibm builds working modules, but thread safety has not been
        extensively tested.
      
      Version 5.47. Tagged as 'RISC_OSLib-5_47'
      d08d7612
  22. 15 Apr, 2003 1 commit
    • Kevin Bracey's avatar
      * __assert2() added to support for C99 assert(), which displays function name. · f126a1ab
      Kevin Bracey authored
      * _Exit() added.
      * Lots of new <math.h> functions (acosh, asinh, atanh, exp2, expm1,
        ilogb, log1p, log2, logb, scalbn, scalbln, cbrt, erf, erfc,
        lgamma, tgamma, nexttoward, fmaf). Float and long double forms
        of every function added; long double forms are included as another
        library object in the stubs rather than the shared library, as they
        just branch to the double form.
      * Subnormal/NaN/infinity cases in various <math.h> functions improved.
      * Added <tgmath.h>.
      * Headers brought into line with CC 5.54.
      * RMEnsures added to C library initialisation to try to load minimum
        CallASWI, FPEmulator, CLib. No errors reported if load fails.
      * A few pointless inter-file dependencies removed to reduce minimum
        size of included ANSILib.
      
      Version 5.46. Tagged as 'RISC_OSLib-5_46'
      f126a1ab
  23. 15 Nov, 2002 1 commit
    • Kevin Bracey's avatar
      ROM build fixed for 64-bit stuff. · f207fcb2
      Kevin Bracey authored
      PCI added to swis.h
      alloc.c updated to handle bigger slots (new code merged from ARM libraries)
      Various 32-bit fixes for backtracing, and general trap handling.
      Polite "Application is not 32-bit compatible" message.
      Headers <stdint.h> and <inttypes.h> fixed to work in non-C99 mode.
      txt changed to do new-style Delete behaviour
      
      Version 5.44. Tagged as 'RISC_OSLib-5_44'
      f207fcb2
  24. 22 May, 2002 1 commit
    • Kevin Bracey's avatar
      * Added two new library chunks, 4 and 5, which contain extensions to the... · 89eac61e
      Kevin Bracey authored
      * Added two new library chunks, 4 and 5, which contain extensions to the kernel and C library respectively. These have no static data associated with them, just being extensions of the stub tables. The reason for this is to minimise wasted space in programs that don't use the C99 facilities; o.stubs is now a library split into 3 pieces - basic kernel and CLib, extra kernel and extra
      
        CLib; only the bits a program needs get included.
      
      * Previous extensions to the C library stubs revoked - they now stop at _swix;
        all the new C99 functions now live in chunk 4. Anyone using those new
        functions should relink with new stubs and ensure this C library version.
      
      * printf/scanf now support 64-bit types through "ll" and "j" length modifiers.
      
      * Run-time support for VLAs (__rt_allocauto and __rt_freeauto) added. No
        attempt is currently made to clear up on longjmp or to cope with someone
        changing the kernel allocator while a VLA is active. These would be a
        future enhancement.
      
      * Added complete 64-bit run-time support (48 functions) to kernel library;
        these functions are compatible with the ones used by the ARM ADS. Many of
        the simpler functions will not normally be used by the compiler, as it
        will generate inline code. There is scope for improvement by switching
        in MULL and CLZ-using forms of multiply and divide when possible.
      
      * llabs and lldiv added to C library.
      
      * Header files corrected in a few areas, and changed to match the C compiler.
        <stdint.h> and <stdbool.h> now require the compiler to be in C99 mode
        (as detected using __STDC_VERSION__).
      
      
      Version 5.41. Tagged as 'RISC_OSLib-5_41'
      89eac61e
  25. 29 Jan, 2002 1 commit
    • Kevin Bracey's avatar
      Abort and error handling massively overhauled: · 350370aa
      Kevin Bracey authored
        Aborts now give standard error messages (Abort on Data Transfer at... etc)
        *ShowRegs now filled in after aborts
        assert(), abort(), "free failed" and standard signal handlers now use Wimp
          error boxes if in the desktop
        Postmortem button on error boxes to view the postmortem
      
      Also, x$multiply, x$divide, __rt_sdiv, x$remainder, x$udivide, __rt_udiv and
      x$uremainder optimised.
      
      Version 5.35. Tagged as 'RISC_OSLib-5_35'
      350370aa
  26. 20 Nov, 2000 1 commit
    • Dan Ellis's avatar
      Improved abort handling · c31e0d58
      Dan Ellis authored
      Detail:
        * One check for 26-bit mode wan't being made, leading to the runtime reporting
          'Uncaught trap:' when a trap should have been catching the abort.  This
          prevented signal handlers from trapping some aborts.
        * When an abort was occuring in SVC mode, the stack wasn't being flattened,
          resulting in all sorts of nasty things when you tried to carry on from a
          signal handler (probably the main reason why you ever see 'No stack for trap
          handler'). SVC and undefined stacks are now flattened.  Further work should
          be done to restore the state of the OS after an abort, but this probably
          requires a new OS call to tidy itself up adequately.
      Admin:
        Built 26-bit versions of the library with new 32-bit compatible entry points and checked abort handling with both sharedclibrary and ansilib.
      
      Version 5.22. Tagged as 'RISC_OSLib-5_22'
      c31e0d58
  27. 08 Nov, 2000 1 commit
  28. 16 Oct, 2000 1 commit
    • Stewart Brodie's avatar
      Fixed bug in _swi/_swix code. · e6f4dbc1
      Stewart Brodie authored
      Detail:
        This code would only work in 26-bit modes, since it stored the output
          flags using STR pc, [sp, #4*4]!.  When {CONFIG} is 32, it stores the
          CPSR instead.
      Admin:
        Tested in 32-bit Lazarus build - this fixes the RCMMDriver stiffing
          (because it sits with interrupts off waiting for the C flag to be
          set on exit from an OS_Byte call it calls through _swix)
      
      Version 5.19. Tagged as 'RISC_OSLib-5_19'
      e6f4dbc1
  29. 09 Oct, 2000 1 commit
    • Stewart Brodie's avatar
      Fixed _kernel_setenv. · d1f38470
      Stewart Brodie authored
      Detail:
        _kernel_setenv(varname, NULL) should delete the variables.  It now does.
      Admin:
        Tested in module.
      
      Version 5.18. Tagged as 'RISC_OSLib-5_18'
      d1f38470
  30. 02 Oct, 2000 1 commit
  31. 16 May, 2000 1 commit
  32. 10 May, 2000 1 commit
  33. 09 May, 2000 1 commit
  34. 09 Jul, 1999 1 commit
  35. 01 Oct, 1998 1 commit
    • Kevin Bracey's avatar
      Ursula branch merged. · 9081a0dc
      Kevin Bracey authored
      StrongARMfudge flag removed.
      StrongARM compatibility set according to AMBKernel flag in Hdr:RISCOS
      strftime %U and %W specifiers fixed for week 0.
      
      Version 4.89. Tagged as 'RISC_OSLib-4_89'
      9081a0dc
  36. 27 Aug, 1998 1 commit
  37. 01 May, 1997 2 commits
  38. 21 Jan, 1997 1 commit