; 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.
;
; -*- Mode: Assembler -*-
;* Shared library kernel: unshared (Brazil/Arthur) version: initialisation
;* Lastedit: 08 Mar 90 14:25:15 by Harry Meekings *
;
; Copyright (C) Acorn Computers Ltd., 1988.
;

        IMPORT  |Image$$RO$$Base|
        IMPORT  |RTSK$$Data$$Base|
        IMPORT  |RTSK$$Data$$Limit|
        IMPORT  |Image$$RW$$Limit|
        EXPORT  |_kernel_entrypoint|
        IMPORT  |__root_stack_size|, WEAK
        ENTRY

|_kernel_entrypoint|
        LDR     v6, =|StaticData|
        SWI     GetEnv                  ; to decide heap limit
        MOV     r4, r1
        LDR     r1, =|Image$$RW$$Limit|
        LDR     r3, =|__root_stack_size|
        CMP     r3, #0
        LDRNE   r3, [r3]
        MOVEQ   r3, #RootStackSize
        ADD     r2, r3, r1
        STR     r3, [r1, #SC_size]

        ADR     r0, k_init_block
        MOV     r3, #0
        B       |_kernel_init|

k_init_block
        &       |Image$$RO$$Base|
        &       |RTSK$$Data$$Base|
        &       |RTSK$$Data$$Limit|

        END