swi_service.s

来自「ARM源码」· S 代码 · 共 27 行

S
27
字号
	AREA	SWI_Service,	CODE,	READWRITE	;this is the supervisor service code
	DCD 0x00000000
	DCD 0x00000000					; push the next instruction to 0x08
0x08	B Supervisor					; SWI entry point

EntryTable						; addresses of supervisor routines
	DCD ZeroRtn
	DCD OneRtn

Supervisor
	LDR R0,[R14,#-4]					; get SWI instruction
	BIC R0,R0,#0xFF000000				; clear top 8 bits
	MOV R1,R0,LSR#8					; get routine offset
	ADR R2,EntryTable					; get start address of entry table
	LDR R15,[R2,R1,LSL#2]				; branch to appropriate routine
ZeroRtn
	LDR R7,=0x11111111					; enter with character in R0 bits 0-7
	B   restore
OneRtn
	LDR R7,=0x22222222
	B   restore
	

restore
	mov R15,R14

	END

⌨️ 快捷键说明

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