CastleMacros 1.47 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
; Copyright 2012 Castle Technology 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.
;

        MACRO
        HALEntry $name
Jeffrey Lee's avatar
Jeffrey Lee committed
18 19 20 21 22
        ASSERT  (. - $table) / 4 = EntryNo_$name
        DCD     $name - $table
        MEND

        MACRO
Ben Avison's avatar
Ben Avison committed
23
        VarEntry $name
Jeffrey Lee's avatar
Jeffrey Lee committed
24 25 26
        ASSERT  (. - $table) / 4 = EntryNo_$name
      [ $table_idx == 0
        DCD     ARM11_$name - $table
Ben Avison's avatar
Ben Avison committed
27
      ELIF $table_idx == 1
Jeffrey Lee's avatar
Jeffrey Lee committed
28
        DCD     QA7_$name - $table
Ben Avison's avatar
Ben Avison committed
29 30
      |
        DCD     VC6_$name - $table
Jeffrey Lee's avatar
Jeffrey Lee committed
31
      ]
32 33 34 35
        MEND

        MACRO
        NullEntry
Jeffrey Lee's avatar
Jeffrey Lee committed
36
        DCD     HAL_Null - $table
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
        MEND

        MACRO
        CallOSM $entry, $reg
        LDR     ip, [v8, #$entry*4]
        MOV     lr, pc
        ADD     pc, v8, ip
        MEND

        MACRO
        CallOS  $entry, $tailcall
        ASSERT  $entry <= HighestOSEntry
 [ "$tailcall"=""
        MOV     lr, pc
 |
   [ "$tailcall"<>"tailcall"
        ! 0, "Unrecognised parameter to CallOS"
   ]
 ]
        LDR     pc, OSentries + 4*$entry
        MEND

        END