Commit 9ced1eaf authored by Ben Avison's avatar Ben Avison Committed by ROOL

Add mixed-case versions of Hdr:Proc macros

Macros in this header file had inconsistent capitalisation. This is a legacy
of the earliest macros being `ENTRY` and `EXIT`. Macro names that are all
uppercase or all lowercase are a bad idea, because they can clash with opcodes
or assembler directives that are added at a later date: this is what happened
with `ENTRY` when objasm was developed, hence the introduction of the identical
`Entry` macro, and mass renaming across the source tree was required when it
switched to using objasm.

The other downside of all-uppercase or all-lowercase macro names is that it
makes it impossible to design a syntax colouring algorithm that is forward
compatible with new opcodes (and ARM continues to add new opcodes with almost
every new minor revision of the architecture).

Note that related macro names depend on the vintage of the header at which
they were introduced: compare `ALTENTRY` with `EntryS`.

Additional mixed-case versions of macros `ALTENTRY`, `EXIT`, `EXITS`, `EXITV`,
`EXITVC`, `EXITVS`, `FRAMLDR` and `FRAMSTR` are hereby introduced. The old
macro names are also retained (it would be a very large job to substitute them
throughout the source tree) but at least new code can now consistently use
mixed case.

The `FRAMCOM` and `FRAMSPL` macros are for internal use of the header file,
so uppercase versions of these did not need to be retained.

Also:
* Delete `ENTRY` macro: it's a long time since anything has been buildable
  using aasm, which is the only assembler that accepts this macro
* Correct cut-and-paste errors in the messages `ExitVC without EntryS` and
  `ExitVS without EntryS`

