Commit 07fa7e20 authored by Robert Sprowson's avatar Robert Sprowson Committed by ROOL
Browse files

[455] Don't call filters for tasks that have quit

Filter Manager continued to call filters based on their Task ID after they had quit. Now, watch out for Service_WimpCloseDown and disable any matching filters (the filters are retained so that any subsequent legitimate deregister attempt doesn't get an unknown filter error). As only 16 bit Task IDs are stored, define a new flag in b31 to denote a disabled filter - this also means there is a free "no match" when the filter lists are scanned.
The copy filter isn't affected because it doesn't select on Task ID.

FilterMgr.s: New flag to mark a task as having quit
ModHead.s: Listen for Service_WimpCloseDown and check the lists of Task IDs for any matches. Simplify *Filters code with advanced subroutine technology.
SWIs.s: Knock out the "quit" flag when comparing task handles to deregister
Tail.s: Walk a list, mark any matching tasks as having quit

Version 0.29. Tagged as 'Filter-0_29'
parent 848b7109
;
; This file is automatically maintained by srccommit, do not edit manually.
; Last processed by srccommit version: 1.1.
;
GBLS Module_MajorVersion
GBLA Module_Version
......@@ -10,14 +9,12 @@
GBLS Module_ApplicationDate
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.28"
Module_Version SETA 28
Module_MajorVersion SETS "0.29"
Module_Version SETA 29
Module_MinorVersion SETS ""
Module_Date SETS "23 Oct 2013"
Module_ApplicationDate SETS "23-Oct-13"
Module_Date SETS "18 Jan 2020"
Module_ApplicationDate SETS "18-Jan-20"
Module_ComponentName SETS "Filter"
Module_ComponentPath SETS "castle/RiscOS/Sources/Desktop/Filter"
Module_FullVersion SETS "0.28"
Module_HelpVersion SETS "0.28 (23 Oct 2013)"
Module_FullVersion SETS "0.29"
Module_HelpVersion SETS "0.29 (18 Jan 2020)"
END
/* (0.28)
/* (0.29)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.28
#define Module_MajorVersion_CMHG 0.29
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 23 Oct 2013
#define Module_Date_CMHG 18 Jan 2020
#define Module_MajorVersion "0.28"
#define Module_Version 28
#define Module_MajorVersion "0.29"
#define Module_Version 29
#define Module_MinorVersion ""
#define Module_Date "23 Oct 2013"
#define Module_Date "18 Jan 2020"
#define Module_ApplicationDate "23-Oct-13"
#define Module_ApplicationDate "18-Jan-20"
#define Module_ComponentName "Filter"
#define Module_ComponentPath "castle/RiscOS/Sources/Desktop/Filter"
#define Module_FullVersion "0.28"
#define Module_HelpVersion "0.28 (23 Oct 2013)"
#define Module_LibraryVersionInfo "0:28"
#define Module_FullVersion "0.29"
#define Module_HelpVersion "0.29 (18 Jan 2020)"
#define Module_LibraryVersionInfo "0:29"
......@@ -82,7 +82,8 @@ $lab ADD$cc $to,$from,#1
^ 0
next_ptr # 4 ; Pointer to next in chain (0 if none)
prev_ptr # 4 ; Pointer to previous entry in chain (0 if none)
f_task # 4 ; Task ID for which the filter is to be called.
f_task # 4 ; Task ID for which the filter is to be called (16 bit)
f_task_quit * 1:SHL:31 ; this Task ID was seen to have quit
f_mask # 4 ; Event mask.
f_address # 4 ; Address to call.
f_R12 # 4 ; Value in R12 when calling.
......@@ -107,6 +108,7 @@ post_icon_filters # 4
convert_buffer # 20
message_block # 16
flags # 4
f_messagesopen * (1:SHL:0)
filter_text # 4
task_text # 4
mask_text # 4
......@@ -115,8 +117,6 @@ fake_postrect # 4 ; do we want to fake the post-rectangle filter? (Wimp < 3.86)
get_handle_from_r10 # 4 ; do we get the window handle from r10 or the stack
; for get-rectangle filters? (from r10 for Wimp > 3.99)
f_messagesopen * (1:SHL:0)
max_running_work * (@-wsorigin)
......
......@@ -70,20 +70,11 @@ min_tab3 * 8
; ---------------------------------------------------------------------------------------------------------------------
; Handle *Filters - List all attached filters with the tasks they are attached to.
Filters_Code
Push "r7-r8,LR"
Push "r7-r9,LR"
Debug xx,"*Filters called, listing filters"
LDR wp,[R12]
ADR r1, prefilter_token
MOV r2, #0
BL MsgTrans_Lookup
MOVVC r0, r2
MOVVC r1, r3
SWIVC XOS_WriteN
SWIVC XOS_NewLine
Pull "r7-r8,PC",VS
MOV r4, #0 ; r4 = how much space we are using on the stack to hold column headings.
ADR r1, filter_token
......@@ -115,318 +106,189 @@ Filters_Code
BVS %FT05
STR sp, all_text
LDR r0, filter_text
MOV r1, r5
BL writefield
BVS %FT05
LDR r0, task_text
MOV r1, r6
BL writefield
SWIVC XOS_NewLine
BVS %FT05
LDR r0, filter_text
MOV r1, r5
BL writefield_dashed
BVS %FT05
LDR r0, task_text
MOV r1, r6
BL writefield_dashed
SWIVC XOS_NewLine
; pre filters
MOV r0, #2_011
ADR r1, prefilter_token
BL writeheadings
BVS %FT05
LDR r3, pre_filters
B %FT02
B %FT08
01
LDR r9, [r3, #f_task]
TST r9, #f_task_quit
BNE %FT03 ; Mute this one, the specific task has quit
LDR r0, [r3, #f_name]
MOV r1, r5
BL writefield
BVS %FT05
LDR r0, [r3, #f_task]
CMP r0, #0
LDREQ r0, all_text
SWINE XTaskManager_TaskNameFromHandle
BVS %FT05
MOV r1, r6
BL writefield
SWI XOS_NewLine
MOV r0, r9
BL writetaskname
SWIVC XOS_NewLine
BVS %FT05
03
LDR r3, [r3, #next_ptr]
02
08
CMP r3, #0
BNE %BT01
SWI XOS_NewLine
ADRL r1, postfilter_token
MOV r2, #0
BL MsgTrans_Lookup
MOVVC r0, r2
MOVVC r1, r3
SWIVC XOS_WriteN
SWIVC XOS_NewLine
BVS %FT05
LDR r0, filter_text
MOV r1, r5
BL writefield
BVS %FT05
LDR r0, task_text
MOV r1, r6
BL writefield
BVS %FT05
LDR r0, mask_text
MOV r1, r7
BL writefield
SWIVC XOS_NewLine
BVS %FT05
LDR r0, filter_text
MOV r1, r5
BL writefield_dashed
BVS %FT05
LDR r0, task_text
MOV r1, r6
BL writefield_dashed
BVS %FT05
LDR r0, mask_text
MOV r1, r7
BL writefield_dashed
SWIVC XOS_NewLine
; post filters
MOV r0, #2_111
ADRL r1, postfilter_token
BL writeheadings
BVS %FT05
LDR r3, post_filters
B %FT04
03
B %FT18
11
LDR r9, [r3, #f_task]
TST r9, #f_task_quit
BNE %FT13 ; Mute this one, the specific task has quit
LDR r0, [r3, #f_name]
MOV r1, r5
BL writefield
BVS %FT05
LDR r0, [r3, #f_task]
CMP r0, #0
LDREQ r0, all_text
SWINE XTaskManager_TaskNameFromHandle
MOVVC r1, r6
BLVC writefield
MOV r0, r9
BL writetaskname
BVS %FT05
LDR r0, [r3, #f_mask]
ADR r1, convert_buffer
MOV r2, #10
MOV r2, #?convert_buffer
SWI XOS_ConvertHex8
SWIVC XOS_Write0
SWIVC XOS_NewLine
BVS %FT05
13
LDR r3, [r3, #next_ptr]
04
18
CMP r3, #0
BNE %BT03
BNE %BT11
SWI XOS_NewLine
BVS %FT05
; rect filters
MOV r0, #2_011
ADRL r1, rectfilter_token
MOV r2, #0
BL MsgTrans_Lookup
MOVVC r0, r2
MOVVC r1, r3
SWIVC XOS_WriteN
SWIVC XOS_NewLine
BVS %FT05
LDR r0, filter_text
MOV r1, r5
BL writefield
BVS %FT05
LDR r0, task_text
MOV r1, r6
BL writefield
SWIVC XOS_NewLine
BVS %FT05
LDR r0, filter_text
MOV r1, r5
BL writefield_dashed
BVS %FT05
LDR r0, task_text
MOV r1, r6
BL writefield_dashed
SWIVC XOS_NewLine
BL writeheadings
BVS %FT05
LDR r3, rect_filters
B %FT11
B %FT28
21
LDR r9, [r3, #f_task]
TST r9, #f_task_quit
BNE %FT23 ; Mute this one, the specific task has quit
10
LDR r0, [r3, #f_name]
MOV r1, r5
BL writefield
BVS %FT05
LDR r0, [r3, #f_task]
CMP r0, #0
LDREQ r0, all_text
SWINE XTaskManager_TaskNameFromHandle
MOVVC r1, r6
BLVC writefield
SWIVC XOS_NewLine
MOV r0, r9
BL writetaskname
BVS %FT05
23
LDR r3, [r3, #next_ptr]
11
28
CMP r3, #0
BNE %BT10
BNE %BT21
SWI XOS_NewLine
BVS %FT05
; post rect filters
MOV r0, #2_011
ADRL r1, postrectfilter_token
MOV r2, #0
BL MsgTrans_Lookup
MOVVC r0, r2
MOVVC r1, r3
SWIVC XOS_WriteN
SWIVC XOS_NewLine
BVS %FT05
LDR r0, filter_text
MOV r1, r5
BL writefield
BVS %FT05
LDR r0, task_text
MOV r1, r6
BL writefield
SWIVC XOS_NewLine
BVS %FT05
LDR r0, filter_text
MOV r1, r5
BL writefield_dashed
BVS %FT05
LDR r0, task_text
MOV r1, r6
BL writefield_dashed
SWIVC XOS_NewLine
BL writeheadings
BVS %FT05
LDR r3, post_rect_filters
B %FT31
B %FT38
31
LDR r9, [r3, #f_task]
TST r9, #f_task_quit
BNE %FT33 ; Mute this one, the specific task has quit
30
LDR r0, [r3, #f_name]
MOV r1, r5
BL writefield
BVS %FT05
LDR r0, [r3, #f_task]
CMP r0, #0
LDREQ r0, all_text
SWINE XTaskManager_TaskNameFromHandle
MOVVC r1, r6
BLVC writefield
MOV r0, r9
BL writetaskname
SWIVC XOS_NewLine
BVS %FT05
33
LDR r3, [r3, #next_ptr]
31
38
CMP r3, #0
BNE %BT30
BNE %BT31
SWI XOS_NewLine
BVS %FT05
; post icon filters
MOV r0, #2_011
ADRL r1, posticonfilter_token
MOV r2, #0
BL MsgTrans_Lookup
MOVVC r0, r2
MOVVC r1, r3
SWIVC XOS_WriteN
SWIVC XOS_NewLine
BVS %FT05
LDR r0, filter_text
MOV r1, r5
BL writefield
BVS %FT05
LDR r0, task_text
MOV r1, r6
BL writefield
SWIVC XOS_NewLine
BVS %FT05
LDR r0, filter_text
MOV r1, r5
BL writefield_dashed
BVS %FT05
LDR r0, task_text
MOV r1, r6
BL writefield_dashed
SWIVC XOS_NewLine
BL writeheadings
BVS %FT05
LDR r3, post_icon_filters
B %FT41
B %FT48
41
LDR r9, [r3, #f_task]
TST r9, #f_task_quit
BNE %FT43 ; Mute this one, the specific task has quit
40
LDR r0, [r3, #f_name]
MOV r1, r5
BL writefield
BVS %FT05
LDR r0, [r3, #f_task]
CMP r0, #0
LDREQ r0, all_text
SWINE XTaskManager_TaskNameFromHandle
MOVVC r1, r6
BLVC writefield
MOV r0, r9
BL writetaskname
SWIVC XOS_NewLine
BVS %FT05
43
LDR r3, [r3, #next_ptr]
41
48
CMP r3, #0
BNE %BT40
BNE %BT41
SWI XOS_NewLine
BVS %FT05
ADRL r1, copyfilter_token
MOV r2, #0
BL MsgTrans_Lookup
MOVVC r0, r2
MOVVC r1, r3
SWIVC XOS_WriteN
SWIVC XOS_NewLine
BVS %FT05
LDR r0, filter_text
MOV r1, r5
BL writefield
SWIVC XOS_NewLine
BVS %FT05
LDR r0, filter_text
MOV r1, r5
BL writefield_dashed
SWIVC XOS_NewLine
; copy filters
MOV r0, #2_001
ADR r1, copyfilter_token
BL writeheadings
BVS %FT05
LDR r3, copy_filters
B %FT13
12
B %FT58
51
LDR r0, [r3, #f_name]
MOV r1, r5
BL writefield
SWIVC XOS_NewLine
BVS %FT05
53
LDR r3, [r3, #next_ptr]
13
58
CMP r3, #0
BNE %BT12
BNE %BT51
05
ADD sp, sp, r4
Pull "r7-r8,PC"
Pull "r7-r9,PC"
lookuptostack
; In: r1->token
......@@ -455,6 +317,74 @@ lookuptostack
STRB r0, [r1]
MOV pc, r8
writetaskname ROUT
; Write a task name (from ID) or "All"
; In: r0 = the Task ID
; r6 = width of heading column
; Out: r0 corrupted
Push "r1-r2,lr"
CMP r0, #0
LDREQ r0, all_text
SWINE XTaskManager_TaskNameFromHandle
MOVVC r1, r6
BLVC writefield
Pull "r1-r2,pc"
writeheadings ROUT
; Write the introductory text and column headings for a filter
; In: r0 = bitfield asking for b0 = filter heading
; b1 = task heading
; b2 = mask heading
; r1 -> token for introductory text
; r5-r7 = width of heading columns
Push "r0-r4,lr"
MOV r4, r0 ; Flags for later
MOV r2, #0
BL MsgTrans_Lookup
MOVVC r0, r2
MOVVC r1, r3
SWIVC XOS_WriteN
SWIVC XOS_NewLine
Pull "r0-r4,pc",VS
TST r4,#1 ; Want filter heading
LDRNE r0, filter_text
MOVNE r1, r5
BLNE writefield
Pull "r0-r4,pc",VS
TST r4,#2 ; Want task heading
LDRNE r0, task_text
MOVNE r1, r6
BLNE writefield
Pull "r0-r4,pc",VS
TST r4,#4 ; Want mask heading
LDRNE r0, mask_text
MOVNE r1, r6
BLNE writefield
SWIVC XOS_NewLine ; Newline regardless
Pull "r0-r4,pc",VS
TST r4,#1 ; Want filter heading
LDRNE r0, filter_text
MOVNE r1, r5
BLNE writefield_dashed
Pull "r0-r4,pc",VS
TST r4,#2 ; Want task heading
LDRNE r0, task_text
MOVNE r1, r6
BLNE writefield_dashed
Pull "r0-r4,pc",VS
TST r4,#4 ; Want mask heading
LDRNE r0, mask_text
MOVNE r1, r6
BLNE writefield_dashed
SWIVC XOS_NewLine ; Newline regardless
Pull "r0-r4,pc"
writefield
; Write control-terminated string, padded with spaces to field width
; In: r0 = text to print
......@@ -614,9 +544,11 @@ servicecallback
; ----------------------------------------------------------------------------------------------------------------------
; Module service entry point
ServiceTable
ASSERT Service_WimpCloseDown < Service_ResourceFSStarting
ASSERT Service_ResourceFSStarting < Service_WimpRegisterFilters
DCD 0 ; flags word
DCD Service2 - Module_BaseAddr
DCD Service_WimpCloseDown
[ standalone
DCD Service_ResourceFSStarting
]
......@@ -627,6 +559,7 @@ ServiceTable
Service
MOV R0, R0 ; flag service table to aware kernels
TEQ R1,#Service_WimpRegisterFilters
TEQNE R1,#Service_WimpCloseDown
[ standalone
TEQNE R1,#Service_ResourceFSStarting
]
......@@ -641,6 +574,10 @@ Service2
CMP R12, #0
MOVEQ PC, LR ; Exit if no workspace
TEQ R1,#Service_WimpCloseDown
BEQ servicewimpclosedown
; else must be Service_WimpRegisterFilters
;-------------------------------------
; Register our filters with the Wimp
; In:
......@@ -777,6 +714,31 @@ serviceresourcefsstarting
RETURN
]
; Wimp says a task has quit
; In R0 = 0 if closing, +ve if new task starting killed another
; R2 = task handle
servicewimpclosedown ROUT
CMP r0,#0
RETURN NE
Push "r1-r2,LR"
MOV r2,r2,LSL #16
MOV r2,r2,LSR #16
; Mark dead any pre filters matching that Task ID
LDR r1,pre_filters
BL flag_quit_list
LDR r1,rect_filters
BL flag_quit_list
LDR r1,post_filters
BL flag_quit_list
LDR r1,post_rect_filters
BL flag_quit_list
LDR r1,post_icon_filters
BL flag_quit_list
; r1, copy_filters Copy filters don't use a Task ID
Pull "r1-r2,LR"
RETURN
; ----------------------------------------------------------------------------------------------------------------------
; RMKill'ing the module - Release filter handlers. Release linked lists of filters.
Die
......
......@@ -270,6 +270,7 @@ find_filter
TEQ r14,r2
BNE