?? swi_vec.s
字號:
/**********************************************************************************************
本程序只供學習使用,不得用于其它任何用途,否則后果自負。
ARM_OS_main.c file
LPC213x上的操作系統——ARM_OS
作者:heciang
聯系電話:13811129591
QQ:176780142
Email:heciang@126.com
建立日期:2006-5-1
修改日期:2006-5-15
最后修改時間:2006-08-25
版本:V1.0
Copyright(C) Computer-lov 2006-2016
All rights reserved
**********************************************************************************************/
/***********************************************************************/
/* This file is part of the CA ARM C Compiler package */
/* Copyright KEIL ELEKTRONIK GmbH 2002 - 2004 */
/***********************************************************************/
/* */
/* SWI_VEC.S: Pre-defined vectored interrupt handler SWI interrupt */
/* */
/***********************************************************************/
/*
修改日期:2006-5-16
修改者:heciang
*/
AREA ?C?SWI, CODE, READONLY, ALIGN=2
PUBLIC SWI_Handler?A, ?SWI?Table, ?SWI?Empty
SWI_Handler?A PROC CODE32
STMFD SP!,{R3,R8,R12,LR} ; Store R3,R8,R12,LR register
MRS R8,SPSR ; 將SPSR放入R8中
STMFD SP!,{R8} ; 將R8壓棧
TST R8,#0x20 ; SWI call from
LDRNEH R8,[LR,#-2] ; Thumb: Load halfword instruction
ANDNE R8,R8,#0xFF ; extract SWI number
LDREQ R8,[LR,#-4] ; ARM: Load word instruction
BICEQ R8,R8,#0xFF000000 ; extract SWI number
; R4 now contains SWI number
; SWI Handler
; LDR R12,[PC,#(?SWI?Table-$-8)] ; Maximum number of interrupts
; LDR R12,[PC,#0x24] ; Maximum number of interrupts
ADR R12,?SWI?Table
LDR R12,[R12] ; load last SWI-Function-number
CMP R8,R12
BGT ?SWI?Empty ; overflow
ADR R12,?SWI?Table+4
LDR R12,[R12,R8,LSL #2]; SWI function address
MOV LR,PC ; Return address
BX R12 ; Call SWI function
LDMFD SP!,{R8} ;R8出棧
MSR SPSR_fsxc,R8 ;設置SPSR寄存器
LDMFD SP!,{R3,R8,R12,PC}^ ; Return
?SWI?Empty:
B $ ; no existing SWI
; *** DO NOT MODIFY THIS PORTION OF THE FILE ***
?SWI?Table: ; Marker for LA Linker
;
; The LA Linker inserts at this label
; DD 0 ; <last SWI function number>
; DD ?SWI?Empty ; <entry for SWI function 0>
; DD <SWI entry 1>
; DD <SWI entry 2>
; DD :
; For non-existing SWI functions DD ?SWI?Empty is inserted
ENDP
END
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -