Commit 66b9745b authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Extend possible range of OS_Call[After|Every]

OS_CallAfter and OS_CallEvery were treating the delay in R0 as a signed number, limiting its possible range. The PRM didn't require this (a -ve delay doesn't make sense, so implicitly times are unsigned), reworked to allow times up to 0xFFFFFBFF.
Aside:
  OSLib exports these functions as 'int', but it doesn't seem to make a distinction for unsigned versus signed anyway (other unsigned arguments are plain int too)
  The 'callx' library was already prototyped with unsigned times back in 1997

Added comment to hdr/Options about FirstUnpluggableModule - since the keyboard and mouse drivers got moved out of the kernel in 3.50, the original intent (to not allow you to unplug vital modules) has long since been lost, and really the only use of this value is to save 8 bits of CMOS frugal bits.

Version 5.35, 4.79.2.181. Tagged as 'Kernel-5_35-4_79_2_181'
parent b9898460
......@@ -13,11 +13,11 @@
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.35"
Module_Version SETA 535
Module_MinorVersion SETS "4.79.2.180"
Module_Date SETS "10 Jan 2013"
Module_ApplicationDate SETS "10-Jan-13"
Module_MinorVersion SETS "4.79.2.181"
Module_Date SETS "17 Jan 2013"
Module_ApplicationDate SETS "17-Jan-13"
Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.35 (4.79.2.180)"
Module_HelpVersion SETS "5.35 (10 Jan 2013) 4.79.2.180"
Module_FullVersion SETS "5.35 (4.79.2.181)"
Module_HelpVersion SETS "5.35 (17 Jan 2013) 4.79.2.181"
END
......@@ -5,19 +5,19 @@
*
*/
#define Module_MajorVersion_CMHG 5.35
#define Module_MinorVersion_CMHG 4.79.2.180
#define Module_Date_CMHG 10 Jan 2013
#define Module_MinorVersion_CMHG 4.79.2.181
#define Module_Date_CMHG 17 Jan 2013
#define Module_MajorVersion "5.35"
#define Module_Version 535
#define Module_MinorVersion "4.79.2.180"
#define Module_Date "10 Jan 2013"
#define Module_MinorVersion "4.79.2.181"
#define Module_Date "17 Jan 2013"
#define Module_ApplicationDate "10-Jan-13"
#define Module_ApplicationDate "17-Jan-13"
#define Module_ComponentName "Kernel"
#define Module_ComponentPath "castle/RiscOS/Sources/Kernel"
#define Module_FullVersion "5.35 (4.79.2.180)"
#define Module_HelpVersion "5.35 (10 Jan 2013) 4.79.2.180"
#define Module_FullVersion "5.35 (4.79.2.181)"
#define Module_HelpVersion "5.35 (17 Jan 2013) 4.79.2.181"
#define Module_LibraryVersionInfo "5:35"
......@@ -329,8 +329,8 @@ ConfiguredLang SETA 10
GBLA FirstUnpluggableModule
FirstUnpluggableModule SETA 8 ; Podule, FileSwitch, ResourceFS, Messages, MessageTrans,
; TerritoryManager, UKTerritory
; TerritoryManager, UK. Moot now the keyboard and mouse aren't
; in the kernel - unplug those and you're stuffed.
[ DebugForcedReset
Reset_CannotResetFlag * 1
Reset_SysHeapCorrupt * 2
......
......@@ -17,23 +17,27 @@
; This file revised by TMD 28-Jan-94 to
; a) Correct internals to time n ticks not n+1
; b) Change externals to add 1 to compensate for user subtracting 1
; c) Fix RemoveTickerEvent to add this nodes time onto the next one
; c) Fix RemoveTickerEvent to add this node's time onto the next one
; These fix bug MED-02498.
; There are two (centisecond) ticker SWIs :
; SWI CallAfter calls the given address once, after the given number of ticks
; SWI CallEvery " " " " every N centiseconds
; In : R0 is (signed) number of centiseconds
; In : R0 is unsigned number of centiseconds
; R1 is address to call
; R2 is value of R12 to pass to code
CallEvery_Code
ADD r10, r0, #1 ; compensate for n+1 bug
B TickTockCommon
CallAfter_Code ROUT
MOV r10, #0
TickTockCommon
Push "r0-r3, lr"
CMP r0, #0
BLE %FT99
ADD r14, r0, #1024
CMP r14, #1024
BLS %FT99 ; reject 0 and >= &FFFFFC00
[ ChocolateSysHeap
ASSERT ChocolateTKBlocks = ChocolateBlockArrays + 8
......@@ -72,9 +76,6 @@ TickTockCommon
MakeErrorBlock BadTime
CallEvery_Code
ADD r10, r0, #1 ; compensate for n+1 bug
B TickTockCommon
; Data structure :
; chain of nodes
......@@ -111,8 +112,8 @@ InsertTickerEvent ROUT
; R1 is node pointer, R0 ticks to wait
; R10-R12 corrupted
Push "r0,r2"
PHPSEI r2
Push "r0,lr"
PHPSEI r14
LDR r10, =ZeroPage+TickNodeChain
01
MOV r11, r10
......@@ -120,9 +121,9 @@ InsertTickerEvent ROUT
CMP r10, #0
BEQ %FT02 ; end of chain
LDR r12, [r10, #TickNodeLeft]
SUBS r0, r0, r12
BGE %BT01
ADD r0, r0, r12
CMP r12, r0
SUBLS r0, r0, r12
BLS %BT01 ; node R10 is earlier (or equal) to node R1
SUB r12, r12, r0
STR r12, [r10, #TickNodeLeft]
02
......@@ -130,9 +131,8 @@ InsertTickerEvent ROUT
STR r0, [r1, #TickNodeLeft]
STR r10, [r1, #TickNodeLink]
PLP r2
Pull "r0,r2"
MOV pc, lr
PLP r14
Pull "r0,pc"
ProcessTickEventChain ROUT
; R0-R3, R10-R12 corruptible
......@@ -145,7 +145,7 @@ ProcessTickEventChain ROUT
LDR r2, [r1, #TickNodeLeft]
SUBS r2, r2, #1
STR r2, [r1, #TickNodeLeft]
MOVGT pc, lr ; nothing to call yet (was MOVPL)
MOVNE pc, lr ; nothing to call yet (was MOVPL)
Push "lr" ; save IRQ_lr
[ TickIrqReenter
......@@ -166,7 +166,7 @@ ProcessTickEventChain ROUT
LDR r0, [r1, #TickNodeRedo]
CMP r0, #0 ; CallEvery?
BLE %FT05
BEQ %FT05
BL InsertTickerEvent ; yes, then re-insert timer
B %FT10
......@@ -191,15 +191,15 @@ ProcessTickEventChain ROUT
]
WritePSRc SVC_mode+I_bit, r1 ; IRQ's off again
; Check for more events down the list
; Check for more events at the same level in the list
10
LDR r1, [r3, #TickNodeLink] ; get top of list
CMP r1, #0 ; list empty?
BEQ %FT02 ; yes then exit
LDR r0, [r1, #TickNodeLeft]
CMP r0, #0 ; timed out?
BLE %BT01 ; yes then jump
CMP r0, #0 ; zero time delta?
BEQ %BT01 ; yes then jump
02
Pull "lr" ; restore SVC_lr
WritePSRc IRQ_mode+I_bit, r10 ; back to IRQ mode
......
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