File: thumb_blx_in_range.s

package info (click to toggle)
binutils-avr 2.26.20160125%2BAtmel3.6.2-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 365,552 kB
  • sloc: ansic: 2,480,046; asm: 892,808; exp: 188,218; cpp: 133,829; makefile: 63,886; sh: 32,212; yacc: 26,783; lisp: 16,709; xml: 7,490; perl: 6,449; python: 4,555; ada: 4,318; pascal: 3,174; lex: 2,250; cs: 879; sed: 334; f90: 298; awk: 168; objc: 134; java: 73; fortran: 43
file content (64 lines) | stat: -rw-r--r-- 1,345 bytes parent folder | download | duplicates (26)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# thumb_blx_in_range.s
#
# Test THUMB/THUMB-2 blx instructions just within the branch range limits.
# Because bit 1 of the branch target comes from the branch instruction
# address, the branch range from PC (branch instruction address + 4) is
# acutally -((1<<22) + 2) to ((1<<22) - 4) for THUMB and -((1<<24) + 2) to
# ((1<<24) - 4) from THUMB2.

	.syntax	unified
	.section	.text.pre,"x"

# Add padding so that target is just in branch range. 
	.space	8

	.align	2
	.global	_backward_target
	.code	32
	.type	_backword_target, %function
_backward_target:
	bx	lr
	.size	_backward_target, .-_backward_target
	
	.text

# Define _start so that linker does not complain.
	.global	_start
	.code	32
	.align	2
	.type	_start, %function
_start:
	bx	lr
	.size	_start, .-_start

	.global	_backward_test
	.code	16
	.thumb_func
	.type	_backward_test, %function
_backward_test:
	nop.n
	blx	_backward_target
	.size	_backward_test, .-_backward_test

	.align	2
	.global	_forward_test
	.code	16
	.thumb_func
	.type	_forward_test, %function
_forward_test:
	blx	_forward_target
	.size	_forward_test, .-_forward_test
	.code	32
	
	.section	.text.post,"x"

# Add padding so that target is just in branch range. 
	.space	12

	.align	2
	.global	_forward_target
	.code	32
	.type	_forward_target, %function
_forward_target:
	bx	lr
	.size	_forward_target, .-_forward_target