⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 handle.s

📁 软中断处理程序
💻 S
字号:
;/***************************/
;/* File: handle.s */
;/* Author: Andy Beeson */
;/* Date: 7th February 1994 */
;/***************************/
	AREA TopSwiHandler, CODE ; name this block of code
	EXPORT SWIHandler
	EXPORT MakeChain
	IMPORT C_SWI_Handler
	IMPORT Dswivec
SWIHandler
	SUB r13, r13, #4 ; leave space to store spsr
	STMFD r13!,{r0-r12,r14} ; store registers
	MOV r1, r13 ; second parameter to C routine
; is register values.
	LDR r0,[r14,#-4] ; Calculate address of SWI instruction
; and load it into r0
	BIC r0,r0,#0xff000000 ; mask off top 8 bits of instruction
	MRS r2, spsr
	STR r2,[r13,#14*4] ; store spsr on stack at original r13
	BL C_SWI_Handler ; Call C routine to handle SWI
	CMP r0, #0 ; Has C routine handled SWI ?
; 0 = no, 1 = yes
	LDR r2, [r13,#14*4] ; extract spsr from stack
	MSR spsr_cxsf,r2 ; and restore it
	LDMFD r13!, {r0-r12,lr} ; Restore original registers
	ADD r13,r13,#4
; Now need to decide whether to return from handler or to call
; the next handler in the chain (the debugger's).
	MOVNES pc,lr ; return from handler if SWI handled
	LDR pc, swichain ; else jump to address containing
; instruction to branch to address of
; debugger's SWI handler.
swichain
	DCD 0
MakeChain
	LDR r0, =swichain ; Load address of swichain into r0.
	LDR r1, =Dswivec ; Load address of Dswivec into r1.
	LDR r2, [r1] ; Load contents of Dswivec, i.e. the
; location of the stored Demon vector.
	STR r2, [r0] ; Store vector location within range
; of PC relative load.
	MOV pc,lr ; Return from routine.
	END ; mark end of this file

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -