Commit 9224a6ca authored by Jeffrey Lee's avatar Jeffrey Lee Committed by ROOL

Add OS_DynamicArea 27+28, for supporting lots of RAM

OS_DynamicArea 27 is the same as OS_DynamicArea 5 ("return free
memory"), except the result is measured in pages instead of bytes,
allowing it to behave sensibly on machines with many gigabytes of RAM.

Similarly, OS_DynamicArea 28 is the same as OS_DynamicArea 7 (internal
DA enumeration call used by TaskManager), except the returned size
values are measured in pages instead of bytes. A flags word has also
been added to allow for more expansion in the future.

Hdr:OSMem now also contains some more definitions which external code
will find useful.

Version 6.29. Tagged as 'Kernel-6_29'
parent a5db413c
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
GBLS Module_ApplicationDate GBLS Module_ApplicationDate
GBLS Module_HelpVersion GBLS Module_HelpVersion
GBLS Module_ComponentName GBLS Module_ComponentName
Module_MajorVersion SETS "6.28" Module_MajorVersion SETS "6.29"
Module_Version SETA 628 Module_Version SETA 629
Module_MinorVersion SETS "" Module_MinorVersion SETS ""
Module_Date SETS "24 Nov 2019" Module_Date SETS "24 Nov 2019"
Module_ApplicationDate SETS "24-Nov-19" Module_ApplicationDate SETS "24-Nov-19"
Module_ComponentName SETS "Kernel" Module_ComponentName SETS "Kernel"
Module_FullVersion SETS "6.28" Module_FullVersion SETS "6.29"
Module_HelpVersion SETS "6.28 (24 Nov 2019)" Module_HelpVersion SETS "6.29 (24 Nov 2019)"
END END
/* (6.28) /* (6.29)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* *
*/ */
#define Module_MajorVersion_CMHG 6.28 #define Module_MajorVersion_CMHG 6.29
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 24 Nov 2019 #define Module_Date_CMHG 24 Nov 2019
#define Module_MajorVersion "6.28" #define Module_MajorVersion "6.29"
#define Module_Version 628 #define Module_Version 629
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "24 Nov 2019" #define Module_Date "24 Nov 2019"
...@@ -16,6 +16,6 @@ ...@@ -16,6 +16,6 @@
#define Module_ComponentName "Kernel" #define Module_ComponentName "Kernel"
#define Module_FullVersion "6.28" #define Module_FullVersion "6.29"
#define Module_HelpVersion "6.28 (24 Nov 2019)" #define Module_HelpVersion "6.29 (24 Nov 2019)"
#define Module_LibraryVersionInfo "6:28" #define Module_LibraryVersionInfo "6:29"
...@@ -15,6 +15,19 @@ ...@@ -15,6 +15,19 @@
; Definitions for OS_DynamicArea, OS_Memory and other related SWIs ; Definitions for OS_DynamicArea, OS_Memory and other related SWIs
; System-defined dynamic area numbers
^ -1
ChangeDyn_AplSpace # 1 ; -1, Not recognised by all APIs
ChangeDyn_SysHeap # 1 ; 0
ChangeDyn_RMA # 1 ; 1
ChangeDyn_Screen # 1 ; 2
ChangeDyn_SpriteArea # 1 ; 3
ChangeDyn_FontArea # 1 ; 4
ChangeDyn_RamFS # 1 ; 5
ChangeDyn_FreePool # 1 ; 6
ChangeDyn_MaxArea # 0 ; For internal use by kernel
ReadDyn_ReturnMax * 128 ; OS_ReadDynamicArea flag to return max size of area in R2 (for areas 0 to 127 inclusive; other areas always return max size)
; OS_DynamicArea reason codes ; OS_DynamicArea reason codes
DAReason_Create * 0 DAReason_Create * 0
...@@ -36,7 +49,9 @@ DAReason_PMP_Resize * 23 ...@@ -36,7 +49,9 @@ DAReason_PMP_Resize * 23
DAReason_PMP_GetInfo * 24 DAReason_PMP_GetInfo * 24
DAReason_PMP_GetPages * 25 DAReason_PMP_GetPages * 25
DAReason_AplSpaceLimit * 26 DAReason_AplSpaceLimit * 26
DAReason_Limit * 27 ;end of defined DA reasons DAReason_ReturnFreePages * 27
DAReason_EnumerateInfo2 * 28
DAReason_Limit * 29 ;end of defined DA reasons
; Dynamic area / page flags ; Dynamic area / page flags
......
...@@ -160,15 +160,7 @@ DebuggerSpace DefAreaFlags Read, PageFlags_Unavailable ...@@ -160,15 +160,7 @@ DebuggerSpace DefAreaFlags Read, PageFlags_Unavailable
ChangeDyn_Batcall * -3 ; special DA number to select Batman usage of OS_ChangeDynamicArea ChangeDyn_Batcall * -3 ; special DA number to select Batman usage of OS_ChangeDynamicArea
] ]
; -2 was an internal value, now no longer used ; -2 was an internal value, now no longer used
ChangeDyn_AplSpace * -1 ; -> See hdr.OSMem for other area definitions
ChangeDyn_SysHeap * 0
ChangeDyn_RMA * 1
ChangeDyn_Screen * 2
ChangeDyn_SpriteArea * 3
ChangeDyn_FontArea * 4
ChangeDyn_RamFS * 5
ChangeDyn_FreePool * 6
ChangeDyn_MaxArea * 6
; Number of entries in page block on stack ; Number of entries in page block on stack
...@@ -338,8 +330,7 @@ Call_CAM_Mapping ...@@ -338,8 +330,7 @@ Call_CAM_Mapping
ReadDynamicArea ROUT ReadDynamicArea ROUT
readdyn_returnR2bit * &80 ASSERT ChangeDyn_MaxArea < ReadDyn_ReturnMax
ASSERT ChangeDyn_MaxArea < readdyn_returnR2bit
CMP r0, #ChangeDyn_AplSpace ; if finding out about app space CMP r0, #ChangeDyn_AplSpace ; if finding out about app space
[ ZeroPage = 0 [ ZeroPage = 0
...@@ -360,7 +351,7 @@ readdyn_returnR2bit * &80 ...@@ -360,7 +351,7 @@ readdyn_returnR2bit * &80
Push "r1,lr" Push "r1,lr"
CMP r0, #&100 ; if area >= &100 CMP r0, #&100 ; if area >= &100
MOVCS r1, r0 ; then just use area MOVCS r1, r0 ; then just use area
BICCC r1, r0, #readdyn_returnR2bit ; else knock off bit 7 BICCC r1, r0, #ReadDyn_ReturnMax ; else knock off bit 7
[ DynArea_QuickHandles [ DynArea_QuickHandles
BL QCheckAreaNumber ; out: r10 -> node BL QCheckAreaNumber ; out: r10 -> node
| |
...@@ -703,6 +694,16 @@ DynAreaSub ...@@ -703,6 +694,16 @@ DynAreaSub
B DynArea_PMP_GetInfo B DynArea_PMP_GetInfo
B DynArea_PMP_GetPages B DynArea_PMP_GetPages
B DynArea_AplSpaceLimit B DynArea_AplSpaceLimit
[ ShrinkableDAs
B DynArea_ReturnFreePages
|
B DynArea_Unknown
]
[ DynArea_QuickHandles
B DynArea_EnumerateInfo2
|
B DynArea_Unknown
]
; ;
; unknown OS_DynamicArea reason code ; unknown OS_DynamicArea reason code
...@@ -1675,6 +1676,8 @@ DynArea_GetChangeInfo ROUT ...@@ -1675,6 +1676,8 @@ DynArea_GetChangeInfo ROUT
] ;DynArea_QuickHandles ] ;DynArea_QuickHandles
[ DynArea_QuickHandles
;************************************************************************** ;**************************************************************************
; ;
; DynArea_EnumerateInfo ; DynArea_EnumerateInfo
...@@ -1686,21 +1689,61 @@ DynArea_GetChangeInfo ROUT ...@@ -1686,21 +1689,61 @@ DynArea_GetChangeInfo ROUT
; r1 = -1 to start enumeration, or area number to continue from ; r1 = -1 to start enumeration, or area number to continue from
; ;
; out: r1 = number of next area found, or -1 if no more areas ; out: r1 = number of next area found, or -1 if no more areas
; r2 = current size of area, if area found ; r2 = current size of area (in bytes), if area found
; r3 = base logical address, if area found ; r3 = base logical address, if area found
; r4 = area flags, if area found ; r4 = area flags, if area found
; r5 = maximum size of area, if area found ; r5 = maximum size of area (in bytes), if area found
; r6 -> title string, if area found ; r6 -> title string, if area found
; ;
;Notes: ;Notes:
; (1) r2-r6 on exit are undefined if r1 = -1 ; (1) r2-r6 on exit are undefined if r1 = -1
; ;
[ DynArea_QuickHandles
DynArea_EnumerateInfo ROUT DynArea_EnumerateInfo ROUT
Push "r2,lr"
MOV r2, #0
BL DynArea_EnumerateInfo2
Pull "r2,pc",VS
CMP r1, #-1
Pull "r2,pc",EQ
; Clamp at safe values
CMP r2, #DynArea_PMP_BigPageCount
MOVLO r2, r2, LSL #12
LDRHS r2, =DynArea_PMP_BigByteCount
CMP r5, #DynArea_PMP_BigPageCount
MOVLO r5, r5, LSL #12
LDRHS r5, =DynArea_PMP_BigByteCount
ADD sp, sp, #4
Pull "pc"
;**************************************************************************
;
; DynArea_EnumerateInfo2
;
; Enumerate *non-system* dynamic areas, returning selected info
; Reserved for Acorn use (intended for TaskManager)
;
; in: r0 = reason code (28)
; r1 = -1 to start enumeration, or area number to continue from
; r2 = flags (reserved)
;
; out: r1 = number of next area found, or -1 if no more areas
; r2 = current size of area (in pages), if area found
; r3 = base logical address, if area found
; r4 = area flags, if area found
; r5 = maximum size of area (in pages), if area found
; r6 -> title string, if area found
;
;Notes:
; (1) r2-r6 on exit are undefined if r1 = -1
;
DynArea_EnumerateInfo2 ROUT
Push "lr" Push "lr"
CMP r2, #0
BNE %FT90
LDR r11, =ZeroPage LDR r11, =ZeroPage
LDR r11, [r11, #DynArea_ws] LDR r11, [r11, #DynArea_ws]
...@@ -1729,17 +1772,13 @@ DynArea_EnumerateInfo ROUT ...@@ -1729,17 +1772,13 @@ DynArea_EnumerateInfo ROUT
LDR r3, [r10, #DANode_Base] LDR r3, [r10, #DANode_Base]
LDR r6, [r10, #DANode_Title] LDR r6, [r10, #DANode_Title]
TST r4, #DynAreaFlags_PMP TST r4, #DynAreaFlags_PMP
LDREQ r2, [r10, #DANode_Size] LDRNE r2, [r10, #DANode_PMPSize]
LDREQ r5, [r10, #DANode_MaxSize] LDRNE r5, [r10, #DANode_PMPMaxSize]
BEQ %FT11 BNE %FT11
LDR r2, [r10, #DANode_PMPSize] LDR r2, [r10, #DANode_Size]
LDR r5, [r10, #DANode_PMPMaxSize] LDR r5, [r10, #DANode_MaxSize]
CMP r2, #DynArea_PMP_BigPageCount MOV r2, r2, LSR #12
MOVLO r2, r2, LSL #12 MOV r5, r5, LSR #12
LDRHS r2, =DynArea_PMP_BigByteCount
CMP r5, #DynArea_PMP_BigPageCount
MOVLO r5, r5, LSL #12
LDRHS r5, =DynArea_PMP_BigByteCount
11 11
LDR r11, =ZeroPage LDR r11, =ZeroPage
...@@ -1750,15 +1789,18 @@ DynArea_EnumerateInfo ROUT ...@@ -1750,15 +1789,18 @@ DynArea_EnumerateInfo ROUT
CLRV CLRV
Pull "PC" Pull "PC"
;it's a reserved call, so naff off internationalisation
14 14
ADR r0,DynArea_badei ADRL r0, ErrorBlock_BadDynamicArea
B %FT90
80
ADRL r0, ErrorBlock_BadParameters
90
[ International
BL TranslateError
|
SETV SETV
]
Pull "PC" Pull "PC"
DynArea_badei
DCD 0
DCB "bad DA number",0
ALIGN
] ;DynArea_QuickHandles ] ;DynArea_QuickHandles
...@@ -2191,10 +2233,32 @@ DynArea_NaughtyRenum ...@@ -2191,10 +2233,32 @@ DynArea_NaughtyRenum
; in: r0 = reason code (5) ; in: r0 = reason code (5)
; r1 = area number to exclude, or -1 to include all shrinkable areas ; 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, bytes
; ;
DynArea_ReturnFree ALTENTRY DynArea_ReturnFree
Push "lr"
BL DynArea_ReturnFreePages
Pull "pc",VS
; Clamp at safe value
CMP r2, #DynArea_PMP_BigPageCount
MOVLO r2, r2, LSL #12
LDRHS r2, =DynArea_PMP_BigByteCount
Pull "pc"
;**************************************************************************
;
; DynArea_ReturnFreePages - Return total free space, including shrinkables
;
; Internal routine called by DynamicAreaSWI
;
; in: r0 = reason code (27)
; r1 = area number to exclude, or -1 to include all shrinkable areas
;
; out: r2 = total amount of free memory, in pages
;
DynArea_ReturnFreePages ALTENTRY
CMP r1, #-1 ; if no excluded area, CMP r1, #-1 ; if no excluded area,
MOVEQ r10, r1 ; then point r10 nowhere MOVEQ r10, r1 ; then point r10 nowhere
BEQ %FT10 BEQ %FT10
...@@ -2243,9 +2307,6 @@ DynArea_ReturnFree ALTENTRY ...@@ -2243,9 +2307,6 @@ DynArea_ReturnFree ALTENTRY
B %BT20 ; then go back for more B %BT20 ; then go back for more
90 90
CMP r2, #DynArea_PMP_BigPageCount
MOVLO r2, r2, LSL #12
LDRHS r2, =DynArea_PMP_BigByteCount
EXIT EXIT
] ]
......
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