Commit cc3f5fb2 authored by Mike Stephens's avatar Mike Stephens
Browse files

added separate flag, ShrinkableDAs

parent 9d7c225e
......@@ -104,8 +104,8 @@ DAHandler_PreGrow * 0
DAHandler_PostGrow * 1
DAHandler_PreShrink * 2
DAHandler_PostShrink * 3
[ STB
DAHandler_TestShrink * 4 ; new reason added to find amount area could shrink by
[ ShrinkableDAs
DAHandler_TestShrink * 4 ; new reason added to find amount area could shrink by
]
; Number of entries in page block on stack
......@@ -1711,7 +1711,7 @@ DAReason_Remove * 1
DAReason_GetInfo * 2
DAReason_Enumerate * 3
DAReason_Renumber * 4
[ STB
[ ShrinkableDAs
DAReason_ReturnFree * 5
DAReason_Limit * 6
|
......@@ -1732,8 +1732,8 @@ DynAreaFlags_NotUserDraggable * 1 :SHL: 7
DynAreaFlags_NeedsSpecificPages * 1 :SHL: 8 ; whether area will ever require particular physical pages
]
; amg: renaissance... this is a mess!
[ STB
DynAreaFlags_Shrinkable * 1 :SHL: 9 ; whether area should be shrunk when need more space in free pool
[ ShrinkableDAs
DynAreaFlags_Shrinkable * 1 :SHL: 9 ; whether area should be shrunk when need more space in free pool
DynAreaFlags_AccessMask * DynAreaFlags_APBits :OR: DynAreaFlags_NotBufferable :OR: DynAreaFlags_NotCacheable :OR: DynAreaFlags_DoublyMapped
; The following bits are only present in page flags
......@@ -1774,8 +1774,8 @@ DynAreaSub
B DynArea_GetInfo
B DynArea_Enumerate
B DynArea_Renumber
[ STB
B DynArea_ReturnFree
[ ShrinkableDAs
B DynArea_ReturnFree
]
; unknown OS_DynamicArea reason code
......@@ -2175,45 +2175,45 @@ DynArea_Renumber ALTENTRY
SETV
EXIT
[ STB
[ ShrinkableDAs
;**************************************************************************
;
; DynArea_ReturnFree - Return total free space, including shrinkables
; DynArea_ReturnFree - Return total free space, including shrinkables
;
; Internal routine called by DynamicAreaSWI
; Internal routine called by DynamicAreaSWI
;
; in: r0 = reason code (5)
; r1 = area number to exclude, or -1 to include all shrinkable areas
; in: r0 = reason code (5)
; r1 = area number to exclude, or -1 to include all shrinkable areas
;
; out: r2 = total amount of free memory
; out: r2 = total amount of free memory
;
DynArea_ReturnFree ALTENTRY
CMP r1, #-1 ; if no excluded area,
MOVEQ r10, r1 ; then point r10 nowhere
BEQ %FT10
CMP r1, #-1 ; if no excluded area,
MOVEQ r10, r1 ; then point r10 nowhere
BEQ %FT10
BL CheckAreaNumber ; else check area number is valid
BCC UnknownDyn ; [unknown area]
BL CheckAreaNumber ; else check area number is valid
BCC UnknownDyn ; [unknown area]
10
MOV r11, #DAList
MOV r2, #0
LDR r2, [r2, #FreePoolDANode + DANode_Size] ; start with current size of free pool
MOV r11, #DAList
MOV r2, #0
LDR r2, [r2, #FreePoolDANode + DANode_Size] ; start with current size of free pool
20
LDR r11, [r11, #DANode_Link] ; load next area
TEQ r11, #0 ; if end of list
EXIT EQ ; then exit, with r2 = correct value
LDR r11, [r11, #DANode_Link] ; load next area
TEQ r11, #0 ; if end of list
EXIT EQ ; then exit, with r2 = correct value
LDR lr, [r11, #DANode_Flags] ; load area flags
TST lr, #DynAreaFlags_Shrinkable ; must be shrinkable
TEQNE r11, r10 ; and not excluded area
BEQ %BT20 ; [don't try this one]
LDR lr, [r11, #DANode_Flags] ; load area flags
TST lr, #DynAreaFlags_Shrinkable ; must be shrinkable
TEQNE r11, r10 ; and not excluded area
BEQ %BT20 ; [don't try this one]
Push r3
BL CallTestShrink
ADD r2, r2, r3 ; add on amount if any
Pull r3
B %BT20 ; then go back for more
BL CallTestShrink
ADD r2, r2, r3 ; add on amount if any
Pull r3
B %BT20 ; then go back for more
]
;**************************************************************************
......@@ -2680,7 +2680,7 @@ InitDynamicAreas ENTRY "r0-r8,r11"
EXIT
LTORG
LTORG
InitFreePoolTable
& 0 ; link: no more nodes on list
......@@ -2805,20 +2805,20 @@ AreaShrink
LDMIA r2, {r2, r3}
SUB lr, r3, r2 ; lr = amount dest could grow
[ STB
CMP r1, lr
MOVHI r1, lr ; r1 = the most we want to move if we could
BLHI GenNotAllMovedError ; but if not all we still want error
[ ShrinkableDAs
CMP r1, lr
MOVHI r1, lr ; r1 = the most we want to move if we could
BLHI GenNotAllMovedError ; but if not all we still want error
SUB lr, r5, #1 ; lr = pagesize mask
BICS r1, r1, lr ; a pagesize multiple
BEQ IssueServiceMemoryMoved
]
[ STB
[ ShrinkableDAs
LDR r2, [r11, #DANode_Size] ; amount src could shrink
CMP r2, r1
BLCC TryToShrinkShrinkables
BCS %FT15 ; [we can now do it all]
CMP r2, r1
BLCC TryToShrinkShrinkables
BCS %FT15 ; [we can now do it all]
; we can't move all that is required, so move smaller amount
......@@ -2991,19 +2991,19 @@ AreaGrow
62
[ STB
[ ShrinkableDAs
; growing another area from free pool
; insert code here to check for shrinking shrinkable areas
CMP r1, lr ; if dest can't grow by this amount,
BHI %FT64 ; we're definitely not doing anything
CMP r1, lr ; if dest can't grow by this amount,
BHI %FT64 ; we're definitely not doing anything
CMP r2, r1 ; this should definitely set C=0 as required by TryToShrinkShrinkables
Push "lr"
BLCC TryToShrinkShrinkables
Pull "lr"
MOVCS r3, r1 ; if succeeded set r3 to number of bytes to do
BCS %FT65 ; and do it
CMP r2, r1 ; this should definitely set C=0 as required by TryToShrinkShrinkables
Push "lr"
BLCC TryToShrinkShrinkables
Pull "lr"
MOVCS r3, r1 ; if succeeded set r3 to number of bytes to do
BCS %FT65 ; and do it
64
; end of inserted code
......@@ -3170,25 +3170,25 @@ IssueServiceMemoryMoved
Pull "r0, r2-r9, r10, lr"
ExitSWIHandler
[ STB
[ ShrinkableDAs
; ***********************************************************************************
;
; TryToShrinkShrinkables - Attempt to make more space by shrinking shrinkable areas if appropriate
; TryToShrinkShrinkables - Attempt to make more space by shrinking shrinkable areas if appropriate
;
; in: r1 = total amount we wish to have in src area (already limited by max_size of destination area)
; r2 = current size of src area
; r11 -> src area node (we don't do anything unless this is the free pool)
; r12 -> dst area node
; C = 0
; in: r1 = total amount we wish to have in src area (already limited by max_size of destination area)
; r2 = current size of src area
; r11 -> src area node (we don't do anything unless this is the free pool)
; r12 -> dst area node
; C = 0
;
; out: r2 = new size of src area
; C=0 => failed to move as much as we wanted
; C=1 => succeeded in moving as much as we wanted
; out: r2 = new size of src area
; C=0 => failed to move as much as we wanted
; C=1 => succeeded in moving as much as we wanted
TryToShrinkShrinkables Entry "r0,r1,r10"
LDR lr, [r11, #DANode_Number]
TEQ lr, #ChangeDyn_FreePool
EXITS NE ; if src <> free pool, exit with flags intact
LDR lr, [r11, #DANode_Number]
TEQ lr, #ChangeDyn_FreePool
EXITS NE ; if src <> free pool, exit with flags intact
MOV r10, #DAList
ASSERT DANode_Link = 0 ; because DAList has only link
......@@ -3196,27 +3196,27 @@ TryToShrinkShrinkables Entry "r0,r1,r10"
LDR r10, [r10, #DANode_Link] ; and load next
CMP r10, #1 ; any more nodes?
EXIT CC ; no, then no match
TEQ r10, r12 ; check area <> dest
LDRNE lr, [r10, #DANode_Flags] ; and area is shrinkable
TSTNE lr, #DynAreaFlags_Shrinkable
BEQ %BT10 ; if not, try next area
SUBS r1, r1, r2 ; r1 = amount we still need
LDR lr, [r10, #DANode_Size] ; available size of this area
CMP lr, r1
MOVCC r1, lr ; min(amount we need, size of this area)
RSB r1, r1, #0 ; make negative - it's a shrink
MOV r0, #0
STR r0, [r0, #CDASemaphore] ; momentarily pretend we're not threaded
LDR r0, [r10, #DANode_Number]
SWI XOS_ChangeDynamicArea
MOV r0, #1
STR r0, [r0, #CDASemaphore-1] ; we're threaded again
LDR r1, [sp, #4] ; reload original r1
LDR r2, [r11, #DANode_Size] ; get new size of src area
CMP r2, r1
BCC %BT10 ; if still too small, loop
EXIT ; exit CS indicating success
TEQ r10, r12 ; check area <> dest
LDRNE lr, [r10, #DANode_Flags] ; and area is shrinkable
TSTNE lr, #DynAreaFlags_Shrinkable
BEQ %BT10 ; if not, try next area
SUBS r1, r1, r2 ; r1 = amount we still need
LDR lr, [r10, #DANode_Size] ; available size of this area
CMP lr, r1
MOVCC r1, lr ; min(amount we need, size of this area)
RSB r1, r1, #0 ; make negative - it's a shrink
MOV r0, #0
STR r0, [r0, #CDASemaphore] ; momentarily pretend we're not threaded
LDR r0, [r10, #DANode_Number]
SWI XOS_ChangeDynamicArea
MOV r0, #1
STR r0, [r0, #CDASemaphore-1] ; we're threaded again
LDR r1, [sp, #4] ; reload original r1
LDR r2, [r11, #DANode_Size] ; get new size of src area
CMP r2, r1
BCC %BT10 ; if still too small, loop
EXIT ; exit CS indicating success
]
; ***********************************************************************************
......@@ -3954,7 +3954,7 @@ CallPostGrow ENTRY "r0,r3,r4, r12"
LDMIA r12, {r12, pc} ; load workspace pointer and jump to handler
EXIT
[ STB
[ ShrinkableDAs
; ***********************************************************************************
;
; CallTestShrink - Call test-shrink routine
......@@ -3972,8 +3972,8 @@ CallTestShrink ENTRY "r0,r4,r5, r12"
MOV r0, #DAHandler_TestShrink ; r0 = reason code
LDR r4, [r11, #DANode_Size] ; r4 = current size
MOV r5, #0
LDR r5, [r5, #Page_Size] ; set r5 = page size
MOV r5, #0
LDR r5, [r5, #Page_Size] ; set r5 = page size
ASSERT DANode_Handler = DANode_Workspace +4
ADD r12, r11, #DANode_Workspace
MOV lr, pc
......@@ -3991,7 +3991,7 @@ CallTestShrink ENTRY "r0,r4,r5, r12"
BLEQ TranslateError
]
STR r0, [sp]
MOV r3, #0 ; indicate no shrink possible
MOV r3, #0 ; indicate no shrink possible
SETV
EXIT
]
......
......@@ -199,7 +199,7 @@ DoingVdu SETL {FALSE} ; so can get KeyWS!
Module SETL {FALSE}
GBLL IncludeTestSrc ; whether test code is included
! 0, "Modified code"
! 0, "Modified code"
[ MorrisSupport
IncludeTestSrc SETL {FALSE}
|
......@@ -239,18 +239,18 @@ RISCPCBurstMode SETL {FALSE}
] ; :LNOT:RO371Timings
GBLL DoInitialiseMode
DoInitialiseMode SETL {TRUE} :LAND: STB
GBLL DoInitialiseMode
DoInitialiseMode SETL {TRUE} :LAND: STB
[ STB
GBLL Select16BitSound ; STBs and pre-IOMD systems don't have this link
Select16BitSound SETL {FALSE}
GBLL Select16BitSound ; STBs and pre-IOMD systems don't have this link
Select16BitSound SETL {FALSE}
|
GBLL Select16BitSound
Select16BitSound SETL {TRUE}
]
GBLL Japanese16BitSound
Japanese16BitSound SETL {TRUE} :LAND: STB
GBLL Japanese16BitSound
Japanese16BitSound SETL {TRUE} :LAND: STB
GBLL Simulator ; running on simulator?
Simulator SETL {FALSE}
......@@ -321,6 +321,8 @@ IgnoreVRAM SETL {FALSE}
GBLL LateAborts ; if true, use late abort mode on ARM600 (compulsory on ARM700)
LateAborts SETL MEMM_Type = "ARM600" :LAND: {TRUE}
GBLL ShrinkableDAs ; if true, support Shrinkable Dynamic Areas (eg. CacheFS)
ShrinkableDAs SETL {TRUE}
GBLL StrongARM
GBLL SAWBbroken ;whether StrongARM Write Buffer is broken (pass 1 silicon only)
......@@ -425,14 +427,14 @@ LCDSupport SETL {TRUE} :LAND: :LNOT: STB
GBLL FixR9CorruptionInExtensionSWI ; whether R9 corruption by ExtensionSWI handler is fixed
FixR9CorruptionInExtensionSWI SETL {FALSE} ; currently FALSE as CC's !SpellMod (possibly others) rely on it being broken
GBLL InterlacedPointer
InterlacedPointer SETL {TRUE} :LAND: STB ; enable code to do proper interlaced pointer
GBLL InterlacedPointer
InterlacedPointer SETL {TRUE} :LAND: STB ; enable code to do proper interlaced pointer
GBLL ValidateCMOS ; Apply special CMOS-corruption detection code, and do minimal default settings.
ValidateCMOS SETL {TRUE} :LAND: STB
GBLL ValidateCMOS ; Apply special CMOS-corruption detection code, and do minimal default settings.
ValidateCMOS SETL {TRUE} :LAND: STB
GBLL UseHClk
UseHClk SETL {TRUE} :LAND: STB ; Use HClk when driving TVs.
GBLL UseHClk
UseHClk SETL {TRUE} :LAND: STB ; Use HClk when driving TVs.
[ DebugHeaps
! 0, "*** WARNING *** Heap debugging assembled in"
......
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