~ubuntu-branches/ubuntu/hoary/binutils/hoary

« back to all changes in this revision

Viewing changes to ld/testsuite/ld-m68hc11/far-hc11.s

  • Committer: Bazaar Package Importer
  • Author(s): James Troup
  • Date: 2004-05-19 10:35:44 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040519103544-17h3o6e8pwndydrg
Tags: 2.14.90.0.7-8
debian/rules: don't use gcc-2.95 on m68k.  Thanks to Adam Conrad for
pointing this out.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;;; Test 68HC11 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
 
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
        ldaa    #%page(_far_no_tramp)
 
31
        ldy     #%addr(_far_no_tramp)
 
32
        bsr     __call_a16      ; No trampoline generated for _far_no_tramp
 
33
        clra
 
34
        clrb
 
35
        wai
 
36
fail:
 
37
        ldd     #1
 
38
        wai
 
39
        bra     start
 
40
        .global __return
 
41
__return:
 
42
        ins
 
43
        rts
 
44
 
 
45
        .sect .bank1,"ax"
 
46
        .globl _far_bar
 
47
        .far _far_bar           ; Must mark symbol as far
 
48
_far_bar:
 
49
        jsr     local_bank1
 
50
        xgdx
 
51
        jmp     __return
 
52
 
 
53
local_bank1:
 
54
        rts
 
55
 
 
56
        .sect .bank2,"ax"
 
57
        .globl _far_foo
 
58
        .far _far_foo
 
59
_far_foo:
 
60
        jsr     local_bank2
 
61
        jmp     __return
 
62
 
 
63
local_bank2:
 
64
        rts
 
65
 
 
66
        .sect .bank3,"ax"
 
67
        .globl _far_no_tramp
 
68
        .far _far_no_tramp
 
69
_far_no_tramp:
 
70
        jsr     local_bank3
 
71
        jmp     __return
 
72
 
 
73
local_bank3:
 
74
        rts
 
75
 
 
76
        .sect .text
 
77
        .globl __far_trampoline
 
78
__far_trampoline:
 
79
        psha                            ; (2) Save function parameter (high)
 
80
        ;; <Read current page in A>
 
81
        psha                            ; (2)
 
82
        ;; <Set currenge page from B>
 
83
        pshx                            ; (4)
 
84
        tsx                             ; (3)
 
85
        ldab    4,x                     ; (4) Restore function parameter (low)
 
86
        ldaa    2,x                     ; (4) Get saved page number
 
87
        staa    4,x                     ; (4) Save it below return PC
 
88
        pulx                            ; (5)
 
89
        pula                            ; (3)
 
90
        pula                            ; (3) Restore function parameter (high)
 
91
        jmp     0,y                     ; (4)
 
92
 
 
93
        .globl __call_a16
 
94
__call_a16:
 
95
        ;; xgdx                         ; (3)
 
96
        ;; <Read current page in A>     ; (3) ldaa _current_page
 
97
        psha                            ; (2)
 
98
        ;; <Set current page from B>    ; (4) staa _current_page
 
99
        ;; xgdx                         ; (3)
 
100
        jmp 0,y                         ; (4)
 
101
 
 
102
        .sect .page0
 
103
        .skip 100
 
104
stack:
 
105