📄 valutil-macros.h.s
字号:
;*******************************************************************************
;*
;* The confidential and proprietary information contained in this file may
;* only be used by a person authorised under and to the extent permitted
;* by a subsisting licensing agreement from ARM Limited.
;*
;* (C) COPYRIGHT 1998-1999 ARM Limited.
;* ALL RIGHTS RESERVED
;*
;* This entire notice must be reproduced on all copies of this file
;* and copies of this file may only be made by a person if such person is
;* permitted to do so under the terms of a subsisting license agreement
;* from ARM Limited.
;*
;* Validation Suite Utility Macros
;* ===============================
;*
;* Origin: ARM9XXT Validation Suite
;* Author: Mark RISON, 1998-05-22
;* $Author: ostephen $
;* $Revision: 1.1 $
;* $Date: Sat Sep 18 03:11:00 1999 $
;*
;*******************************************************************************
;* Description: This INCLUDE file contains a set of utility macros used by the
;* validation test programs to perform various common operations.
;*
;* Contents: BLOCK_COPY4
;* BLOCK_COPY8
;* NOPISE
;* NOPISE2
;* ZEROISE
;* SETUP_AP
;* CHECK_AP
;* REPORT_CHECK_FAIL
;* PRESERVE
;* RESTORE
;*
;*******************************************************************************
TTL ValUtil-Macros, utility macros for validation tests
; Prevent file being included twice
[ :DEF: Got_ValUtil_Macros
! 0, "\n\tWARNING: ValUtil-Macros already included."
|
GBLL Got_ValUtil_Macros
;------------------------------------------------------------------------------
;
; Macro: $label BLOCK_COPY4 $source, $dest, $pres
;
; Function: Copies R0 quadwords from $source to $dest.
;
; Internally: All registers preserved, except for flags, unless $pres is "NOPRESERVE".
;
MACRO
$label BLOCK_COPY4 $source, $dest, $pres
$label LOCAL
[ "$pres" /= "NOPRESERVE"
PRESERVE 0, 7
]
LDR r1, =$source
LDR r2, =$dest
copyloop$l
LDMIA r1!, {r4 - r7}
STMIA r2!, {r4 - r7}
SUBS r0, r0, #1
BNE copyloop$l
B end$l
LTORG
end$l
[ "$pres" /= "NOPRESERVE"
RESTORE 0, 7
]
LOCAL_END
MEND
;------------------------------------------------------------------------------
;
; Macro: $label BLOCK_COPY8 $source, $dest, $pres
;
; Function: Copies R0 octwords from $source to $dest.
;
; Internally: All registers preserved, except for flags, unless $pres is "NOPRESERVE".
;
MACRO
$label BLOCK_COPY8 $source, $dest, $pres
$label LOCAL
[ "$pres" /= "NOPRESERVE"
PRESERVE 0, 11
]
LDR r1, =$source
LDR r2, =$dest
copyloop$l
LDMIA r1!, {r4 - r11}
STMIA r2!, {r4 - r11}
SUBS r0, r0, #1
BNE copyloop$l
B end$l
LTORG
end$l
[ "$pres" /= "NOPRESERVE"
RESTORE 0, 11
]
LOCAL_END
MEND
;------------------------------------------------------------------------------
;
; Macro: $label NOPISE $dest, $step
;
; Function: Writes out R0 NOPs every $step words starting at $dest.
;
; Internally: All registers preserved, except for flags.
;
MACRO
$label NOPISE $dest, $step
$label LOCAL
PRESERVE 0, 3
ADR r2, nop_inst$l
LDR r3, [r2]
LDR r1, =$dest
copy_loop$l
STR r3, [r1], #$step * 4
SUBS r0, r0, #1
BNE copy_loop$l
B end$l
LTORG
nop_inst$l
NOP
end$l
RESTORE 0, 3
LOCAL_END
MEND
;------------------------------------------------------------------------------
;
; Macro: $label NOPISE2 $dest, $step
;
; Function: Writes out R0 NOP pairs every $step words starting at $dest.
;
; Internally: All registers preserved, except for flags.
;
MACRO
$label NOPISE2 $dest, $step
$label LOCAL
PRESERVE 0, 3
ADR r2, nop_inst$l
LDR r3, [r2]
LDR r1, =$dest
copy_loop$l
STR r3, [r1], #4
STR r3, [r1], #$step * 4 - 4
SUBS r0, r0, #1
BNE copy_loop$l
B end$l
LTORG
nop_inst$l
NOP
end$l
RESTORE 0, 3
LOCAL_END
MEND
;------------------------------------------------------------------------------
;
; Macro: $label ZEROISE $dest, $step, $load
;
; Function: Writes out R0 zeroes every $step words starting at $dest.
; If $load is "LOAD" then ensure in cache by loading first.
;
; Internally: All registers preserved, except for flags.
;
MACRO
$label ZEROISE $dest, $step, $load
$label LOCAL
PRESERVE 0, 3
MOV r2, #0
LDR r1, =$dest
copy_loop$l
[ "$load" = "LOAD"
LDR r3, [r1]
]
STR r2, [r1], #$step * 4
SUBS r0, r0, #1
BNE copy_loop$l
B end$l
LTORG
end$l
RESTORE 0, 3
LOCAL_END
MEND
;------------------------------------------------------------------------------
;
; Macro: $label SETUP_AP $seqbase, $dest
;
; Function: This macro writes an arithmetic progression with R0 terms
; with base $seqbase and increment 1 to memory at $dest.
; This data is guaranteed to be written to memory since
; the DCache is disabled while writing.
;
; Internally: All registers preserved, except for flags.
;
MACRO
$label SETUP_AP $seqbase, $dest
$label LOCAL
PRESERVE 0, 2
DCACHE_OFF r2
LDR r2, =$seqbase
ADD r0, r0, r2
LDR r1, =$dest
Loop$l
STR r2, [r1], #4
ADD r2, r2, #1
CMP r0, r2
BNE Loop$l
DCACHE_ON r2
B end$l
LTORG
end$l
RESTORE 0, 2
LOCAL_END
MEND
;------------------------------------------------------------------------------
;
; Macro: $label CHECK_AP $seqbase, $dest, $failmacro
;
; Function: This macro verifies the presence of an arithmetic progression
; with R0 terms with base $seqbase and increment 1 at $dest.
; If a discrepancy is observed, the $failmacro macro is
; executed; on entry r1 contains the fail address, r2 contains
; the expected term and r3 contains the actual term;
; the macro is passed $label as its argument. This macro
; may corrupt r0.
; If $failmacro is not specified a default macro,
; REPORT_CHECK_FAIL, is used.
;
; Internally: All registers preserved, except for flags.
;
MACRO
$label CHECK_AP $seqbase, $dest, $failmacro
$label LOCAL
PRESERVE 0, 3
LDR r2, =$seqbase
ADD r0, r0, r2
LDR r1, =$dest
Loop$l
LDR r3, [r1], #4
CMP r3, r2
BNE fail$l
ADD r2, r2, #1
CMP r0, r2
BNE Loop$l
B end$l
LTORG
fail$l
SUB r1, r1, #4 ; Correct for post-increment in LDR
[ "$failmacro" /= ""
$failmacro $label
|
REPORT_CHECK_FAIL $label
]
end$l
PRINTF "$label done\n"
RESTORE 0, 3
LOCAL_END
MEND
;------------------------------------------------------------------------------
;
; Macro: REPORT_CHECK_FAIL $label
;
; Function: Called from CHECK_AP to report check failure.
; A diagnostic is printed and the failflag is set.
;
; Internally: All registers preserved, except for flags and r0.
;
MACRO
REPORT_CHECK_FAIL $label
PART_MSG "$label failed: failure at address 0x"
PHEX_REG r1
PART_MSG "\tTerm was 0x"
PHEX_REG r3
PART_MSG " but should have been 0x"
PHEX_REG r2
PART_MSG "\n"
ADRL r0, failflag
STR pc, [r0] ; Note failure
MEND
;------------------------------------------------------------------------------
;
; Macro: $label PRESERVE $firstreg, $lastreg, $store
;
; Function: Stores registers number $firstreg to $lastreg away,
; for later restoration. If APCS is {TRUE} then the
; registers are stored on the stack, otherwise the
; registers are stored locally (which makes the code
; non-ROMable). In the latter case $store can be used
; to specify the name of the store area; if it is left
; blank then store$l is used (this presupposes the use
; of the LOCAL macro).
;
; Internally: All registers preserved.
;
MACRO
$label PRESERVE $firstreg, $lastreg, $store
ASSERT $lastreg < 16
ASSERT $firstreg < 16
ASSERT $firstreg <= $lastreg
$label
[ APCS
STMFD sp!, {r$firstreg - r$lastreg}
|
B %FT10
[ "$store" = ""
store$l
|
$store
]
% ($lastreg - $firstreg + 1) * 4
10
LCLA regcount
LCLS register
regcount SETA $firstreg
WHILE regcount <= $lastreg
[ regcount < 10
register SETS :CHR:(regcount + 48)
|
register SETS "1":CC::CHR:(regcount + 38)
]
[ "$store" = ""
STR r$register, store$l + (regcount - $firstreg) * 4
|
STR r$register, $store + (regcount - $firstreg) * 4
]
regcount SETA regcount + 1
WEND
]
MEND
;------------------------------------------------------------------------------
;
; Macro: $label RESTORE $firstreg, $lastreg, $store
;
; Function: Restores registers preserved using PRESERVE.
; The same arguments as for the corresponding PRESERVE
; should be used.
;
; Internally: All non-restored registers preserved.
;
MACRO
$label RESTORE $firstreg, $lastreg, $store
ASSERT $lastreg < 15
ASSERT $firstreg < 15
ASSERT $firstreg <= $lastreg
$label
[ APCS
LDMFD sp!, {r$firstreg - r$lastreg}
|
LCLA regcount
LCLS register
regcount SETA $firstreg
WHILE regcount <= $lastreg
[ regcount < 10
register SETS :CHR:(regcount + 48)
|
register SETS "1":CC::CHR:(regcount + 38)
]
[ "$store" = ""
LDR r$register, store$l + (regcount - $firstreg) * 4
|
LDR r$register, $store + (regcount - $firstreg) * 4
]
regcount SETA regcount + 1
WEND
]
MEND
;********************************************************************************
] ; end of [ :DEF: Got_ValUtil_Macros
;********************************************************************************
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -