13.07.2015 Views

Cortex-A8 R2P2.pdf - ARM Information Center

Cortex-A8 R2P2.pdf - ARM Information Center

Cortex-A8 R2P2.pdf - ARM Information Center

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DebugExample 12-15 Reading the PCReadPC(){// Step 1. Save R0saved_r0 := ReadRegister(0);// Step 2. Execute the instruction MOV r0, pc through the ITR.Execute<strong>ARM</strong>Instruction(0xE1A0000F);// Step 3. Read the value of r0 that now contains the PC.pc := ReadRegister(0);// Step 4. Restore the value of R0.WriteRegister(0, saved_r0);return pc;}Reading the CPSR in debug stateExample 12-16 shows the code for reading the CPSR.Example 12-16 Reading the CPSRReadCPSR(){// Step 1. Save R0.saved_r0 := ReadRegister(0);// Step 2. Execute instruction MRS r0, CPSR through the ITR.Execute<strong>ARM</strong>Instruction(0xE10F0000);// Step 3. Read the value of r0 that now contains the CPSRcpsr_val := ReadRegister(0);// Step 4. Restore the value of R0.WriteRegister(0, saved_r0);return cpsr_val;}NoteYou can use similar sequences to read the SPSR in privileged modes.Writing the CPSR in debug stateExample 12-17 on page 12-108 shows the code for writing the CPSR.<strong>ARM</strong> DDI 0344E Copyright © 2006-2008 <strong>ARM</strong> Limited. All rights reserved. 12-107

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!