Commit 101d144f authored by Jeffrey Lee's avatar Jeffrey Lee

Fix 2x output stream redirection bugs

  - Reorder RemoveOscliCharJobs to avoid WrchV being left claimed while the output stream is being closed, to resolve ticket #420.
  - Register usage also tweaked a bit to make the code a bit shorter & easier to read
  - Fix RedirectWrch to deal with errors correctly. PSR save/restore macros were added to the routine during the 32bit conversion process, but (a) they were inadvertantly causing all errors to be ignored, and (b) they were redundant since WrchV has no special in/out requirements for the PSR flags
  Tested on Pandaboard
  Ticket #420 fix based around Colin's fix from

Version 5.92. Tagged as 'Kernel-5_92'
parent a5c907f8
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.91"
Module_Version SETA 591
Module_MajorVersion SETS "5.92"
Module_Version SETA 592
Module_MinorVersion SETS ""
Module_Date SETS "12 Nov 2017"
Module_ApplicationDate SETS "12-Nov-17"
Module_Date SETS "02 Dec 2017"
Module_ApplicationDate SETS "02-Dec-17"
Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.91"
Module_HelpVersion SETS "5.91 (12 Nov 2017)"
Module_FullVersion SETS "5.92"
Module_HelpVersion SETS "5.92 (02 Dec 2017)"
/* (5.91)
/* (5.92)
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
#define Module_MajorVersion_CMHG 5.91
#define Module_MajorVersion_CMHG 5.92
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 12 Nov 2017
#define Module_Date_CMHG 02 Dec 2017
#define Module_MajorVersion "5.91"
#define Module_Version 591
#define Module_MajorVersion "5.92"
#define Module_Version 592
#define Module_MinorVersion ""
#define Module_Date "12 Nov 2017"
#define Module_Date "02 Dec 2017"
#define Module_ApplicationDate "12-Nov-17"
#define Module_ApplicationDate "02-Dec-17"
#define Module_ComponentName "Kernel"
#define Module_ComponentPath "castle/RiscOS/Sources/Kernel"
#define Module_FullVersion "5.91"
#define Module_HelpVersion "5.91 (12 Nov 2017)"
#define Module_LibraryVersionInfo "5:91"
#define Module_FullVersion "5.92"
#define Module_HelpVersion "5.92 (02 Dec 2017)"
#define Module_LibraryVersionInfo "5:92"
......@@ -1326,45 +1326,40 @@ OscliTidy ROUT ; shut down redirection, restore permanent FS
RemoveOscliCharJobs ROUT
Push "R0-R2, lr"
LDR R0, =ZeroPage
LDRB R1, [R0, #RedirectInHandle]
CMP R1, #0
ASSERT (ZeroPage :AND: 255) = 0
STRNEB R0, [R0, #RedirectInHandle]
; Release WrchV before attempting to close the file handles. This protects
; against output going missing if it happens during the close operation(s)
; E.g. if we're running in a task window and the output device uses
; OS_UpCall 6, our WrchV hook may be left installed when control is
; returned to the Wimp:
MOV R2, #0
MOV R0, #WrchV
ADR R1, RedirectWrch
SWI XOS_Release
[ ZeroPage <> 0
MOV R0, #0
LDR R2, =ZeroPage
LDRB R1, [R2, #RedirectInHandle]
CMP R1, #0
MOVNE R0, #0
STRNEB R0, [R2, #RedirectInHandle]
LDR R0, =ZeroPage ; May have got error (discarded)
LDRB R1, [R0, #RedirectOutHandle]
LDRB R1, [R2, #RedirectOutHandle]
CMP R1, #0
ASSERT (ZeroPage :AND: 255) = 0
STRNEB R0, [R0, #RedirectOutHandle]
[ ZeroPage <> 0
MOV R0, #0 ; May have got error (discarded)
MOVNE R0, #0 ; May have got error (discarded)
STRNEB R0, [R2, #RedirectOutHandle]
MOV R2, #0
MOV R0, #WrchV
ADR R1, RedirectWrch
SWI XOS_Release
Pull "R0-R2, PC"
RedirectWrch ROUT
Push "R1, R2"
SavePSR R2
Push "R1"
LDR R1, =ZeroPage
LDRB R1, [R1, #RedirectOutHandle]
RestPSR R2 ; VClear in entry psr
Pull "R1, R2, pc", VC
Pull "R1, pc", VC
BL RemoveOscliCharJobs
ORR R2, R2, #V_bit
RestPSR R2
Pull "R1, R2, pc"
Pull "R1, pc"
; **************************************************************************
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment