debugsrv/runmodedebug/rmdebug_test/rm_debug/debug_targets/d_rmdebug_step_test.s
changeset 56 aa2539c91954
parent 54 a151135b0cf9
child 60 e54443a6878c
child 62 1c2bb2fc7c87
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
     1 ; Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 ; All rights reserved.
       
     3 ; This component and the accompanying materials are made available
       
     4 ; under the terms of the License "Eclipse Public License v1.0"
       
     5 ; which accompanies this distribution, and is available
       
     6 ; at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 ;
       
     8 ; Initial Contributors:
       
     9 ; Nokia Corporation - initial contribution.
       
    10 ;
       
    11 ; Contributors:
       
    12 ;
       
    13 ; Description:
       
    14 ; 
       
    15 ;
       
    16 
       
    17         
       
    18 		AREA |d-rmdebug-step$$Code|, CODE, READONLY, ALIGN=6
       
    19 
       
    20 	CODE32
       
    21 
       
    22 	; ARM tests
       
    23 	
       
    24 ; 
       
    25 ; Non-PC modifying
       
    26 ;
       
    27 	EXPORT RMDebug_StepTest_Non_PC_Modifying
       
    28 	EXPORT RMDebug_StepTest_Non_PC_Modifying_OK
       
    29  
       
    30 RMDebug_StepTest_Non_PC_Modifying
       
    31 	mov		r0,r0		; nop
       
    32 RMDebug_StepTest_Non_PC_Modifying_OK
       
    33 	bx		lr			; should return to normal execution of the test thread
       
    34 
       
    35 ;
       
    36 ; Branch
       
    37 ;
       
    38 	EXPORT RMDebug_StepTest_Branch
       
    39 	EXPORT RMDebug_StepTest_Branch_1
       
    40 
       
    41 RMDebug_StepTest_Branch
       
    42 	b		RMDebug_StepTest_Branch_1		
       
    43 	mov		r0, #2		; if the pc ends up here, we know its gone wrong
       
    44 RMDebug_StepTest_Branch_1
       
    45 	bx		lr			; return
       
    46 
       
    47 ;
       
    48 ; Branch and Link
       
    49 ;
       
    50 	EXPORT RMDebug_StepTest_Branch_And_Link
       
    51 	EXPORT RMDebug_StepTest_Branch_And_Link_1
       
    52 	EXPORT RMDebug_StepTest_Branch_And_Link_2
       
    53 
       
    54 RMDebug_StepTest_Branch_And_Link		
       
    55 	mov		r0, lr		; preserve lr for the moment
       
    56 RMDebug_StepTest_Branch_And_Link_1
       
    57 	bl		RMDebug_StepTest_Branch_And_Link_2
       
    58 	mov		r1, #1		; insert a gap in the instruction stream so we know we branched.
       
    59 RMDebug_StepTest_Branch_And_Link_2
       
    60 	mov		lr, r0		; restore lr			
       
    61 	bx		lr			; should return to normal execution of the test thread
       
    62 
       
    63 ;
       
    64 ; MOV PC
       
    65 ;
       
    66 	EXPORT RMDebug_StepTest_MOV_PC
       
    67 	EXPORT RMDebug_StepTest_MOV_PC_1
       
    68 	EXPORT RMDebug_StepTest_MOV_PC_2
       
    69 
       
    70 RMDebug_StepTest_MOV_PC
       
    71 	mov		r0, #4
       
    72 RMDebug_StepTest_MOV_PC_1
       
    73 	add		pc, pc, r0	; should be a jump (bear in mind reading pc = current inst + 8bytes for arm)
       
    74 	mov		r0, #1		; Simple instructions which allow us to test where the PC really is
       
    75 	mov		r0, #2		; just by reading r0.
       
    76 RMDebug_StepTest_MOV_PC_2
       
    77 	mov		r0, #3		; 
       
    78 	mov		r0, #4		; 
       
    79 	bx		lr			; should return to normal execution of the test thread
       
    80 
       
    81 ; 
       
    82 ; LDR PC
       
    83 ;
       
    84 	EXPORT RMDebug_StepTest_LDR_PC
       
    85 	EXPORT RMDebug_StepTest_LDR_PC_1
       
    86 
       
    87 RMDebug_StepTest_LDR_PC
       
    88 	ldr		pc, =RMDebug_StepTest_LDR_PC_1
       
    89 	mov		r0, #1		;  separate the branch target so we can prove it works
       
    90 RMDebug_StepTest_LDR_PC_1
       
    91 	bx		lr			; should return to normal execution of the test thread
       
    92 	
       
    93 ;
       
    94 ; ARM -> Thumb -> ARM interworking test
       
    95 ;
       
    96 ; Note: We always start and finish this test
       
    97 ; in ARM mode.
       
    98 	EXPORT RMDebug_StepTest_Interwork
       
    99 	EXPORT RMDebug_StepTest_Interwork_1
       
   100 	EXPORT RMDebug_StepTest_Interwork_2
       
   101 	EXPORT RMDebug_StepTest_Interwork_3	
       
   102 RMDebug_StepTest_Interwork
       
   103 	mov		r0, lr	; preserve lr
       
   104 RMDebug_StepTest_Interwork_1
       
   105 	blx		RMDebug_StepTest_Interwork_2
       
   106 
       
   107 	CODE16
       
   108 RMDebug_StepTest_Interwork_2
       
   109 	blx		RMDebug_StepTest_Interwork_3
       
   110 
       
   111 	CODE32
       
   112 
       
   113 RMDebug_StepTest_Interwork_3
       
   114 	bx		r0
       
   115 
       
   116 ;
       
   117 ; Stepping performance tests
       
   118 ;
       
   119 ; This counts down from 100000 to 0
       
   120 ; This means that for all practical purposes
       
   121 ; we can single-step as much as we like
       
   122 ; in less than one second and have some likelyhood
       
   123 ; that we will not step too far from our loop
       
   124 
       
   125 	EXPORT RMDebug_StepTest_Count
       
   126 	EXPORT RMDebug_StepTest_Count_1
       
   127 	EXPORT RMDebug_StepTest_Count_2
       
   128 
       
   129 RMDebug_StepTest_Count
       
   130 	ldr		r2, =100000
       
   131 RMDebug_StepTest_Count_1
       
   132 	subs	r2, r2, #1
       
   133 RMDebug_StepTest_Count_2
       
   134 	bne		RMDebug_StepTest_Count_1
       
   135 	bx		lr
       
   136 
       
   137 ; Thumb tests
       
   138 
       
   139 ; Thumb non-pc modifying
       
   140 ;
       
   141 ;
       
   142 RMDebug_StepTest_Thumb_Non_PC_Modifying
       
   143 	mov		r0, lr	; preserve lr
       
   144 	blx		RMDebug_StepTest_Thumb_Non_PC_Modifying_1
       
   145 	bx		r0
       
   146 
       
   147 ;
       
   148 ; Thumb Branch
       
   149 ;
       
   150 RMDebug_StepTest_Thumb_Branch
       
   151 	mov		r0, lr	; preserve lr
       
   152 	blx		RMDebug_StepTest_Thumb_Branch_1
       
   153 	bx		r0		
       
   154 
       
   155 ;
       
   156 ; Thumb Branch and link
       
   157 ;
       
   158 RMDebug_StepTest_Thumb_Branch_And_Link
       
   159 	mov		r0, lr	; preserve lr
       
   160 	blx		RMDebug_StepTest_Thumb_Branch_And_Link_1
       
   161 	bx		r0 
       
   162 
       
   163 ;
       
   164 ; Thumb Back Branch and link
       
   165 ;
       
   166 RMDebug_StepTest_Thumb_Back_Branch_And_Link
       
   167 	mov		r0, lr	; preserve lr
       
   168 	blx		RMDebug_StepTest_Thumb_Back_Branch_And_Link_1
       
   169 	bx		r0 
       
   170 
       
   171 ;
       
   172 ; Thumb ADD PC,PC, #0
       
   173 ;
       
   174 RMDebug_StepTest_Thumb_AddPC
       
   175 	mov		r0, lr	; preserve lr
       
   176 	blx		RMDebug_StepTest_Thumb_AddPC_1
       
   177 	bx		r0 
       
   178 
       
   179 	CODE16
       
   180 
       
   181 	; Thumb tests
       
   182 	EXPORT RMDebug_StepTest_Thumb_Non_PC_Modifying
       
   183 	EXPORT RMDebug_StepTest_Thumb_Non_PC_Modifying_1
       
   184 	EXPORT RMDebug_StepTest_Thumb_Non_PC_Modifying_2
       
   185 
       
   186 	EXPORT RMDebug_StepTest_Thumb_Branch
       
   187 	EXPORT RMDebug_StepTest_Thumb_Branch_1
       
   188 	EXPORT RMDebug_StepTest_Thumb_Branch_2
       
   189 
       
   190 	EXPORT RMDebug_StepTest_Thumb_Branch_And_Link
       
   191 	EXPORT RMDebug_StepTest_Thumb_Branch_And_Link_1
       
   192 	EXPORT RMDebug_StepTest_Thumb_Branch_And_Link_2
       
   193 	EXPORT RMDebug_StepTest_Thumb_Branch_And_Link_3
       
   194 
       
   195 	EXPORT RMDebug_StepTest_Thumb_Back_Branch_And_Link
       
   196 	EXPORT RMDebug_StepTest_Thumb_Back_Branch_And_Link_1
       
   197 	EXPORT RMDebug_StepTest_Thumb_Back_Branch_And_Link_2
       
   198 	EXPORT RMDebug_StepTest_Thumb_Back_Branch_And_Link_3
       
   199 
       
   200 RMDebug_StepTest_Thumb_Non_PC_Modifying_1
       
   201 	mov		r0, r0	; nop
       
   202 RMDebug_StepTest_Thumb_Non_PC_Modifying_2
       
   203 	bx		lr	
       
   204 
       
   205 RMDebug_StepTest_Thumb_Branch_1
       
   206 	b		RMDebug_StepTest_Thumb_Branch_2
       
   207 	mov		r0, r0
       
   208 RMDebug_StepTest_Thumb_Branch_2
       
   209 	bx		lr
       
   210 
       
   211 RMDebug_StepTest_Thumb_Branch_And_Link_1
       
   212 	mov		r1, lr
       
   213 RMDebug_StepTest_Thumb_Branch_And_Link_2
       
   214 	bl		RMDebug_StepTest_Thumb_Branch_And_Link_3
       
   215 	mov		r0, r0
       
   216 RMDebug_StepTest_Thumb_Branch_And_Link_3
       
   217 	bx		r1
       
   218 
       
   219 RMDebug_StepTest_Thumb_Back_Branch_And_Link_3
       
   220 	bx		r1
       
   221 
       
   222 RMDebug_StepTest_Thumb_Back_Branch_And_Link_1
       
   223 	mov		r1, lr
       
   224 RMDebug_StepTest_Thumb_Back_Branch_And_Link_2
       
   225 	bl		RMDebug_StepTest_Thumb_Back_Branch_And_Link_3
       
   226 	bx		r1
       
   227 
       
   228 ;
       
   229 ; ADD PC
       
   230 ;
       
   231 	EXPORT RMDebug_StepTest_Thumb_AddPC
       
   232 	EXPORT RMDebug_StepTest_Thumb_AddPC_1
       
   233 	EXPORT RMDebug_StepTest_Thumb_AddPC_2
       
   234 	EXPORT RMDebug_StepTest_Thumb_AddPC_3
       
   235 
       
   236 RMDebug_StepTest_Thumb_AddPC_1
       
   237 	mov		r1, lr
       
   238 	mov		r2, #4
       
   239 RMDebug_StepTest_Thumb_AddPC_2
       
   240 	add		pc, pc, r2	; should arrive at RMDebug_StepTest_Thumb_AddPC_3
       
   241 	mov		r0, r0
       
   242 	mov		r0, r0
       
   243 	mov		r0, r0
       
   244 RMDebug_StepTest_Thumb_AddPC_3
       
   245 	bx		r1
       
   246 
       
   247 	ALIGN 4
       
   248 
       
   249 	CODE32
       
   250 
       
   251 ;
       
   252 ; ARM multiple-step ( 5 steps )
       
   253 ;
       
   254 	EXPORT RMDebug_StepTest_ARM_Step_Multiple
       
   255 	EXPORT RMDebug_StepTest_ARM_Step_Multiple_1
       
   256 
       
   257 RMDebug_StepTest_ARM_Step_Multiple
       
   258 	mov		r0,r0		; nop
       
   259 	mov		r0,r0		; nop
       
   260 	mov		r0,r0		; nop
       
   261 	mov		r0,r0		; nop
       
   262 	mov		r0,r0		; nop
       
   263 RMDebug_StepTest_ARM_Step_Multiple_1
       
   264 	bx		lr
       
   265 
       
   266 	END
       
   267 
       
   268 ; End of file - d_rmdebug_step_test.s