~ubuntu-branches/ubuntu/utopic/binutils-arm64-cross/utopic

« back to all changes in this revision

Viewing changes to binutils-2.23.52.20130611/ld/testsuite/ld-m68hc11/far-hc12.s

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-06-20 17:38:09 UTC
  • Revision ID: package-import@ubuntu.com-20130620173809-app8lzgvymy5fg6c
Tags: 0.7
Build-depend on binutils-source (>= 2.23.52.20130620-1~).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;;; Test 68HC12 FAR trampoline generation
 
2
;;; 2 trampolines are generated:
 
3
;;; - one for '_far_bar'
 
4
;;; - one for '_far_foo'
 
5
;;; 'far_no_tramp' does not have any trampoline generated.
 
6
;;;
 
7
        .sect .text
 
8
        .globl _start
 
9
_start:
 
10
start:  
 
11
        lds     #stack-1
 
12
        ldx     #0xabcd
 
13
        pshx
 
14
        ldd     #0x1234
 
15
        ldx     #0x5678
 
16
        bsr     _far_bar        ; Call to trampoline generated code
 
17
        cpx     #0x1234
 
18
        bne     fail            ; X and D preserved (swapped by _far_bar)
 
19
        cpd     #0x5678
 
20
        bne     fail
 
21
        pulx
 
22
        cpx     #0xabcd         ; Stack parameter preserved
 
23
        bne     fail
 
24
        ldd     #_far_foo       ; Get address of trampoline handler
 
25
        xgdx
 
26
        jsr     0,x
 
27
        ldd     #_far_bar       ; Likewise (unique trampoline check)
 
28
        xgdy
 
29
        jsr     0,y
 
30
        call    _far_no_tramp   ; No trampoline generated for _far_no_tramp
 
31
        clra
 
32
        clrb
 
33
        wai
 
34
fail:
 
35
        ldd     #1
 
36
        wai
 
37
        bra     start
 
38
 
 
39
        .sect .bank1,"ax"
 
40
        .globl _far_bar
 
41
        .far _far_bar           ; Must mark symbol as far
 
42
_far_bar:
 
43
        jsr     local_bank1
 
44
        xgdx
 
45
        rtc
 
46
 
 
47
local_bank1:
 
48
        rts
 
49
 
 
50
        .sect .bank2,"ax"
 
51
        .globl _far_foo
 
52
        .far _far_foo
 
53
_far_foo:
 
54
        jsr     local_bank2
 
55
        rtc
 
56
 
 
57
local_bank2:
 
58
        rts
 
59
 
 
60
        .sect .bank3,"ax"
 
61
        .globl _far_no_tramp
 
62
        .far _far_no_tramp
 
63
_far_no_tramp:
 
64
        jsr     local_bank3
 
65
        rtc
 
66
 
 
67
local_bank3:
 
68
        rts
 
69
 
 
70
        .sect .text
 
71
        .globl __far_trampoline
 
72
__far_trampoline:
 
73
        movb    0,sp, 2,sp      ; Copy page register below the caller's return
 
74
        leas    2,sp            ; address.
 
75
        jmp     0,y             ; We have a 'call/rtc' stack layout now
 
76
                                ; and can jump to the far handler
 
77
                                ; (whose memory bank is mapped due to the
 
78
                                ; call to the trampoline).
 
79
 
 
80
        .sect .bss
 
81
        .skip 100
 
82
stack:
 
83