; Copyright 1996 Acorn Computers 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.
;

; > s.Options

AMBMagicNodeID     * &4E424D41        ;"AMBN"

AMBInitialMaxNodes * 256
AMBGrowMaxNodes    * 64               ;not used now AMBControl is in kernel


;Bin pages by physical address, for quick mapping from page number to
;physical address. Bin entry holds physical address of first page in bin.
;Bin size must be no bigger than minimum physical RAM fragment to be found
;in machine. eg. 512k size gives 128 pages in a bin, so shift of 7 and
;mask of &7F. Max practical bin size is 1M (mask must be immediate constant).
;
AMBPhysBinShift    * 7
AMBPhysBinMask     * &7F


ApplicationStart  * (32*1024)

AbsMaxAppSize     * AplWorkMaxSize                   ;application space limit for RISC OS
AbsMaxAppPages    * (AbsMaxAppSize:SHR:Log2PageSize) ;and same limit expressed in Pages

  [ ChocolateAMB
AMBMIRegWords      * (AbsMaxAppPages+31) :SHR: 5     ;no. of words for AMBMappedInRegister
                                                     ;convenient to set this at fixed max size
                                                     ;(only 896 bytes for 28Mb AppSpace)
  ]

;whether to check handles given to AMBControl - not very useful when in kernel
;
                    GBLL    ValidateAMBHandles
ValidateAMBHandles  SETL    {FALSE}


;performance enhancements originally introduced for Ursula OS
;
; ChocolateAMB       - if {FALSE}, disables all AMBControl crazy chocolate flavour enhancements
;
; AMB_LazyMapIn      - if {TRUE}, individual pages of a swapped-in task are only mapped in when
;                      necessary (happens via abort mechanism). This typically makes the swapping
;                      cost much lower and much less sensitive to large slot size. The worst case
;                      swapping cost is still good (abort mechanism cost is very small).
;                      Probably only worth supporting this on ARMs with simple instruction restart
;                      after abort (originally StrongARM revT or later for Ursula)
;
; AMB_LimpidFreePool - if {TRUE}, the cache(s) can be assumed to be clear with respect to the FreePool
;                      when AMBControl fetches pages from it. This allows AMBControl to avoid any
;                      cache clean/flush for moving pages out of the FreePool. This assumption is
;                      valid if either: FreePool pages are uncacheable; or FreePool pages are
;                      never used in situ; or FreePool pages are flushed after use in situ.
;
; AMB_ChocTrace      - if {TRUE}, keep trace info for some enhanced code calls and data (probably development only)

                    GBLL    AMB_LazyMapIn
                    GBLL    AMB_LimpidFreePool
                    GBLL    AMB_ChocTrace

AMB_LazyMapIn       SETL    {TRUE}  :LAND: ChocolateAMB
AMB_LimpidFreePool  SETL    {TRUE}  :LAND: ChocolateAMB   ;allowed because FreePool is currently marked uncacheable
                                                          ;current implementation assumes uncacheability as criterion

AMB_ChocTrace       SETL    {FALSE} :LAND: ChocolateAMB   ;development only

       END