Version 2.83. Tagged as 'HdrSrc-2_83'
parent e691e97a
/* (2.82) /* (2.83)
* *
* 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 2.82 #define Module_MajorVersion_CMHG 2.83
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 08 Oct 2019 #define Module_Date_CMHG 12 Oct 2019
#define Module_MajorVersion "2.82" #define Module_MajorVersion "2.83"
#define Module_Version 282 #define Module_Version 283
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "08 Oct 2019" #define Module_Date "12 Oct 2019"
#define Module_ApplicationDate "08-Oct-19" #define Module_ApplicationDate "12-Oct-19"
#define Module_ComponentName "HdrSrc" #define Module_ComponentName "HdrSrc"
#define Module_FullVersion "2.82" #define Module_FullVersion "2.83"
#define Module_HelpVersion "2.82 (08 Oct 2019)" #define Module_HelpVersion "2.83 (12 Oct 2019)"
#define Module_LibraryVersionInfo "2:82" #define Module_LibraryVersionInfo "2:83"
...@@ -57,42 +57,6 @@ Proc_GetCPU32 SETS "" ...@@ -57,42 +57,6 @@ Proc_GetCPU32 SETS ""
; *** point so that an exit may be effected anywhere in the body without *** ; *** point so that an exit may be effected anywhere in the body without ***
; *** remembering how many (and which) registers to destack and ADJSP. *** ; *** remembering how many (and which) registers to destack and ADJSP. ***
; *** Also ensures that the code entry label is word-aligned. *** ; *** Also ensures that the code entry label is word-aligned. ***
; *****************************************************************************
MACRO
$label ENTRY $reglist,$framesize
ALIGN
Proc_RegList SETS "$reglist"
[ "$framesize" = ""
Proc_LocalStack SETA 0
|
Proc_LocalStack SETA $framesize
]
Proc_SavedCPSR SETL {FALSE}
Proc_RegOffset SETA Proc_LocalStack
[ "$label" <> ""
[ Proc_Debug
B $label
DCB "$label", 0
ALIGN
]
$label ROUT
]
[ "$Proc_RegList" = ""
Push lr
|
Push "$Proc_RegList, lr"
]
[ Proc_LocalStack <> 0
SUB sp, sp, #Proc_LocalStack
]
MEND
; *****************************************************************************
; *** Keep a note of local stack and register use at the routine entry ***
; *** point so that an exit may be effected anywhere in the body without ***
; *** remembering how many (and which) registers to destack and ADJSP. ***
; *** Also ensures that the code entry label is word-aligned. ***
; *** This is a copy of the above macro for objasm use. ***
; ***************************************************************************** ; *****************************************************************************
MACRO MACRO
$label Entry $reglist,$framesize $label Entry $reglist,$framesize
...@@ -171,7 +135,7 @@ $label ROUT ...@@ -171,7 +135,7 @@ $label ROUT
; *** Stacks the same registers as does the corresponding ENTRY macro *** ; *** Stacks the same registers as does the corresponding ENTRY macro ***
; ***************************************************************************** ; *****************************************************************************
MACRO MACRO
$label ALTENTRY $label AltEntry
ALIGN ALIGN
[ "$label" <> "" [ "$label" <> ""
[ Proc_Debug [ Proc_Debug
...@@ -195,11 +159,16 @@ $label ; NOROUT ...@@ -195,11 +159,16 @@ $label ; NOROUT
] ]
MEND MEND
MACRO
$label ALTENTRY
$label AltEntry
MEND
; ***************************************************************************** ; *****************************************************************************
; *** Exit procedure, restore stack and saved registers to values on entry *** ; *** Exit procedure, restore stack and saved registers to values on entry ***
; ***************************************************************************** ; *****************************************************************************
MACRO MACRO
$label EXIT $cond $label Exit $cond
$label $label
[ Proc_SavedCPSR [ Proc_SavedCPSR
ADD$cond sp, sp, #Proc_LocalStack + 4 ADD$cond sp, sp, #Proc_LocalStack + 4
...@@ -215,12 +184,17 @@ $label ...@@ -215,12 +184,17 @@ $label
] ]
MEND MEND
MACRO
$label EXIT $cond
$label Exit $cond
MEND
; ***************************************************************************** ; *****************************************************************************
; *** Exit procedure : restore stack and saved registers + psr to values on *** ; *** Exit procedure : restore stack and saved registers + psr to values on ***
; *** entry. No longer copes with 3um ARM bug fix (world is 2um'ised) *** ; *** entry. No longer copes with 3um ARM bug fix (world is 2um'ised) ***
; ***************************************************************************** ; *****************************************************************************
MACRO MACRO
$label EXITS $cond,$fields $label ExitS $cond,$fields
$label $label
[ Proc_SavedCPSR [ Proc_SavedCPSR
[ "$cond" <> "AL" :LAND: "$cond" <> "" [ "$cond" <> "AL" :LAND: "$cond" <> ""
...@@ -245,7 +219,7 @@ $label ...@@ -245,7 +219,7 @@ $label
| |
; 26-bit version ; 26-bit version
[ No26bitCode [ No26bitCode
! 1, "EXITS without EntryS" ! 1, "ExitS without EntryS"
] ]
[ Proc_LocalStack <> 0 [ Proc_LocalStack <> 0
ADD$cond sp, sp, #Proc_LocalStack ADD$cond sp, sp, #Proc_LocalStack
...@@ -258,12 +232,17 @@ $label ...@@ -258,12 +232,17 @@ $label
] ]
MEND MEND
MACRO
$label EXITS $cond,$fields
$label ExitS $cond,$fields
MEND
; ***************************************************************************** ; *****************************************************************************
; *** Exit procedure : restore stack and saved registers + psr (except V) *** ; *** Exit procedure : restore stack and saved registers + psr (except V) ***
; *** to values on entry. Return with V unaltered from current state. *** ; *** to values on entry. Return with V unaltered from current state. ***
; ***************************************************************************** ; *****************************************************************************
MACRO MACRO
$label EXITV $fields $label ExitV $fields
$label $label
[ Proc_LocalStack <> 0 [ Proc_LocalStack <> 0
ADD sp, sp, #Proc_LocalStack ADD sp, sp, #Proc_LocalStack
...@@ -284,7 +263,7 @@ $label ...@@ -284,7 +263,7 @@ $label
] ]
| |
[ No26bitCode [ No26bitCode
! 1, "EXITV without EntryS" ! 1, "ExitV without EntryS"
] ]
[ "$Proc_RegList" = "" [ "$Proc_RegList" = ""
LDR lr, [sp], #4 LDR lr, [sp], #4
...@@ -296,12 +275,17 @@ $label ...@@ -296,12 +275,17 @@ $label
] ]
MEND MEND
MACRO
$label EXITV $fields
$label ExitV $fields
MEND
; ***************************************************************************** ; *****************************************************************************
; *** Exit procedure : restore stack and saved registers + psr (except V) *** ; *** Exit procedure : restore stack and saved registers + psr (except V) ***
; *** to values on entry. Return with V clear. *** ; *** to values on entry. Return with V clear. ***
; ***************************************************************************** ; *****************************************************************************
MACRO MACRO
$label EXITVC $fields $label ExitVC $fields
$label $label
[ Proc_LocalStack <> 0 [ Proc_LocalStack <> 0
ADD sp, sp, #Proc_LocalStack ADD sp, sp, #Proc_LocalStack
...@@ -321,7 +305,7 @@ $label ...@@ -321,7 +305,7 @@ $label
] ]
| |
[ No26bitCode [ No26bitCode
! 1, "EXITV without EntryS" ! 1, "ExitVC without EntryS"
] ]
[ "$Proc_RegList" = "" [ "$Proc_RegList" = ""
LDR lr, [sp], #4 LDR lr, [sp], #4
...@@ -332,12 +316,17 @@ $label ...@@ -332,12 +316,17 @@ $label
] ]
MEND MEND
MACRO
$label EXITVC $fields
$label ExitVC $fields
MEND
; ***************************************************************************** ; *****************************************************************************
; *** Exit procedure : restore stack and saved registers + psr (except V) *** ; *** Exit procedure : restore stack and saved registers + psr (except V) ***
; *** to values on entry. Return with V set. *** ; *** to values on entry. Return with V set. ***
; ***************************************************************************** ; *****************************************************************************
MACRO MACRO
$label EXITVS $fields $label ExitVS $fields
$label $label
[ Proc_LocalStack <> 0 [ Proc_LocalStack <> 0
ADD sp, sp, #Proc_LocalStack ADD sp, sp, #Proc_LocalStack
...@@ -357,7 +346,7 @@ $label ...@@ -357,7 +346,7 @@ $label
] ]
| |
[ No26bitCode [ No26bitCode
! 1, "EXITV without EntryS" ! 1, "ExitVS without EntryS"
] ]
[ "$Proc_RegList" = "" [ "$Proc_RegList" = ""
LDR lr, [sp], #4 LDR lr, [sp], #4
...@@ -368,6 +357,11 @@ $label ...@@ -368,6 +357,11 @@ $label
] ]
MEND MEND
MACRO
$label EXITVS $fields
$label ExitVS $fields
MEND
; ***************************************************************************** ; *****************************************************************************
; *** Restore stack and saved registers, lr to values on entry to procedure *** ; *** Restore stack and saved registers, lr to values on entry to procedure ***
; ***************************************************************************** ; *****************************************************************************
...@@ -428,22 +422,22 @@ $label ...@@ -428,22 +422,22 @@ $label
; ***************************************************************************** ; *****************************************************************************
; *** FRAMLDR/FRAMSTR macros *** ; *** FramLDR/FramSTR macros ***
; *** That let you access the register values stacked on Entry *** ; *** That let you access the register values stacked on Entry ***
; *** to replace LDR r1, [sp, #Proc_LocalStack + 1*4] *** ; *** to replace LDR r1, [sp, #Proc_LocalStack + 1*4] ***
; *** *** ; *** ***
; *** The new macros allow non-continuous regs to be used, and will generate*** ; *** The new macros allow non-continuous regs to be used, and will generate***
; *** an error if you try to access a register not stored on the stack *** ; *** an error if you try to access a register not stored on the stack ***
; *** *** ; *** ***
; *** FRAMLDR r0 load r0 stored on stack frame by Entry macro *** ; *** FramLDR r0 load r0 stored on stack frame by Entry macro ***
; *** FRAMLDR r5,CS load r5 from stack frame if CS *** ; *** FramLDR r5,CS load r5 from stack frame if CS ***
; *** FRAMLDR r0,,r8 load r8 on stack frame into r0 *** ; *** FramLDR r0,,r8 load r8 on stack frame into r0 ***
; *** FRAMLDR r0,HI,r10 load r10 on stack frame into r0 if HI *** ; *** FramLDR r0,HI,r10 load r10 on stack frame into r0 if HI ***
; *** *** ; *** ***
; *** A particularly useful way of using this macro is: *** ; *** A particularly useful way of using this macro is: ***
; *** FRAMSTR r8,,r0 change r0 value that will be restored on EXIT *** ; *** FramSTR r8,,r0 change r0 value that will be restored on Exit ***
; *** ...more code *** ; *** ...more code ***
; *** EXIT *** ; *** Exit ***
; ***************************************************************************** ; *****************************************************************************
GBLA Fram_SpecRegOffset ;offset to load/store particular reg GBLA Fram_SpecRegOffset ;offset to load/store particular reg
...@@ -452,7 +446,7 @@ $label ...@@ -452,7 +446,7 @@ $label
GBLS Fram_LowRegStr GBLS Fram_LowRegStr
MACRO MACRO
FRAMSPL $origvar,$newvar,$sep FramSPL $origvar,$newvar,$sep
$newvar SETS "" $newvar SETS ""
WHILE (($origvar):CC:" ":LEFT:1 <> "$sep"):LAND:($origvar >"") WHILE (($origvar):CC:" ":LEFT:1 <> "$sep"):LAND:($origvar >"")
...@@ -470,7 +464,7 @@ $origvar SETS $origvar:RIGHT:(:LEN:$origvar-1) ...@@ -470,7 +464,7 @@ $origvar SETS $origvar:RIGHT:(:LEN:$origvar-1)
MEND MEND
MACRO MACRO
FRAMCOM $dstreg,$framereg FramCOM $dstreg,$framereg
LCLA actframe LCLA actframe
LCLA counter LCLA counter
...@@ -483,13 +477,13 @@ actframe SETA $framereg ...@@ -483,13 +477,13 @@ actframe SETA $framereg
Fram_CopyRegs SETS Proc_RegList Fram_CopyRegs SETS Proc_RegList
WHILE Fram_CopyRegs > "" WHILE Fram_CopyRegs > ""
FRAMSPL "Fram_CopyRegs","Fram_RegStr","," FramSPL "Fram_CopyRegs","Fram_RegStr",","
;regno =r0-r8 or a single reg r5 ;regno =r0-r8 or a single reg r5
LCLA lowreg LCLA lowreg
LCLA highreg LCLA highreg
FRAMSPL "Fram_RegStr","Fram_LowRegStr","-" FramSPL "Fram_RegStr","Fram_LowRegStr","-"
lowreg SETA $Fram_LowRegStr lowreg SETA $Fram_LowRegStr
[ Fram_RegStr ="" [ Fram_RegStr =""
highreg SETA lowreg highreg SETA lowreg
...@@ -528,16 +522,26 @@ tempstr SETS "1" ...@@ -528,16 +522,26 @@ tempstr SETS "1"
MEND MEND
MACRO MACRO
$label FRAMLDR $dstreg,$cond,$framereg $label FramLDR $dstreg,$cond,$framereg
$label FRAMCOM $dstreg,$framereg $label FramCOM $dstreg,$framereg
LDR$cond $dstreg,[sp ,#Proc_RegOffset +Fram_SpecRegOffset] LDR$cond $dstreg,[sp ,#Proc_RegOffset +Fram_SpecRegOffset]
MEND MEND
MACRO MACRO
$label FRAMSTR $dstreg,$cond,$framereg $label FRAMLDR $dstreg,$cond,$framereg
$label FRAMCOM $dstreg,$framereg $label FramLDR $dstreg,$cond,$framereg
MEND
MACRO
$label FramSTR $dstreg,$cond,$framereg
$label FramCOM $dstreg,$framereg
STR$cond $dstreg,[sp ,#Proc_RegOffset +Fram_SpecRegOffset] STR$cond $dstreg,[sp ,#Proc_RegOffset +Fram_SpecRegOffset]
MEND MEND
MACRO
$label FRAMSTR $dstreg,$cond,$framereg
$label FramSTR $dstreg,$cond,$framereg
MEND
; ***************************************************************************** ; *****************************************************************************
OPT OldOpt OPT OldOpt
......
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