Ticket #491 (Fixed)Thu Jun 18 18:30:36 UTC 2020
SWI CD_SCSIUserOp not working
Reported by: | André Timmermans (100) | Severity: | Normal |
Part: | RISC OS: Module | Release: | |
Milestone: | Status | Fixed |
Details by André Timmermans (100):
CD_SCSIUserOp is not working because of a bug in the SWI dispatch code.
In this code R11 is converted from a SWI offset nr into a softloadable driver opcode but when later the code checks if the driver implements the opcode or if it must call a local default implementation it compares R11 against SWI offset numbers (minus 1) instead of the driver opcodes. Per chance the number matches for the other opcodes but not for SCSIUserOp and so the softloadable driver is always called in this case even when there is not implementation for the opcode (like in CDFSSoftSCSI). Here is a patch to fix this:
diff Naur Fat32fs::Fatty.$.Files.RISCOS5.src-bcm2835-dev/5/27/tar.BCM2835.RiscOS.Sources.HWSupport.CD.CDFSDriver.hdr.hashes Fat32fs::Fatty.$.Files.RISCOS5.Sources_20200513.BCM2835.RiscOS.Sources.HWSupport.CD.CDFSDriver.hdr.hashes -- Fat32fs::Fatty.$.Files.RISCOS5.src-bcm2835-dev/5/27/tar.BCM2835.RiscOS.Sources.HWSupport.CD.CDFSDriver.hdr.hashes 2012-05-24 23:35:28.0 0100 ++ Fat32fs::Fatty.$.Files.RISCOS5.Sources_20200513.BCM2835.RiscOS.Sources.HWSupport.CD.CDFSDriver.hdr.hashes 2020-05-21 12:00:30.0 +0100 @ -58,6 +58,7 @
DRIVER__SeekUserData # 1 ; 33 DRIVER__GetAudioParms # 1 ; 34 DRIVER__SetAudioParms # 1 ; 35 +DRIVER__SCSIUserOp # 1 ; 36
;***************************************************************************
diff Naur Fat32fs::Fatty.$.Files.RISCOS5.src-bcm2835-dev/5/27/tar.BCM2835.RiscOS.Sources.HWSupport.CD.CDFSDriver.s.Main Fat32fs::Fatty.$.Files.RISCOS5.Sources_20200513.BCM2835.RiscOS.Sources.HWSupport.CD.CDFSDriver.s.Main
— Fat32fs::Fatty.$.Files.RISCOS5.src-bcm2835-dev/5/27/tar.BCM2835.RiscOS.Sources.HWSupport.CD.CDFSDriver.s.Main 2012-05-24 23:35:28.0 0100
++ Fat32fs::Fatty.$.Files.RISCOS5.Sources_20200513.BCM2835.RiscOS.Sources.HWSupport.CD.CDFSDriver.s.Main 2020-06-02 20:26:22.0 +0100
@ -127,8 +127,6 @
Push “r0-r11, r14”
- BIC r11, r11, #3:SHL:30
-
;—————————————-
; Turn irqs on
;—————————————-
@ -162,7 +160,8 @
BMI cd_version
;—————————————————————————————
; CD_Register, CD_Unregister, CD_LastError or CD_ByteCopy ?
+; Handle SWIs not covered by soft loadable drivers directly
+; or convert r11 from SWI nr to soft loadable driver opcode
;————————————————————————————-
TEQ r11, #(XCD_Register – XCD_BaseNumber) – 1
BEQ cd_register
@ -190,7 +189,6 @
BEQ cd_lasterror
-
;—————————————————
; Which driver should handle this ?
;—————————————————
@ -255,55 +253,55 @
EOR r8, r8, #USE_SCSI_READ + USE_SCSI_SEEK + USE_SCSI_INQUIRY + USE_SCSI_CAPACITY + USE_SCSI_READY + USE_SCSI_STOPOPEN + USE_SCSI_CHECK + USE_SCSI_STATUS
EOR r8, r8, #USE_SCSI_CONTROL + USE_SCSI_PREFETCH + USE_SCSI_RESET + USE_PROPRIETARY_RUD + USE_PROPRIETARY_SUD + USE_SCSI_OP
- TEQ r11, #(XCD_ReadData – XCD_BaseNumber) – 1
+ TEQ r11, #DRIVER__ReadData
TSTEQ r8, #USE_SCSI_READ
BEQ cd_readdata
- TEQ r11, #(XCD_SeekTo – XCD_BaseNumber) – 1
+ TEQ r11, #DRIVER__SeekTo
TSTEQ r8, #USE_SCSI_SEEK
BEQ cd_seekto
- TEQ r11, #(XCD_Inquiry – XCD_BaseNumber) – 1
+ TEQ r11, #DRIVER__Inquiry
TSTEQ r8, #USE_SCSI_INQUIRY
BEQ cd_inquiry
- TEQ r11, #(XCD_DiscUsed – XCD_BaseNumber) – 1
+ TEQ r11, #DRIVER__DiscUsed
TSTEQ r8, #USE_SCSI_CAPACITY
BEQ cd_discused
- TEQ r11, #(XCD_DriveReady – XCD_BaseNumber) – 1
+ TEQ r11, #DRIVER__DriveReady
TSTEQ r8, #USE_SCSI_READY
BEQ cd_driveready
- TEQ r11, #(XCD_StopDisc – XCD_BaseNumber) – 1
+ TEQ r11, #DRIVER__StopDisc
TSTEQ r8, #USE_SCSI_STOPOPEN
BEQ cd_stopdisc
- TEQ r11, #(XCD_OpenDrawer – XCD_BaseNumber) – 1
+ TEQ r11, #DRIVER__OpenDrawer
TSTEQ r8, #USE_SCSI_STOPOPEN
BEQ cd_opendrawer
- TEQ r11, #(XCD_DriveStatus – XCD_BaseNumber) – 1
+ TEQ r11, #DRIVER__DriveStatus
TSTEQ r8, #USE_SCSI_STATUS
BEQ cd_drivestatus
- TEQ r11, #(XCD_Control – XCD_BaseNumber) – 1
+ TEQ r11, #DRIVER__Control
TSTEQ r8, #USE_SCSI_CONTROL
BEQ cd_control
- TEQ r11, #(XCD_Prefetch – XCD_BaseNumber) – 1
+ TEQ r11, #DRIVER__Prefetch
TSTEQ r8, #USE_SCSI_PREFETCH
BEQ cd_prefetch
- TEQ r11, #(XCD_Reset – XCD_BaseNumber) – 1
+ TEQ r11, #DRIVER__Reset
TSTEQ r8, #USE_SCSI_RESET
BEQ cd_reset
- TEQ r11, #(XCD_CheckDrive – XCD_BaseNumber) – 1
+ TEQ r11, #DRIVER__CheckDrive
TSTEQ r8, #USE_SCSI_CHECK
BEQ cd_checkdrive
- TEQ r11, #(XCD_SCSIUserOp – XCD_BaseNumber) – 1
+ TEQ r11, #DRIVER__SCSIUserOp
TSTEQ r8, #USE_SCSI_OP
BEQ cd_scsiuserop
Changelog:
Modified by Jeffrey Lee (213) Sat, June 20 2020 - 15:26:37 GMT
Thanks, I’ve submitted a merge request for this (minus the initial BIC of r11 – I think that’s still required, judging by the code in OnError that calls SWIentry_after_wp)
Modified by Jeffrey Lee (213) Mon, June 22 2020 - 23:23:33 GMT
- Status changed from Open to Fixed
Fixed with CDFSDriver 2.42