Commit f34ff997 authored by Kevin Bracey's avatar Kevin Bracey
Browse files

ARTtmp branch folded

parent 00d0c4c3
......@@ -9,3 +9,5 @@ E08:Reserved fields non-zero
E09:Block devices are not supported
E0B:Must be a buffered stream to set threshold
E0C:Unable to detach current owner of this buffer
E0D:Unknown ioctl reason code
E0E:Bad ioctl parameter
......@@ -4,9 +4,9 @@
GBLS VString
GBLS Date
Version SETA 034
VString SETS "0.34"
Date SETS "14 Jun 1996"
Version SETA 035
VString SETS "0.35"
Date SETS "13 Apr 1997"
; controlling how and if debugging is allowed.
......@@ -18,7 +18,7 @@ Date SETS "14 Jun 1996"
GBLL hostvdu
debug SETL false
hostvdu SETL true
hostvdu SETL false
register SETD false ; register a parent
registerdev SETD false ; register a device
......@@ -36,7 +36,6 @@ file SETD false ; fs_file ops
func SETD false ; fs_func ops
gbpb SETD false ; fs_gbpb ops
; Now some assembly constants about DeviceFS, ie. should it be the internation
; version or not.
......
......@@ -137,7 +137,9 @@
; Issue upcalls with stream handle when thresholds are passed
; 14-Jun-96 0.34 RWB Pass file switch handle through to device driver during
; device initialisation.
; 16-Apr-97 0.35 BAL Added support for non-blocking block reads/writes. Fixed bug
; in UpCall handler: send DeviceThreshold upcalls using OS_CallAVector
; instead of OS_UpCall so that interrupts aren't enabled.
GET hdr:ListOpts
GET hdr:Macros
GET hdr:System
......@@ -299,6 +301,7 @@ pf_AllowedBits * pf_BlockDevice+ pf_FullDuplex+ pf_MonitorTransfers+ pf
ff_FileInputOutput * 1:SHL:0
ff_FileForTX * 1:SHL:0 ; bit 0 set => TX
ff_FileForRX * 0:SHL:0 ; bit 0 clear => RX
ff_NonBlocking * 1:SHL:29 ; bit 29 set => use non-blocking I/O for stream
ff_DeviceLinked * 1:SHL:30 ; bit 30 set => buffer is linked to device
ff_ModifiedCounters * 1:SHL:31 ; bit 31 set => modified usage counts
......@@ -1569,11 +1572,18 @@ UpCall ROUT
TST r1, #pf_DeviceUpcalls
BEQ %10
; now issue upcalls based on stream handle
; must use OS_CallAVector here _NOT_ OS_UpCall: OS_UpCall enables interrupts (contrary to
; documentation in RISC OS 3 PRMs) - if the UpCall has come as a result of Dual Serial
; removing a byte from the buffer then this will cause reentrancy problems in Dual Serial
; resulting in out-of-order bytes.
Push "r9"
TEQ r0, #DeviceCall_Halt
MOVEQ r0, #UpCall_DeviceThresAbove
MOVNE r0, #UpCall_DeviceThresBelow
LDR r1, [r3, #file_FSwitchHandle]
SWI XOS_UpCall
MOV r9, #UpCallV
SWI XOS_CallAVector
Pull "r9"
STRVS r0, [sp]
10
]
......
......@@ -46,6 +46,8 @@ $label ORR$cc.S pc, lr, #VFlag
AddError DeviceFS_Escape, "Escape",17 ; Return error number 17.
AddError DeviceFS_MustBeBuffered, "E0B"
AddError DeviceFS_CannotDetach, "E0C"
AddError DeviceFS_BadIOCtlReasonCode, "E0D"
AddError DeviceFS_BadIOCtlParameter, "E0E"
|
^ ErrorBase_DeviceFS
......@@ -62,6 +64,8 @@ $label ORR$cc.S pc, lr, #VFlag
AddError DeviceFS_Escape, "Escape",17
AddError DeviceFS_MustBeBuffered, "Must be a buffered stream to set threshold"
AddError DeviceFS_CannotDetach, "Unable to detach current owner of this buffer"
AddError DeviceFS_BadIOCtlReasonCode, "Unknown ioctl reason code"
AddError DeviceFS_BadIOCtlParameter, "Bad ioctl parameter"
]
END
......@@ -21,6 +21,7 @@
MakeErrorBlock DeviceFS_BadOp
MakeErrorBlock DeviceFS_Escape
MakeErrorBlock DeviceFS_CannotDetach
MakeErrorBlock DeviceFS_BadIOCtlReasonCode
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......@@ -878,7 +879,16 @@ fs_args ROUT
; handle ioctl's
args_ioctl ENTRY "r0-r3, fr,pr"
args_ioctl ROUT
ENTRY "r0-r3, fr,pr"
LDR r0, [r2, #0] ; load ioctl reason codes and flags
BIC r0, r0, #&ff00ffff
TEQ r0, #&00ff0000
BLEQ ioctl_miscop
BLEQ %10 ; only V flag corrupted so OK
; catch remaining cases and pass into device driver
MOV fr, r1 ; -> file record
LDR pr, [fr, #file_Parent]
......@@ -889,12 +899,65 @@ args_ioctl ENTRY "r0-r3, fr,pr"
MOV r2, fr
BL CallDevice
10
STRVS r0, [sp]
PullEnv VS
ORRVSS pc, lr, #V_bit
EXIT
; deal with non-device specific ioctls
ioctl_miscop ROUT
LDR r0, [r2, #0] ; load ioctl reason codes and flags
; mask off top 16 bits of r0 to obtain reason code
MOV r0, r0, LSL #16
MOV r0, r0, LSR #16
CMP r0, #(%20-%10)/4 ; validate reason code
ADDCC pc, pc, r0, LSL #2 ; despatch
B %20
10
MOVS pc, lr ; 0 nothing
B ioctl_miscop_nonblock ; 1 set non-blocking I/O
20
PullEnv
BICEQS pc, lr, #V_bit ; then exit VC
ADRL r0, ErrorBlock_DeviceFS_BadIOCtlReasonCode
DoError
ioctl_miscop_nonblock
ROUT
LDR r0, [r2, #0] ; load ioctl reason codes and flags
MOV fr, r1 ; -> file record
LDR r1, [fr, #file_Flags]
TST r0, #&80000000 ; test write flag
BEQ %10
LDR r3, [r2, #4] ; load ioctl data word
CMP r3, #0
BICEQ r1, r1, #ff_NonBlocking ; clear non-blocking I/O enabled flag
CMP r3, #1
ORREQ r1, r1, #ff_NonBlocking ; set non-blocking I/O enabled flag
STR r1, [fr, #file_Flags] ; write back flags
10
TST r0, #&40000000 ; test read flag
BEQ %20
TST r1, #ff_NonBlocking ; test non-blocking I/O enabled flag
MOVNE r0, #1 ; non-blocking I/O enabled
MOVEQ r0, #0 ; non-blocking I/O disabled
STR r0, [r2, #4] ; store result in ioctl block
20
MOVS pc, lr
; handle checking of the file extent
args_ext ENTRY "r0-r1,r3-r6, fr"
......@@ -1537,7 +1600,8 @@ gbpb_get ENTRY "r0-r3, fr, r9, pr"
ADD r1, sp, #CallerR2
LDMIA r1, {r2-r3} ; get entry registers
B %FT11
LDR r4, [fr, #file_Flags]
B %FT12
10
BL checkfileRXOK
......@@ -1552,6 +1616,10 @@ gbpb_get ENTRY "r0-r3, fr, r9, pr"
BCS %FT20
11
TST r4, #ff_NonBlocking ; is this stream non-blocking?
BNE %FT20 ; if so, finish now
12
BL checkescape ; if escape not pressed
[ FastBufferMan
MOVVC r0, #BufferReason_RemoveBlock
......@@ -1606,6 +1674,8 @@ gbpb_put ENTRY "r0-r3, fr, r9"
MOV fr, r1
LDR r4, [fr, #file_Flags]
[ FastBufferMan
LDR r1, [fr, #file_BufferPrivId] ; get buffer managers private buffer id
|
......@@ -1627,10 +1697,15 @@ gbpb_put ENTRY "r0-r3, fr, r9"
]
BVS %90
TST r4, #ff_NonBlocking ; is this stream non-blocking?
BNE %FT02 ; if so, finish now
TEQ r3, #0 ; all written yet?
BNE %00
LDR r4, [sp, #CallerR3] ; How many did we ask for? That's how many we got!
02
LDR r4, [sp, #CallerR3] ; How many did we ask for?
SUB r4, r4, r3 ; how many we transferred
ADD r0, sp, #CallerR2
STMIA r0, {r2-r3} ; write the data to the return frame
EXITS ; and then restore stack pointer
......
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