05.02.2013 Views

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Debug Register Interfaces<br />

DSB<br />

ISB<br />

; (7) Return the pointer to first word not read.<br />

MOV R0, R4<br />

POP {R4, PC}<br />

Example OS Save <strong>and</strong> Restore sequences using the Extended CP14 interface<br />

On an implementation that includes the OS Save <strong>and</strong> Restore mechanism <strong>and</strong> the Extended CP14 interface:<br />

Example C6-3 shows the correct sequence for saving the debug logic state, using the Extended CP14<br />

interface, before powering down<br />

Example C6-4 on page C6-15 shows the correct sequence, using the Extended CP14 interface, for<br />

restoring the debug logic state when the system is powered on again.<br />

When the debug logic state is restored, if the OS Unlock Catch bit in the Event Catch Register is set to 1 a<br />

debug event is triggered when the DBGOSLAR is cleared. This event might be used by an external debugger<br />

to restart a debugging session. See Event Catch Register (DBGECR) on page C10-78.<br />

Example C6-3 OS debug register save sequence, Extended CP14 interface<br />

; On entry, R0 points to a block to save the debug registers in.<br />

SaveDebugRegisters<br />

; (1) Set OS Lock Access Register (DBGOSLAR).<br />

LDR R1, =0xC5ACCE55<br />

MCR p14, 0, R1, c1, c0, 4 ; Write DBGOSLAR<br />

ISB<br />

; (2) Get the number of words to save.<br />

MRC p14, 0, R1, c1, c2, 4 ; DBGOSSRR returns size<br />

STR R1, [R0], #4 ; Push on to the save stack<br />

; (3) Loop reading words from the DBGOSSRR.<br />

CMP R1, #0 ; Check for zero<br />

SaveDebugRegisters_Loop<br />

ITTT NE<br />

MRCNE p14, 0, R2, c1, c2, 4 ; Load a word of data<br />

STRNE R2, [R0], #4 ; Push on to the save stack<br />

SUBSNE R1, R1, #1<br />

BNE SaveDebugRegisters_Loop<br />

; (4) Return the pointer to first word not written to. This pointer is already in R0, so<br />

; all that is needed is to return from this function.<br />

;<br />

; Leave DBGOSLAR set, because from now on we do not want any changes.<br />

BX LR<br />

C6-14 Copyright © 1996-1998, 2000, 2004-2008 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DDI 0406B

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

Saved successfully!

Ooh no, something went wrong!