Commit 2991e2df authored by Ben Avison's avatar Ben Avison Committed by ROOL
Browse files

Mirror OS_AMBControl changes from Pyromaniac

* Create new header file defining symbolic name for OS_AMBControl
  reason codes and flags
* Implement OS_AMBControl 9 (used to determine required size of buffer
  passed to OS_AMBControl 8 - potential thread safety issue not addressed)
* Return allocated error numbers in various failure cases

Version 6.38. Tagged as 'Kernel-6_38'
parent b5d0e2dc
...@@ -32,7 +32,8 @@ ASFLAGS += -PD "FreezeDevRel SETL {${FREEZE_DEV_REL}}" ...@@ -32,7 +32,8 @@ ASFLAGS += -PD "FreezeDevRel SETL {${FREEZE_DEV_REL}}"
CUSTOMROM = custom CUSTOMROM = custom
CUSTOMEXP = custom CUSTOMEXP = custom
CUSTOMSA = custom CUSTOMSA = custom
EXPORTS = ${EXP_HDR}.DBellDevice \ EXPORTS = ${EXP_HDR}.AMBControl \
${EXP_HDR}.DBellDevice \
${EXP_HDR}.EnvNumbers \ ${EXP_HDR}.EnvNumbers \
${EXP_HDR}.HALDevice \ ${EXP_HDR}.HALDevice \
${EXP_HDR}.HALEntries \ ${EXP_HDR}.HALEntries \
...@@ -98,6 +99,9 @@ ${KERNEL_MODULE}: ${ROM_OBJECT} ${DIRS} ...@@ -98,6 +99,9 @@ ${KERNEL_MODULE}: ${ROM_OBJECT} ${DIRS}
export: ${EXPORTS} export: ${EXPORTS}
@${ECHO} ${COMPONENT}: export complete @${ECHO} ${COMPONENT}: export complete
${EXP_HDR}.AMBControl: hdr.AMBControl
${CP} hdr.AMBControl $@ ${CPFLAGS}
${EXP_HDR}.EnvNumbers: hdr.EnvNumbers ${EXP_HDR}.EnvNumbers: hdr.EnvNumbers
${CP} hdr.EnvNumbers $@ ${CPFLAGS} ${CP} hdr.EnvNumbers $@ ${CPFLAGS}
......
...@@ -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.37" Module_MajorVersion SETS "6.38"
Module_Version SETA 637 Module_Version SETA 638
Module_MinorVersion SETS "" Module_MinorVersion SETS ""
Module_Date SETS "23 Mar 2020" Module_Date SETS "23 May 2020"
Module_ApplicationDate SETS "23-Mar-20" Module_ApplicationDate SETS "23-May-20"
Module_ComponentName SETS "Kernel" Module_ComponentName SETS "Kernel"
Module_FullVersion SETS "6.37" Module_FullVersion SETS "6.38"
Module_HelpVersion SETS "6.37 (23 Mar 2020)" Module_HelpVersion SETS "6.38 (23 May 2020)"
END END
/* (6.37) /* (6.38)
* *
* 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.37 #define Module_MajorVersion_CMHG 6.38
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 23 Mar 2020 #define Module_Date_CMHG 23 May 2020
#define Module_MajorVersion "6.37" #define Module_MajorVersion "6.38"
#define Module_Version 637 #define Module_Version 638
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "23 Mar 2020" #define Module_Date "23 May 2020"
#define Module_ApplicationDate "23-Mar-20" #define Module_ApplicationDate "23-May-20"
#define Module_ComponentName "Kernel" #define Module_ComponentName "Kernel"
#define Module_FullVersion "6.37" #define Module_FullVersion "6.38"
#define Module_HelpVersion "6.37 (23 Mar 2020)" #define Module_HelpVersion "6.38 (23 May 2020)"
#define Module_LibraryVersionInfo "6:37" #define Module_LibraryVersionInfo "6:38"
; Copyright 2020 RISC OS Open Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
OldOpt SETA {OPT}
OPT OptNoList+OptNoP1List
; Reason codes to OS_AMBControl
^ 0
AMBControl_Allocate # 1 ; 0 R0,R1->R1,R2
AMBControl_Deallocate # 1 ; 1 R0,R2->
AMBControl_GrowShrink # 1 ; 2 R0,R1,R2->R1,R2,R3
AMBControl_MapSlot # 1 ; 3 R0,R1,R2,R3,R4->
AMBControl_ReadInfo # 1 ; 4 R0,R2->R1,R3
AMBControl_Laziness # 1 ; 5 R0,R1->R1
# 1 ; 6 reserved
# 1 ; 7 reserevd
AMBControl_SystemInfo # 1 ; 8 R0,R1->
AMBControl_CurrentInfo # 1 ; 9 R0->R2,R3
; Flag bits in OS_AMBControl 3
AMBControl_MapSlot_MapSome * 1 :SHL: 8
OPT OldOpt
END
...@@ -96,7 +96,7 @@ badhandle ...@@ -96,7 +96,7 @@ badhandle
ADR R0,err_badhandle ADR R0,err_badhandle
B SLVK_SetV B SLVK_SetV
err_badhandle err_badhandle
DCD 0 DCD ErrorNumber_AMBBadHandle
DCB "AMBControl bad handle",0 DCB "AMBControl bad handle",0
ALIGN ALIGN
] ]
......
...@@ -92,7 +92,7 @@ growshrink ...@@ -92,7 +92,7 @@ growshrink
CMP R1,#0 ; if shrunk to zero CMP R1,#0 ; if shrunk to zero
LDR R2,[R2,#AMBNode_handle-AMBNode_DANode] LDR R2,[R2,#AMBNode_handle-AMBNode_DANode]
BNE gs_done BNE gs_done
MOV R0,#1 MOV R0,#AMBControl_Deallocate
SWI XOS_AMBControl ; then completely free the node SWI XOS_AMBControl ; then completely free the node
MOV R2,#0 MOV R2,#0
STR R2,[SP,#4] ;poke freed handle to saved R2 STR R2,[SP,#4] ;poke freed handle to saved R2
......
...@@ -116,6 +116,7 @@ reasons0 ...@@ -116,6 +116,7 @@ reasons0
B reserved ;6 B reserved ;6
B reserved ;7 B reserved ;7
B mjs_info ;8 - system reason code, dumps info to buffer B mjs_info ;8 - system reason code, dumps info to buffer
B current_info ;9
reasons1 reasons1
ADR R0,err_badreason ADR R0,err_badreason
B SLVK_SetV B SLVK_SetV
...@@ -147,7 +148,7 @@ laziness ROUT ...@@ -147,7 +148,7 @@ laziness ROUT
CMP R3,#0 CMP R3,#0
BEQ %FT10 BEQ %FT10
Push "R0-R3" Push "R0-R3"
MOV R0,#3 MOV R0,#AMBControl_MapSlot
MOV R1,#-1 MOV R1,#-1
LDR R2,[R3,#AMBNode_handle] LDR R2,[R3,#AMBNode_handle]
SWI XOS_AMBControl ;map out current node SWI XOS_AMBControl ;map out current node
...@@ -157,7 +158,7 @@ laziness ROUT ...@@ -157,7 +158,7 @@ laziness ROUT
CMP R3,#0 CMP R3,#0
BEQ %FT20 BEQ %FT20
Push "R0-R3" Push "R0-R3"
MOV R0,#3 MOV R0,#AMBControl_MapSlot
MOV R1,#0 MOV R1,#0
LDR R2,[R3,#AMBNode_handle] LDR R2,[R3,#AMBNode_handle]
SWI XOS_AMBControl ;map in current node SWI XOS_AMBControl ;map in current node
...@@ -212,6 +213,24 @@ mjs_info ...@@ -212,6 +213,24 @@ mjs_info
Pull "R1-R7,LR" Pull "R1-R7,LR"
B SLVK B SLVK
;entry: R0=9 (reason)
;exit: R2=current AMB id, R3=number of tasks present (use this to size the buffer passed to AMBControl 8)
current_info
Push "R7,LR"
LDR R2,AMBMappedInNode
CMP R2,#0
LDRNE R2,[R2,#AMBNode_handle]
MOV R3, #0
ADR LR,AMBAnchorNode
MOV R7,LR
01
LDR LR,[LR,#AMBNode_next]
CMP LR,R7
ADDNE R3,R3,#1
BNE %BT01
Pull "R7,LR"
B SLVK
reserved reserved
ADR R0,err_reserved ADR R0,err_reserved
B SLVK_SetV B SLVK_SetV
...@@ -219,17 +238,17 @@ reserved ...@@ -219,17 +238,17 @@ reserved
;;; errors (sod internationalisation) ;;; errors (sod internationalisation)
err_badreason err_badreason
DCD 0 DCD ErrorNumber_AMBBadReason
DCB "bad AMBControl reason code",0 DCB "bad AMBControl reason code",0
ALIGN ALIGN
err_reserved err_reserved
DCD 0 DCD ErrorNumber_AMBBadReason
DCB "reserved AMBControl reason code",0 DCB "reserved AMBControl reason code",0
ALIGN ALIGN
err_nomorehandles err_nomorehandles
DCD 0 DCD ErrorNumber_AMBNoHandles
DCB "AMBControl handles exhausted",0 DCB "AMBControl handles exhausted",0
ALIGN ALIGN
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
; ;
mapslot ROUT mapslot ROUT
TST R0,#&100 ;if bit 8 set, then mapsome TST R0,#AMBControl_MapSlot_MapSome ;if bit 8 set, then mapsome
BNE mapsome BNE mapsome
Push "R0-R6,LR" Push "R0-R6,LR"
......
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
GET Hdr:OSMisc GET Hdr:OSMisc
GET Hdr:OSRSI6 GET Hdr:OSRSI6
GET Hdr:PL310 GET Hdr:PL310
GET Hdr:AMBControl
; now the main parts of the MOS ; now the main parts of the MOS
......
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