Commit 1c87f2f1 authored by John Ballance's avatar John Ballance
Browse files

fixed a memory leak /unstable callback removal in scsifs.

          Added in detect needed for dosfs partitions.. didnt seem to make it
          into cvs in 1.11.
          Added SWI_SCSIFSPartitions and Service_SCSIMounting to permit external
          partition manger to provide partition handling

Detail:

Admin:    tested at castle.. castle added IP


Version 1.12. Tagged as 'SCSIFS-1_12'
parent 15738a33
;
; This file is automatically maintained by srccommit, do not edit manually.
; Last processed by srccommit version: 1.68.
; Last processed by srccommit version: 1.2.
;
GBLS Module_MajorVersion
GBLA Module_Version
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.11"
Module_Version SETA 111
Module_MajorVersion SETS "1.12"
Module_Version SETA 112
Module_MinorVersion SETS ""
Module_Date SETS "23 May 2003"
Module_ApplicationDate SETS "23-May-03"
Module_Date SETS "31 Jan 2005"
Module_ApplicationDate SETS "31-Jan-05"
Module_ComponentName SETS "SCSIFS"
Module_ComponentPath SETS "RiscOS/Sources/FileSys/SCSIFS/SCSIFS"
Module_FullVersion SETS "1.11"
Module_HelpVersion SETS "1.11 (23 May 2003)"
Module_FullVersion SETS "1.12"
Module_HelpVersion SETS "1.12 (31 Jan 2005)"
END
/* (1.11)
/* (1.12)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.68.
* Last processed by srccommit version: 1.2.
*
*/
#define Module_MajorVersion_CMHG 1.11
#define Module_MajorVersion_CMHG 1.12
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 23 May 2003
#define Module_Date_CMHG 31 Jan 2005
#define Module_MajorVersion "1.11"
#define Module_Version 111
#define Module_MajorVersion "1.12"
#define Module_Version 112
#define Module_MinorVersion ""
#define Module_Date "23 May 2003"
#define Module_Date "31 Jan 2005"
#define Module_ApplicationDate "23-May-03"
#define Module_ApplicationDate "31-Jan-05"
#define Module_ComponentName "SCSIFS"
#define Module_ComponentPath "RiscOS/Sources/FileSys/SCSIFS/SCSIFS"
#define Module_FullVersion "1.11"
#define Module_HelpVersion "1.11 (23 May 2003)"
#define Module_LibraryVersionInfo "1:11"
#define Module_FullVersion "1.12"
#define Module_HelpVersion "1.12 (31 Jan 2005)"
#define Module_LibraryVersionInfo "1:12"
......@@ -51,6 +51,7 @@ SWIClass SETS SCSIFSSWI_Name
AddSWI FreeSpace64 ; &40992
AddSWI NOP12 ; &40993
AddSWI DiscOp64 ; &40994
AddSWI Partitions ; &40995
OPT OldOpt
END
......@@ -46,6 +46,9 @@ SeekIsNOP SETL T ;Because Rodime RO3000S objects to seek command
GBLL CheckXferLen
CheckXferLen SETL T
GBLL XferLenMax255
XferLenMax255 SETL F
GBLL RetryIfBusy
RetryIfBusy SETL T
......@@ -58,6 +61,9 @@ AutoDetect SETL T
GBLL HotPlug
HotPlug SETL AutoDetect :LAND: T
GBLL AllowPartitions
AllowPartitions SETL T
GBLL Ejecting
Ejecting SETL F
......@@ -149,8 +155,8 @@ EscapeBit bit 6 ;escape if this bit set in ESC_Status
; Hardware addresses
IoChip * &03200000 ;IO controller
IoControl * 0
;IoChip * &03200000 ;IO controller
;IoControl * 0
;Cpu
......@@ -226,6 +232,9 @@ MapSizeCMOS # 4 ;map sizes of discs in units of 256 bytes
Service_SCSIAttached * &20102
Service_SCSIDetached * &20103
[ AllowPartitions
Service_SCSIMounting * &20104
]
Upcall_DriveAdded * 24
Upcall_DriveRemoved * 25
......@@ -540,7 +549,7 @@ FscReadFileType * 18
;MAIN WORKSPACE ALLOCATION
^ 0, SB
SCSIFSWorkBase # 0
Padding # 4 ;>>>RCM stop 'sbaddr R7, BlockSizes-4' in ScsiFs15 from failing
BlockSizes a4 4 ;log to base two of block size for device or 0 if not
;mounted yet
......@@ -552,14 +561,22 @@ FCFeatures a4 4
FC_Big * bit0
FC_NewErrors * bit1
]
[ AllowPartitions
PartitionBaseAdd a4 4*8
]
[ HotPlug
AttCBCount # 1
DetCBCount # 1
Dieing # 1
myalign # 1
]
;Low level workspace
Winnies # 1
[ FloppySupport:LOR:AutoDetect
Floppies # 1
# 2
DrvRecs a4 SzDrvRec*8
DrvRecs # SzDrvRec*8
]
WorkSize # 0
......
......@@ -639,8 +639,12 @@ AttachedCBDataSz # 0
; In: R0 = device number
; R2 = device number mask
; Note the parameters (in an allocated block) to deal with on a callback
DoAttached
DoAttached ROUT
Push "R0-R2,LR"
LDRB R0, Dieing
TEQ R0, #0
Pull "R0-R2,PC",NE
MOV R0, #ModHandReason_Claim
MOV R3, #AttachedCBDataSz
SWI XOS_Module
......@@ -650,22 +654,35 @@ DoAttached
STR R0, [R2, #ACBD_DevID]
STR LR, [R2, #ACBD_DevIDMask]
STR SB, [R2, #ACBD_SB]
LDRB R0, AttCBCount
ADD R0, R0,#1
CMP R0, #&100
MOVGE R0, #&ff
STRB R0, AttCBCount
ADR R0, DoAttachedCallback
MOV R1, R2
SWI XOS_AddCallBack
Pull "R0-R2,PC"
DoAttachedCallback
DoAttachedCallback ROUT
Push "R0,R2,R3,R4,LR"
Push "R12"
LDR R0,[R12, #ACBD_DevID]
LDR R2,[R12, #ACBD_DevIDMask]
LDR SB,[R12, #ACBD_SB]
LDRB LR, Dieing
TEQ LR, #0
BNE %ft1 ; no point in attaching if dieing
MOV R3,#4
MOV R4,#4
BL ScanDrives2
MOV R0,#ModHandReason_Free
1
Pull "R2"
LDRB R0, AttCBCount
SUBS R0,R0,#1
STRGEB R0, AttCBCount
MOV R0,#ModHandReason_Free
SWI XOS_Module
Pull "R0,R2,R3,R4,PC"
......@@ -674,6 +691,9 @@ DoAttachedCallback
; Note the parameters (in an allocated block) to deal with on a callback
DoDetached
Push "R0-R2,LR"
LDRB R0, Dieing
TEQ R0, #0
Pull "R0-R2,PC",NE
MOV R0, #ModHandReason_Claim
MOV R3, #AttachedCBDataSz
SWI XOS_Module
......@@ -683,6 +703,11 @@ DoDetached
STR R0, [R2, #ACBD_DevID]
STR LR, [R2, #ACBD_DevIDMask]
STR SB, [R2, #ACBD_SB]
LDRB R0, DetCBCount
ADD R0,R0,#1
CMP R0, #&100
MOVGE R0, #&ff
STRB R0, DetCBCount
ADR R0, DoDetachedCallback
MOV R1, R2
SWI XOS_AddCallBack
......@@ -696,6 +721,9 @@ DoDetachedCallback
LDR R0,[R12, #ACBD_DevID]
LDR R2,[R12, #ACBD_DevIDMask]
LDR SB,[R12, #ACBD_SB]
LDRB LR, Dieing
TEQ LR, #0
BNE %ft90 ; no point in attaching if dieing
MOV R1,#&FF ; loop over all device numbers
10 AND LR,R1,R2
TEQ LR,R0 ; if the device number fits the mask
......@@ -729,6 +757,10 @@ DoDetachedCallback
80 SUBS R1,R1,#1
BPL %BT10
90
LDRB R0, DetCBCount
SUBS R0,R0,#1
STRGEB R0, DetCBCount
MOV R0,#ModHandReason_Free
Pull "R2"
SWI XOS_Module
......
......@@ -115,6 +115,17 @@ LowLevelOp ;internal entry point
BNE BadParameters
20
[ AllowPartitions
Push "R0, R1,R2"
MOV R2, R2, LSR #(32-3) ; disc number requested
LDR R1, =Service_SCSIMounting
SWI OS_ServiceCall ; announce our intentions
Pull "R0,R1,R2"
MOV LR, R2, LSR #(32-3) ; disc number
ADD LR, SB, LR, LSL #2 ; to word address
LDR LR, [LR, #:INDEX:PartitionBaseAdd-:INDEX:SCSIFSWorkBase]
ADD R7, R7, LR ; offset by base sector offset
]
ADD PC, PC, R5, LSL #2 ;dispatch on reason
NOP
......@@ -289,10 +300,18 @@ DontNeedScatBlk
; This condition will probably never arise, since it represents 16/32/64 Mbyte
; (for 256/512/1024 byte blocks).
;
; XferLenMax255 switch introduced for test purposes .. some devices found
; that won't do more than 256 blocks at a time safely (JB 20050131)
;
[ XferLenMax255
CMP R5,#&100
MOVHS R5,#&FF
|
CMP R5,#&10000
MOVHS R5,#&FF00
ORRHS R5,R5,#&00FF
]
]
MOV R3,R5,LSR #8
MOV R3,R3,LSL #24 ;MSB in CDB[7] {R3 bits 24..31}
......
......@@ -169,6 +169,20 @@ DoMount ROUT
;read disc structure from defect list
MOV R2, #ScratchSpace
ADD R2, R2, #DefectStruc
LDRB LR, [r2, #3] ; check possible other type of disc image
CMP LR, #8
BHI %ft30
LDRB LR, [r2, #2]
TEQ LR, #0
BEQ %ft30
LDRB LR, [r2, #1]
TEQ LR, #8
BEQ %ft30
LDRB LR, [r2, #0]
TEQ LR, R8
BNE %ft30
LDR R0, [SP] ;recover drive number
LDMIA R2,{R1-R4,LR}
ASSERT RootDir=3*4
......@@ -490,9 +504,16 @@ DoDismount
STMDB SP!,{R2,R3,R4,R5} ;
mapDevToDrvLo R1, R1 ;map device onto drives
ADD R0, R1, #"0"
STRB R0, [SP,#14]
STRB R0, [SP,#14] ; position pf 'x' in dismount string below
MOV R0, SP
SWI XOS_CLI
[ AllowPartitions
MOV R2, #0
ADD LR, SB, R1, LSL #2 ; disc number to word address
STR R2, [LR, #:INDEX:PartitionBaseAdd-:INDEX:SCSIFSWorkBase] ; reset
]
ADD SP, SP, #(Dismount_end - Dismount_start)
sbaddr R2, BlockSizes-4 ;Zero the BlockSize table entry, to force
......
......@@ -49,6 +49,19 @@ InitEntry ROUT ; NO REENTRANCY CHECK NEEDED
sbaddr R0, DrvRecs
MOV R1, #(-1:SHL:8)
MOV R2, #0
STRB R2, AttCBCount
STRB R2, DetCBCount
STRB R2, Dieing
[ AllowPartitions
STR R2, PartitionBaseAdd
STR R2, PartitionBaseAdd+4
STR R2, PartitionBaseAdd+8
STR R2, PartitionBaseAdd+12
STR R2, PartitionBaseAdd+16
STR R2, PartitionBaseAdd+20
STR R2, PartitionBaseAdd+24
STR R2, PartitionBaseAdd+28
]
STMIA R0!, {R1,R2} ;Drive rec for ScsiFs::0
STMIA R0!, {R1,R2} ; 1
STMIA R0!, {R1,R2} ; 2
......@@ -172,13 +185,18 @@ DieEntry
getSB
[ HotPlug
ADRL R0, DoAttachedCallback
MOV R1, SB
SWI XOS_RemoveCallBack
ADRL R0, DoDetachedCallback
SWI XOS_RemoveCallBack
MOV R0, #1
STRB R0, Dieing ; prevent any further callbacks
LDRB R0, AttCBCount
TEQ R0, #0
LDREQB R0, DetCBCount
TEQ R0, #0
BEQ %ft1 ; none awaited
; need to let CBs in **********
1
]
MOV R10,#0 ;Delete "FileCore%SCSI"
MOV R0, #ModHandReason_Delete ; filecore will close down all
baddr R1, DieTitle ; open files before dying
......@@ -393,6 +411,24 @@ DoSwiTestReady
CLRV
Pull "R1,R2,PC"
[ AllowPartitions
; On entry
; R0 = reason code
; 0 = Sector offset for drive 1 in R1 is in R2
; R1 = Drive number (0..7)
; R2 = sector offset to base of image
; This offset is zero by default. It may be changed by this swi
; at any time, but changing this value after mounting the disc
; is usually not wise!
;
DoSWIPartitions ROUT
Push "R1,R2,LR"
CMP R1, #7
Pull "R1,R2,PC", HI
ADD LR, SB, R1, LSL #2 ; word offset
STR R2, [LR, #:INDEX:PartitionBaseAdd-:INDEX:SCSIFSWorkBase] ; remember
Pull "R1,R2,PC"
]
; >>>>>>>>
; SwiEntry
......@@ -433,7 +469,24 @@ SwiEntry ROUT
B UnknownSwi
B DoSwiDiscOp64
|
B UnknownSwi
B UnknownSwi
B UnknownSwi
B UnknownSwi
B UnknownSwi
B UnknownSwi
B UnknownSwi
B UnknownSwi
]
[ AllowPartitions
B DoSWIPartitions
|
B UnknownSwi
]
FirstUnusedSwi * (.-%BT05)/4
......@@ -483,6 +536,7 @@ SwiNames ROUT
= "FreeSpace64",0
= "19",0
= "DiscOp64",0
= "PartitionBase",0
= 0
ALIGN
......
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