Commit c8f15bd6 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Add extra OS_DynamicArea subreason

Subreason 20 takes a logical address and tells you which area it lies in, including system areas (ie. those returned by OS_Memory 16.
This allows areas to change type in future without the caller needing to care where the kernel put it.

Version 5.35, 4.79.2.267. Tagged as 'Kernel-5_35-4_79_2_267'
parent 1aa4be26
......@@ -13,11 +13,11 @@
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.35"
Module_Version SETA 535
Module_MinorVersion SETS "4.79.2.266"
Module_Date SETS "19 Jun 2015"
Module_ApplicationDate SETS "19-Jun-15"
Module_MinorVersion SETS "4.79.2.267"
Module_Date SETS "04 Jul 2015"
Module_ApplicationDate SETS "04-Jul-15"
Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.35 (4.79.2.266)"
Module_HelpVersion SETS "5.35 (19 Jun 2015) 4.79.2.266"
Module_FullVersion SETS "5.35 (4.79.2.267)"
Module_HelpVersion SETS "5.35 (04 Jul 2015) 4.79.2.267"
END
......@@ -5,19 +5,19 @@
*
*/
#define Module_MajorVersion_CMHG 5.35
#define Module_MinorVersion_CMHG 4.79.2.266
#define Module_Date_CMHG 19 Jun 2015
#define Module_MinorVersion_CMHG 4.79.2.267
#define Module_Date_CMHG 04 Jul 2015
#define Module_MajorVersion "5.35"
#define Module_Version 535
#define Module_MinorVersion "4.79.2.266"
#define Module_Date "19 Jun 2015"
#define Module_MinorVersion "4.79.2.267"
#define Module_Date "04 Jul 2015"
#define Module_ApplicationDate "19-Jun-15"
#define Module_ApplicationDate "04-Jul-15"
#define Module_ComponentName "Kernel"
#define Module_ComponentPath "castle/RiscOS/Sources/Kernel"
#define Module_FullVersion "5.35 (4.79.2.266)"
#define Module_HelpVersion "5.35 (19 Jun 2015) 4.79.2.266"
#define Module_FullVersion "5.35 (4.79.2.267)"
#define Module_HelpVersion "5.35 (04 Jul 2015) 4.79.2.267"
#define Module_LibraryVersionInfo "5:35"
......@@ -494,7 +494,7 @@ ReadDynamicArea ROUT
readdyn_returnR2bit * &80
ASSERT ChangeDyn_MaxArea < readdyn_returnR2bit
CMP r0, #-1 ; if finding out about app space
CMP r0, #ChangeDyn_AplSpace ; if finding out about app space
[ ZeroPage = 0
LDREQ r1, [r0, #AplWorkSize+1] ; then r1 = current size
|
......@@ -765,7 +765,8 @@ DAReason_SetClamps * 8 ;if DynArea_Quickhandles, else reason code inval
DAReason_SparseClaim * 9 ;if DA_Batman, else reason code invalid
DAReason_SparseRelease * 10 ;if DA_Batman, else reason code invalid
]
DAReason_Limit * 11 ;end of defined DA reasons
DAReason_LocateAddress * 20
DAReason_Limit * 21 ;end of defined DA reasons
DynArea_NewAreas * &100 ; Allocated area numbers start here
......@@ -862,6 +863,17 @@ DynAreaSub
B DynArea_Unknown
B DynArea_Unknown
]
B DynArea_Unknown ; 11
B DynArea_Unknown ; |
B DynArea_Unknown ; |
B DynArea_Unknown ; |
B DynArea_Unknown ; |--Reserved for ROL
B DynArea_Unknown ; |
B DynArea_Unknown ; |
B DynArea_Unknown ; |
B DynArea_Unknown ; 19
B DynArea_Locate
;
; unknown OS_DynamicArea reason code
;
......@@ -2223,6 +2235,89 @@ DynArea_ReturnFree ALTENTRY
B %BT20 ; then go back for more
]
;**************************************************************************
;
; DynArea_Locate - Return area number given an address
;
; Internal routine called by DynamicAreaSWI
;
; in: r0 = reason code (20)
; r1 = logical address to locate
;
; out: r0 = area type (0=dynamic, 1=system, others reserved)
; r1 = area number
; r10-r12 may be corrupted
; All other registers preserved
;
DynArea_Locate Entry "r2-r5"
MOV r5, r1
MOV r4, #1
10
MOV r0, r4, LSL #8
BL MemoryAreaInfo
BVS %FT20 ; no more system areas
ADD r2, r1, r2 ; r1:=base r2:=top
CMP r5, r1
CMPCS r2, r5
MOVHI r1, r4 ; number
MOVHI r0, #1 ; system area
EXIT HI
ADD r4, r4, #1
B %BT10
20
[ DynArea_QuickHandles
LDR r11, =ZeroPage
LDR r11, [r11, #DynArea_ws]
ADR r3, DynArea_SysQHandleArray
MOV r4, #0
30
LDR r10, [r3, r4, LSL #2]
TEQ r10, #0
BLNE %FT60 ; check system DA node
ADD r4, r4, #1
CMP r4, #ChangeDyn_MaxArea
BLS %BT30
ADR r3, DynArea_QHandleArray
MOV r4, #0
40
LDR r10, [r3, r4, LSL #2]
CMP r10, #DynArea_NumQHandles
BLHI %FT60 ; check quick DA node
ADD r4, r4, #1
CMP r4, #DynArea_NumQHandles
BCC %BT40
]
LDR r10, =ZeroPage+DAList
ASSERT DANode_Link = 0 ; because DAList has only link
50
LDR r10, [r10, #DANode_Link]
TEQ r10, #0
PullEnv EQ
ADREQL r0, ErrorBlock_BadAddress
BEQ DynArea_ReturnError
BL %FT60 ; check treacle DA node
B %BT50
60
LDR r1, [r10, #DANode_Base]
LDR r2, [r10, #DANode_Size]
ADD r2, r1, r2 ; r1:=base r2:=top
CMP r5, r1
CMPCS r2, r5
LDRHI r1, [r10, #DANode_Number] ; number
MOVHI r0, #0 ; dynamic area
EXIT HI
MOV pc, lr ; not within this one
;**************************************************************************
;
; CheckAreaNumber - Try to find area with number r1
......
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