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

« back to all changes in this revision

Viewing changes to binutils-2.23.52.20130611/gas/testsuite/gas/cfi/cfi-i386.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
        .text
 
2
 
 
3
#; func_locvars
 
4
#; - function with a space on the stack 
 
5
#;   allocated for local variables
 
6
 
 
7
func_locvars:
 
8
        .cfi_startproc
 
9
        
 
10
        #; alocate space for local vars
 
11
        sub     $0x1234,%esp
 
12
        .cfi_adjust_cfa_offset  0x1234
 
13
        
 
14
        #; dummy body
 
15
        movl    $1,%eax
 
16
        
 
17
        #; release space of local vars and return
 
18
        add     $0x1234,%esp
 
19
        .cfi_adjust_cfa_offset  -0x1234
 
20
        ret
 
21
        .cfi_endproc
 
22
 
 
23
#; func_prologue
 
24
#; - functions that begins with standard
 
25
#;   prologue: "pushq %rbp; movq %rsp,%rbp"
 
26
 
 
27
func_prologue:
 
28
        .cfi_startproc
 
29
        
 
30
        #; prologue, CFI is valid after 
 
31
        #; each instruction.
 
32
        pushl   %ebp
 
33
        .cfi_def_cfa_offset     8
 
34
        .cfi_offset             ebp,-8
 
35
        movl    %esp, %ebp
 
36
        .cfi_def_cfa_register   ebp
 
37
 
 
38
        #; function body
 
39
        call    func_locvars
 
40
        addl    $3, %eax
 
41
 
 
42
        #; epilogue with valid CFI
 
43
        #; (we're better than gcc :-)
 
44
        leave
 
45
        .cfi_def_cfa_register   esp
 
46
        ret
 
47
        .cfi_endproc
 
48
 
 
49
#; func_otherreg
 
50
#; - function that moves frame pointer to 
 
51
#;   another register (ebx) and then allocates 
 
52
#;   a space for local variables
 
53
 
 
54
func_otherreg:
 
55
        .cfi_startproc
 
56
 
 
57
        #; save frame pointer to ebx
 
58
        mov     %esp,%ebx
 
59
        .cfi_def_cfa_register   ebx
 
60
 
 
61
        #; alocate space for local vars
 
62
        #;  (no .cfi_{def,adjust}_cfa_offset here,
 
63
        #;   because CFA is computed from ebx!)
 
64
        sub     $100,%esp
 
65
 
 
66
        #; function body
 
67
        call    func_prologue
 
68
        add     $2, %eax
 
69
        
 
70
        #; restore frame pointer from ebx
 
71
        mov     %ebx,%esp
 
72
        .cfi_def_cfa            esp,4
 
73
        ret
 
74
        .cfi_endproc
 
75
 
 
76
#; main
 
77
#; - typical function
 
78
main:
 
79
        .cfi_startproc
 
80
        
 
81
        #; only function body that doesn't
 
82
        #; touch the stack at all.
 
83
        call    func_otherreg
 
84
        
 
85
        #; return
 
86
        ret
 
87
        .cfi_endproc
 
88
 
 
89
#; _start
 
90
#; - standard entry point
 
91
 
 
92
        .globl  _start
 
93
_start:
 
94
        .cfi_startproc
 
95
        call    main
 
96
        movl    %eax,%edi
 
97
        movl    $0x1,%eax
 
98
        int     $0x80
 
99
        hlt
 
100
        .cfi_endproc
 
101
 
 
102
#; func_all_registers
 
103
#; - test for all .cfi register numbers. 
 
104
#;   This function is never called and the CFI info doesn't make sense.
 
105
 
 
106
func_all_registers:
 
107
        .cfi_startproc simple
 
108
 
 
109
        .cfi_undefined eip      ; nop
 
110
        .cfi_undefined eax      ; nop
 
111
        .cfi_undefined ecx      ; nop
 
112
        .cfi_undefined edx      ; nop
 
113
        .cfi_undefined ebx      ; nop
 
114
        .cfi_undefined esp      ; nop
 
115
        .cfi_undefined ebp      ; nop
 
116
        .cfi_undefined esi      ; nop
 
117
        .cfi_undefined edi      ; nop
 
118
        .cfi_undefined eflags   ; nop
 
119
 
 
120
        .cfi_undefined es       ; nop
 
121
        .cfi_undefined cs       ; nop
 
122
        .cfi_undefined ds       ; nop
 
123
        .cfi_undefined ss       ; nop
 
124
        .cfi_undefined fs       ; nop
 
125
        .cfi_undefined gs       ; nop
 
126
        .cfi_undefined tr       ; nop
 
127
        .cfi_undefined ldtr     ; nop
 
128
 
 
129
        .cfi_undefined mxcsr    ; nop
 
130
        .cfi_undefined xmm0     ; nop
 
131
        .cfi_undefined xmm1     ; nop
 
132
        .cfi_undefined xmm2     ; nop
 
133
        .cfi_undefined xmm3     ; nop
 
134
        .cfi_undefined xmm4     ; nop
 
135
        .cfi_undefined xmm5     ; nop
 
136
        .cfi_undefined xmm6     ; nop
 
137
        .cfi_undefined xmm7     ; nop
 
138
 
 
139
        .cfi_undefined fcw      ; nop
 
140
        .cfi_undefined fsw      ; nop
 
141
        .cfi_undefined st       ; nop
 
142
        .cfi_undefined st(1)    ; nop
 
143
        .cfi_undefined st(2)    ; nop
 
144
        .cfi_undefined st(3)    ; nop
 
145
        .cfi_undefined st(4)    ; nop
 
146
        .cfi_undefined st(5)    ; nop
 
147
        .cfi_undefined st(6)    ; nop
 
148
        .cfi_undefined st(7)    ; nop
 
149
 
 
150
        .cfi_undefined mm0      ; nop
 
151
        .cfi_undefined mm1      ; nop
 
152
        .cfi_undefined mm2      ; nop
 
153
        .cfi_undefined mm3      ; nop
 
154
        .cfi_undefined mm4      ; nop
 
155
        .cfi_undefined mm5      ; nop
 
156
        .cfi_undefined mm6      ; nop
 
157
        .cfi_undefined mm7      ; nop
 
158
 
 
159
        .cfi_endproc