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