📄 dabort.s
字号:
;
; Copyright (c) 2001. Samsung Electronics, co. ltd All rights reserved.
;
;
; Use of this source code is subject to the terms of the Microsoft end-user
; license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
; If you did not accept the terms of the EULA, you are not authorized to use
; this source code. For a copy of the EULA, please see the LICENSE.RTF on your
; install media.
;
; -*-Asm-*-
;
; $Revision: 1.2 $
; $Author: kwelton $
; $Date: 1999/10/25 21:40:54 $
;
; dabort.s - Data abort veneer
;
; Copyright (c) 1997 ARM Limited.
; All rights reserved.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Definitions that do not depend on assembly-time options
; =======================================================
;
; Error- and warning-related: the following are used as the first
; parameter to the INFO directive.
WARNING EQU 0
ERROR EQU 4
; Verbatim vertical bars in source text can cause problems in symbolic
; manipulations, due to their interactions with $-introduced symbol
; substitutions. To avoid this problem, we define a string variable
; here containing a vertical bar, which we will use instead of a
; literal vertical bar in most places.
GBLS VBar
VBar SETS "|"
; The following definition is to get around some rather over-
; enthusiastic assembler error messages. (For maximum future-proofing,
; it should really be set to "_fsxc", but the assembler objects to
; this at present...)
GBLS all_fields
all_fields SETS "_fc"
; ARM register numbers declared in such a way as to make code of the
; form R$ArithVar work.
R00000000 RN R0
R00000001 RN R1
R00000002 RN R2
R00000003 RN R3
R00000004 RN R4
R00000005 RN R5
R00000006 RN R6
R00000007 RN R7
R00000008 RN R8
R00000009 RN R9
R0000000A RN R10
R0000000B RN R11
R0000000C RN R12
R0000000D RN R13
R0000000E RN R14
R0000000F RN R15
; ARM PSR bits
I_bit EQU 0x80
T_bit EQU 0x20
; ARM processor mode numbers
Mode_User EQU 0x10
Mode_Supervisor EQU 0x13
Mode_Abort EQU 0x17
Mode_Undef EQU 0x1B
Mode_System EQU 0x1F
Mode_FullMask EQU 0x1F ; Mask to isolate full mode number
Mode_MainMask EQU 0x0F ; Mask to isolate non-26/32 mode no.
; ARM PC offsets.
PCOffset_DAbort EQU 8 ; R14_abort - address(aborting instr)
PCOffset_Undef EQU 4 ; R14_undef - address(undefined instr)
; ARM instruction bits. The "M bit" is one that conveniently
; distinguishes multiple transfers from single transfers for the
; purpose of the "early aborts" model and other purposes.
ARM_M_bit EQU 0x08000000 ;Multiple vs. single transfer
ARM_P_bit EQU 0x01000000 ;Pre- vs. post-indexing
ARM_U_bit EQU 0x00800000 ;Down vs. up
ARM_S_bit EQU 0x00400000 ;S bit in LDM/STM
ARM_W_bit EQU 0x00200000 ;Writeback vs. no writeback
ARM_L_bit EQU 0x00100000 ;Load vs. store
; ARM instruction fields.
ARM_Rn_pos EQU 16
ARM_Rn_mask EQU 0xF :SHL: ARM_Rn_pos
ARM_Rd_pos EQU 12
ARM_Rd_mask EQU 0xF :SHL: ARM_Rd_pos
ARM_Rm_pos EQU 0
ARM_Rm_mask EQU 0xF :SHL: ARM_Rm_pos
; Thumb instruction fields
Thumb_unusual_reg_pos EQU 8
Thumb_unusual_reg_mask EQU 0x7 :SHL: Thumb_unusual_reg_pos
Thumb_usual_Rm_pos EQU 6
Thumb_usual_Rm_mask EQU 0x7 :SHL: Thumb_usual_Rm_pos
Thumb_usual_Rn_pos EQU 3
Thumb_usual_Rn_mask EQU 0x7 :SHL: Thumb_usual_Rn_pos
Thumb_usual_Rd_pos EQU 0
Thumb_usual_Rd_mask EQU 0x7 :SHL: Thumb_usual_Rd_pos
Thumb_Imm5_pos EQU 6
Thumb_Imm5_mask EQU 0x1F :SHL: Thumb_Imm5_pos
Thumb_Imm8_pos EQU 0
Thumb_Imm8_mask EQU 0xFF :SHL: Thumb_Imm8_pos
Thumb_L_bit EQU 0x0800
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Processing of assembly-time options
; ===================================
;
; The following code supplies default values for assembly-time
; options, checks for illegal or meaningless combinations, etc.
;
; * 'VeneerEntry' is mandatory, and will be treated as a label. We
; reprocess it at this stage to ensure that it is surrounded by
; vertical bars. (These clean-ups and similar ones later are *not*
; intended to catch all possible syntactic errors - just to allow
; the symbol to be specified with or without the vertical bars and
; to catch the most obvious syntactic errors.)
[ :LNOT::DEF:VeneerEntry
GBLS VeneerEntry
VeneerEntry SETS ""
]
[ VeneerEntry = ""
INFO ERROR, \
"'VeneerEntry' has not been defined."
]
[ ((VeneerEntry:LEFT:1) = VBar) \
:LEOR: ((VeneerEntry:RIGHT:1) = VBar)
INFO ERROR, \
"Vertical bar error in 'VeneerEntry'"
]
[ (VeneerEntry:LEFT:1) <> VBar
VeneerEntry SETS VBar:CC:VeneerEntry:CC:VBar
]
; * 'AreaName' is optional, defaulting to "DataAbortVeneerCode". (Done
; via an empty string to also catch cases where it has been defined
; as the empty string.) It gets the usual vertical bar
; reprocessing.
[ :LNOT::DEF:AreaName
GBLS AreaName
AreaName SETS ""
]
[ AreaName = ""
AreaName SETS "DataAbortVeneerCode"
]
[ ((AreaName:LEFT:1) = VBar) \
:LEOR: ((AreaName:RIGHT:1) = VBar)
INFO ERROR, \
"Vertical bar error in 'AreaName'"
]
[ (AreaName:LEFT:1) <> VBar
AreaName SETS VBar:CC:AreaName:CC:VBar
]
; * 'BaseUpdated', 'BaseRestored' and 'EarlyAbort' are each optional,
; defaulting to {FALSE}. However, at least one of them must be
; {TRUE}, and we're interested in how many are {TRUE} for the
; purpose of determining whether we are supporting multiple abort
; models.
[ :LNOT::DEF:BaseUpdated
GBLL BaseUpdated
BaseUpdated SETL {FALSE}
]
[ :LNOT::DEF:BaseRestored
GBLL BaseRestored
BaseRestored SETL {FALSE}
]
[ :LNOT::DEF:EarlyAbort
GBLL EarlyAbort
EarlyAbort SETL {FALSE}
]
GBLA AbortModelCount
AbortModelCount SETA 0
[ BaseUpdated
AbortModelCount SETA AbortModelCount+1
]
[ BaseRestored
AbortModelCount SETA AbortModelCount+1
]
[ EarlyAbort
AbortModelCount SETA AbortModelCount+1
]
[ AbortModelCount = 0
INFO ERROR, \
"Must specify at least one abort model."
]
; * 'AbortModelVar' and 'AbortModelInit' can both default to the empty
; string regardless of the number of abort models supported. (In the
; case of 'AbortModelVar', this empty string will later generate an
; error if more than 1 abort model is specified.)
; If more than one abort model is specified, 'AbortModelVar' is
; mandatory.
[ :LNOT::DEF:AbortModelVar
GBLS AbortModelVar
AbortModelVar SETS ""
]
[ :LNOT::DEF:AbortModelInit
GBLS AbortModelInit
AbortModelInit SETS ""
]
[ (AbortModelCount > 1) :LAND: (AbortModelVar = "")
INFO ERROR, \
"'AbortModelVar' has not been defined."
]
[ AbortModelVar <> ""
[ ((AbortModelVar:LEFT:1) = VBar) \
:LEOR: ((AbortModelVar:RIGHT:1) = VBar)
INFO ERROR, \
"Vertical bar error in 'AbortModelVar'."
]
[ (AbortModelVar:LEFT:1) <> VBar
AbortModelVar SETS VBar:CC:AbortModelVar:CC:VBar
]
]
[ AbortModelInit <> ""
[ AbortModelVar = ""
INFO ERROR, \
"'AbortModelInit' without 'AbortModelVar'."
]
[ ((AbortModelInit:LEFT:1) = VBar) \
:LEOR: ((AbortModelInit:RIGHT:1) = VBar)
INFO ERROR, \
"Vertical bar error in 'AbortModelInit'."
]
[ (AbortModelInit:LEFT:1) <> VBar
AbortModelInit SETS VBar:CC:AbortModelInit:CC:VBar
]
]
; * 'HandlerCallStd' defaults to "APCS_NOSWST".
[ :LNOT::DEF:HandlerCallStd
GBLS HandlerCallStd
HandlerCallStd SETS ""
]
[ HandlerCallStd = ""
HandlerCallStd SETS "APCS_NOSWST"
]
GBLL CallStdKnown
CallStdKnown SETL {FALSE}
GBLL CallStdHasLabel
CallStdHasLabel SETL {FALSE}
[ HandlerCallStd = "APCS_NOSWST"
CallStdKnown SETL {TRUE}
CallStdHasLabel SETL {TRUE}
]
[ HandlerCallStd = "APCS_SWST"
CallStdKnown SETL {TRUE}
CallStdHasLabel SETL {TRUE}
]
[ HandlerCallStd = "APCS_MACRO"
CallStdKnown SETL {TRUE}
]
[ :LNOT:CallStdKnown
INFO ERROR, \
"Unknown 'HandlerCallStd' requested"
]
; * 'HandlerName' is mandatory, and undergoes the usual vertical bar
; clean-ups if it is to be treated as a label.
[ :LNOT::DEF:HandlerName
GBLS HandlerName
HandlerName SETS ""
]
[ HandlerName = ""
INFO ERROR, \
"'HandlerName' has not been defined."
]
[ CallStdHasLabel
[ ((HandlerName:LEFT:1) = VBar) \
:LEOR: ((HandlerName:RIGHT:1) = VBar)
INFO ERROR, \
"Vertical bar error in 'HandlerName'"
]
[ (HandlerName:LEFT:1) <> VBar
HandlerName SETS VBar:CC:HandlerName:CC:VBar
]
]
; * 'HandlerCallMode' defaults to "Supervisor" or "Abort", depending
; on the procedure calling standard used, and has three legal values
; - which we also translate here to mode numbers.
[ :LNOT::DEF:HandlerCallMode
GBLS HandlerCallMode
HandlerCallMode SETS ""
]
[ HandlerCallMode = ""
[ HandlerCallStd = "APCS_MACRO"
HandlerCallMode SETS "Abort"
|
HandlerCallMode SETS "Supervisor"
]
]
GBLL CallModeKnown
CallModeKnown SETL {FALSE}
[ HandlerCallMode = "Supervisor"
CallModeKnown SETL {TRUE}
Mode_Callee EQU Mode_Supervisor
]
[ HandlerCallMode = "System"
CallModeKnown SETL {TRUE}
Mode_Callee EQU Mode_System
]
[ HandlerCallMode = "Abort"
CallModeKnown SETL {TRUE}
Mode_Callee EQU Mode_Abort
]
[ :LNOT:CallModeKnown
INFO ERROR, \
"Unknown 'HandlerCallMode' requested"
]
; * The stack limit variable specified by "HandlerSL" is mandatory for
; the "APCS_SWST" procedure calling standard, unnecessary and unused
; otherwise.
[ :LNOT::DEF:HandlerSL
GBLS HandlerSL
HandlerSL SETS ""
]
[ HandlerCallStd = "APCS_SWST"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -