Commit 233ebaa7 authored by Malcolm Boura's avatar Malcolm Boura
Browse files

Fix of nasty interrupt hole

Detail:
Fixed by Dan Ellis
Admin:
He tested it, and it worked

Version 0.60. Tagged as 'DeviceFS-0_60'
parent 2e9ed6c0
......@@ -11,14 +11,14 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.59"
Module_Version SETA 59
Module_MajorVersion SETS "0.60"
Module_Version SETA 60
Module_MinorVersion SETS ""
Module_Date SETS "24 Sep 2001"
Module_ApplicationDate2 SETS "24-Sep-01"
Module_ApplicationDate4 SETS "24-Sep-2001"
Module_Date SETS "06 Dec 2001"
Module_ApplicationDate2 SETS "06-Dec-01"
Module_ApplicationDate4 SETS "06-Dec-2001"
Module_ComponentName SETS "DeviceFS"
Module_ComponentPath SETS "RiscOS/Sources/HWSupport/DeviceFS"
Module_FullVersion SETS "0.59"
Module_HelpVersion SETS "0.59 (24 Sep 2001)"
Module_FullVersion SETS "0.60"
Module_HelpVersion SETS "0.60 (06 Dec 2001)"
END
/* (0.59)
/* (0.60)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.61.
*
*/
#define Module_MajorVersion_CMHG 0.59
#define Module_MajorVersion_CMHG 0.60
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 24 Sep 2001
#define Module_Date_CMHG 06 Dec 2001
#define Module_MajorVersion "0.59"
#define Module_Version 59
#define Module_MajorVersion "0.60"
#define Module_Version 60
#define Module_MinorVersion ""
#define Module_Date "24 Sep 2001"
#define Module_Date "06 Dec 2001"
#define Module_ApplicationDate2 "24-Sep-01"
#define Module_ApplicationDate4 "24-Sep-2001"
#define Module_ApplicationDate2 "06-Dec-01"
#define Module_ApplicationDate4 "06-Dec-2001"
#define Module_ComponentName "DeviceFS"
#define Module_ComponentPath "RiscOS/Sources/HWSupport/DeviceFS"
#define Module_FullVersion "0.59"
#define Module_HelpVersion "0.59 (24 Sep 2001)"
#define Module_LibraryVersionInfo "0:59"
#define Module_FullVersion "0.60"
#define Module_HelpVersion "0.60 (06 Dec 2001)"
#define Module_LibraryVersionInfo "0:60"
......@@ -266,6 +266,7 @@ file_BufferPrivId # 4 ; = Buffer Managers private buffer id (
file_PollWord # 4 ; pollword for taskwindow: 1 => don't call UpCall6, -1 => wakeup
file_Timeout # 4 ; timeout for sleeping
]
file_Error # 256 ; copy of error block
file_SIZE * :INDEX: @
^ 0 ; define format of parent device record (on entry to Register)
......@@ -325,34 +326,19 @@ ff_Sleeping * 0:SHL:0 ; significance of pollword
ff_WakeUp * 1:SHL:0 ; bit 0 set => normal wakeup
ff_DontSleep * 1:SHL:1 ; bit 1 set => don't go to sleep
ff_TimedOut * 1:SHL:2 ; bit 2 set => transaction timed out
ff_Error * 1:SHL:3 ; bit 3 set => error has occured
object_subdevice * -1 ; object type returned by findobject if the path is
; an object inside a device eg "$.Parallel.Fred"
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
debug SETL false
hostvdu SETL false
debug_file SETS "<DevFSDebug>"
GBLL debugfs
GBLL debugtransmitchar
GBLL debuggbpb
GBLL debugregisterdev
GBLL debugspecial
debug_module SETL false
debugfs SETL false :LAND: debug
debuggbpb SETL false :LAND: debug
debugtransmitchar SETL true :LAND: debug
debugregisterdev SETL false :LAND: debug
debugenumdir SETL true :LAND: debug
debugspecial SETL true :LAND: debug
SVC_Mode * 3
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; Now define module header.
;
AREA |DeviceFS$$Code|, CODE, READONLY, PIC
ENTRY
module_start & 0
& init -module_start ; initialisation code
......@@ -764,7 +750,7 @@ Register Entry "r0-pr"
Debug register, "parent block allocated at", r2
ADR r0, Register
ADRL r0, Register
STR r0, [pr, #parent_ValidationWord] ; validate block as owned by DeviceFS
Debug register, "validation word", r0
......@@ -1316,8 +1302,8 @@ deregisterdev Entry "r0, r2-r5, pr"
10
LDRB r3, [r2], #1
LDRB r4, [r0], #1
UpperCase r3, lr
UpperCase r4, lr ; ensure characters of same case
ASCII_UpperCase r3, lr
ASCII_UpperCase r4, lr ; ensure characters of same case
TEQ r3, r4
LDRNE dr, [dr, #device_Next]
......@@ -1477,8 +1463,8 @@ CallDevice ROUT
35
LDRB r10, [r9], #1
LDRB r11, [r12], #1 ; get two characters
UpperCase r10, lr
UpperCase r11, lr ; ensure they are a valid case
ASCII_UpperCase r10, lr
ASCII_UpperCase r11, lr ; ensure they are a valid case
TEQ r10, r11 ; are they the same character?
LDRNE r8, [r8, #device_Next] ; no, so reset the device pointer
......@@ -1929,8 +1915,8 @@ CompareStrings Entry "r0-r3"
EXIT EQ ; then say they're equal
LDRB r0, [r1], #1
LDRB r3, [r2], #1
UpperCase r0, lr
UpperCase r3, lr
ASCII_UpperCase r0, lr
ASCII_UpperCase r3, lr
CMP r0, r3
EXIT NE ; if strings differ then Z=0, N,C from CMP, V=0 (from CMP)
TEQ r0, #0 ; have both strings terminated?
......
......@@ -27,7 +27,7 @@
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
flush SETD false ;debug for file flushing
close SETD false ;sets the close debug flag, somehow not visable from version
close SETD true ;sets the close debug flag, somehow not visable from version
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
......@@ -78,11 +78,20 @@ timeout
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; sleep until pollword non-zero
; sleep receiving until pollword non-zero or error
;
sleep_on_tx Entry "r0-r2"
ADR r1, checkfileTX_sleep
B %f5
sleep
Entry "r0-r2"
sleep_on_rx ALTENTRY
ADR r1, checkfileRX_sleep
5
Push "r1" ; save r1 for later
MOV r0, #9
MOV r2, fr
SWI XOS_CallEvery
LDR r0, [fr, #file_Timeout]
TEQ r0, #0
......@@ -91,32 +100,78 @@ sleep
ADR r1, timeout
MOV r2, fr
SWI XOS_CallAfter
10
ADD r1, fr, #file_PollWord
MOV r0, #UpCall_Sleep
Debug fs, "Pollword", r1
SWI XOS_UpCall
LDR r0, [fr, #file_PollWord]
TEQ r0, #ff_TimedOut
BEQ %f90
ADR r0, timeout
MOV r1, fr
SWI XOS_RemoveTickerEvent
EXIT
10
ADD r1, fr, #file_PollWord
MOV r0, #UpCall_Sleep
Debug fs, "Pollword", r1
SWI XOS_UpCall
CLRV
EXIT
90
Pull "r0" ; restore old r1 into r0
SWI XOS_RemoveTickerEvent
PHPSEI r1 ; disable interrupts so that there is no IRQ hole
LDR r0, [fr, #file_PollWord]
Debug fs, "Pollword contents now: ", r0
TEQ r0, #0
TEQNE r0, #ff_WakeUp
MOVEQ r0, #ff_Sleeping ; we must mark as sleeping as soon as possible,
STREQ r0, [fr, #file_PollWord] ; so that we get woken up correctly
PLP r1
EXIT EQ
PullEnv
TST r0, #ff_TimedOut
BEQ %f20
ADR r0, ErrorBlock_DeviceFS_Timeout ; so set r0 -> error block
DoError ; translate error and return V set
20
TST r0, #ff_Error
MOVEQ pc, lr
ADD r0, fr, #file_Error
[ debug
ADD r0, r0, #4
DebugS fs, "waking up with error: ", r0
SUB r0, r0, #4
]
SETV
MOV pc, lr
checkfileTX_sleep Entry "fr"
MOV fr, r12
BL checkfileTXOK
EXIT VC
B %f10
checkfileRX_sleep ALTENTRY
MOV fr, r12
BL checkfileRXOK
EXIT VC
10
Push "r0-r3"
ADD r2, fr, #file_Error
MOV r1, #252
20
LDR r3, [r0, r1]
STR r3, [r2, r1]
SUBS r1, r1, #4
BGE %b20
LDR r2, [fr, #file_PollWord]
ORR r2, r2, #ff_Error
STR r2, [fr, #file_PollWord]
Pull "r0-r3"
CLRV
EXIT
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......@@ -580,7 +635,7 @@ make_buffer ROUT
ANDS r1, r1, #ff_FileForTX ; if an output device (r1<>0)
ADRNE r1, wakeup ; then use real wake up code else use none
]
ADR r2, detach ; try to close stream if someone tries to detach
ADRL r2, detach ; try to close stream if someone tries to detach
MOV r3, fr
MOV r4, wp ; workspace + private word
......@@ -633,7 +688,7 @@ wakeup_rx Entry "r0-r9" ; Stack everything, in case CallAVector corrupts it
SavePSR r2
ORR r0, r2, #SVC_mode
RestPSR r0,,c ; set SVC mode
RestPSR r0,,cf ; set SVC mode
NOP
Push "r2,lr" ; Preserve r2 and lr across CallAVector
......@@ -652,6 +707,7 @@ wakeup_rx Entry "r0-r9" ; Stack everything, in case CallAVector corrupts it
TEQ r0, #ff_DontSleep
MOVNE r0, #ff_WakeUp
STRNE r0, [r8, #file_PollWord]
Debug fs, "Waking up pollword"
]
EXIT
]
......@@ -807,9 +863,9 @@ fs_get Entry "r0-r2, fr,pr"
ASSERT (BufferReason_RemoveByte <> -1)
CMP r0, #-1 ; if we're not buffered, r0 = -1 here.
MOVNE r1, #ff_Sleeping ; reset pollword if we're buffered, if not then
STRNE r1, [fr, #file_PollWord] ; we can't set a pollword to wake us up
BL sleep
MOVEQ r1, #ff_WakeUp ; reset pollword if we're buffered, if not then
STREQ r1, [fr, #file_PollWord] ; we can't set a pollword to wake us up
BL sleep_on_rx
BVS %FT30
B %BT00 ; loop again to make sure actually received data
......@@ -854,7 +910,7 @@ fs_get Entry "r0-r2, fr,pr"
; fr
; Out
; V and r0=error possible
checkfileRXOK Entry "r0-r2"
checkfileRXOK Entry "r0-r2"
MOV r0, #DeviceCall_MonitorRX
B %FT10
......@@ -945,7 +1001,7 @@ fs_put Entry "r0-r2, fr, r9"
TEQ r1, #ff_DontSleep
BEQ %00 ; we don't want to sleep
BL sleep
BL sleep_on_tx
BVS %FT99
B %00 ; loop again
......@@ -984,10 +1040,10 @@ fs_put Entry "r0-r2, fr, r9"
TEQ r1, #ff_DontSleep
BEQ %10 ; we don't want to sleep
MOV r1, #ff_Sleeping ; reset pollword
STR r1, [fr, #file_PollWord]
; MOV r1, #ff_Sleeping ; reset pollword
; STR r1, [fr, #file_PollWord]
BL sleep
BL sleep_on_tx
BVS %FT99
B %10 ; keep looping
......@@ -1332,10 +1388,10 @@ args_flush Entry "r1-r3,fr"
LDR r1, [fr, #file_BufferHandle]
CMP r1, #-1 ; is the device buffered?
MOVNE r1, #ff_Sleeping ; reset pollword if we're buffered, if not then
STRNE r1, [fr, #file_PollWord] ; we can't set a pollword to wake us up
MOVEQ r1, #ff_WakeUp ; reset pollword if we're buffered, if not then
STREQ r1, [fr, #file_PollWord] ; we can't set a pollword to wake us up
BL sleep
BL sleep_on_tx
MOV r1, fr
]
......@@ -1378,6 +1434,9 @@ fs_close Entry "r0, dr, pr"
removefileblock Entry "r0-r5, dr, pr" ; attempt to zap record at 'FR'
Debug close,"removing file block"
LDR r5, [fr, #file_Flags] ; get global flags word
Debug close,"file flags ", r5
Debug close,"file record is", fr
[ TWSleep
MOV r0, #UpCall_SleepNoMore
......@@ -1448,6 +1507,7 @@ removefileblock Entry "r0-r5, dr, pr" ; attempt to zap
STR r0, [fr, #file_SpecialField] ; mark as now released incase called again
30
LDR r5, [fr, #file_Flags] ; get global flags word
Debug close,"file flags ", r5
TST r5, #ff_FileForTX ; is it for RX or TX?
MOVEQ r2, #0
MOVNE r2, #-1
......@@ -1471,6 +1531,12 @@ removefileblock Entry "r0-r5, dr, pr" ; attempt to zap
SUBNE r1, r1, #1
STRNE r1, [r0] ; update the used inputs/outputs counters
[ debug
BEQ %f40
Debug close,"number of used streams now ",r1
40
]
LDR fr, =&DEADDEAD ; invalidate the file record pointer
CLRV
......@@ -1652,8 +1718,8 @@ file_enumdir Entry "r0-r2, r5-r7, dr, pr"
05
LDRB r6, [r0], #1
LDRB r7, [r1], #1 ; get two characters?
UpperCase r6, lr
UpperCase r7, lr ; ensure they are the same case
ASCII_UpperCase r6, lr
ASCII_UpperCase r7, lr ; ensure they are the same case
TEQ r6, r7 ; are they the same character?
BNE %FT10 ; no, so skip
......@@ -1899,10 +1965,10 @@ gbpb_get Entry "r0-r3, fr, r9, pr"
TEQ r1, #ff_DontSleep
BEQ %BT10
MOV r1, #ff_Sleeping ; reset pollword
STR r1, [fr, #file_PollWord]
; MOV r1, #ff_Sleeping ; reset pollword
; STR r1, [fr, #file_PollWord]
BL sleep
BL sleep_on_rx
B %BT10
|
......@@ -2018,10 +2084,10 @@ gbpb_put Entry "r0-r3, fr, r9"
TEQ r1, #ff_DontSleep
BEQ %00
MOV r1, #ff_Sleeping ; reset pollword
STR r1, [fr, #file_PollWord]
; MOV r1, #ff_Sleeping ; reset pollword
; STR r1, [fr, #file_PollWord]
BL sleep
BL sleep_on_tx
[ FastBufferMan
LDR r1, [fr, #file_BufferPrivId] ; get buffer managers private buffer id
......@@ -2151,8 +2217,8 @@ findobject Entry "r1,r6,r7"
10
LDRB r3, [r0, r2]
LDRB r4, [r1, r2] ; get two characters
UpperCase r3, lr
UpperCase r4, lr
ASCII_UpperCase r3, lr
ASCII_UpperCase r4, lr
TEQ r3, r4 ; are they the same?
BEQ %15 ; yes.
......
......@@ -263,7 +263,7 @@ ScanSpecial ROUT
BNE %20 ; no, so loop again
LDRB r6, [r4], #1
UpperCase r6, lr ; ensure that it is upper case
ASCII_UpperCase r6, lr ; ensure that it is upper case
TEQ r6, #"S" ; switch or number
TEQNE r6, #"N"
......@@ -287,8 +287,8 @@ ScanSpecial ROUT
LDRB r6, [r0]
LDRB r7, [r5] ; get characters
UpperCase r6, lr ; ensure the same case
UpperCase r7, lr
ASCII_UpperCase r6, lr ; ensure the same case
ASCII_UpperCase r7, lr
SUBS lr, r6, #"A" ; check for alphabetic character
CMP lr, #"Z"+1-"A" ; *** fixed TMD 21-Jan-92 (was #"A"-"Z")
......@@ -387,7 +387,7 @@ handle_escape ROUT
BNE %00 ; loop until start of escapes found
LDRB r7, [r5], #1
UpperCase r7, lr ; get escape sequence identifier
ASCII_UpperCase r7, lr ; get escape sequence identifier
Debug special, "escape character", r7
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment