==================================Outline====================================
ARM 레지스터
ARM 모드
Exception
----------------------------------------------------------------------------
ARM 레지스터
임베디드 레시피 책을 보자.
ARM은 37개의 레지스터를 가지고 있다.
각 모드별로 호환될 때 CPSR(Current Program Status Register)에 레지스터의 상태값(context)이 저장되고 모드가 전환될 시 CPSR값을 SPSR(Saved Program Status Register)에 저장하게 된다.
모드가 변경되면 banked register가 덮어지게 되며 원래 레지스터로 복구 되면 기존의 레지스터 값은 복원된다.
R14 (Linked Register) = Return Address 저장 레지스터
R13 (Stack Pointer) = ESP(Intel)
R15 (Program counter) = EIP(Intel)
ARM 모드
ARM모드에 대해 알아보자.
총 7개의 모드가 있다.
기본적으로 SVC 모드로 설정이 된다.
user mode에서는 privileged mode로 이동할 수 없고 privileged mode 사이에는 자유롭게 모드의 이동이 가능하다.
Exception
예외적인 일이 발생했을 때 프로그램이 점프하는 것을 exception이라고 한다.
//interrupt도 exception에 포함된다.
/* Exception vectors (should be a branch to be detected as a valid code by the rom */
_exception_vectors:
reset_vector:
ldrpc, =reset_handler
undef_vector:
bundef_vector /* Undefined Instruction */
swi_vector:
bswi_vector /* Software Interrupt */
pabt_vector:
bpabt_vector /* Prefetch Abort */
dabt_vector:
bdabt_vector /* Data Abort */
rsvd_vector:
brsvd_vector /* reserved */
irq_vector:
birq_handler /* IRQ : read the AIC */
fiq_vector:
/*------------------------------------------------------------------------------
*- Function : fiq_handler
*- Treatments : FIQ Interrupt Handler.
*- Called Functions :
*------------------------------------------------------------------------------*/
fiq_handler:
bfiq_handler
fiq는 가장 우선으로 처리해야 하기 때문에 fiq를 위한 코드 최적화이다. fiq가 벡터 가운데 가장 아래에 있다.
'Busan IT > ARM Assembly' 카테고리의 다른 글
Memory Map과 Symbol 이야기, ELF format Object File에 관한 진실. -c option (기계어 세상) (0) | 2015.12.02 |
---|---|
컴파일에 대한 단상, ARM ADS 설치, 컴파일 공장 이야기 (0) | 2015.12.01 |
ARM/ Thumb PCS - 레지스터 사용법 ~ 컴파일에 대한 단상 (0) | 2015.11.29 |