浏览代码

[i386] Add explicit flags and type on all .section declarations

Try to avoid future problems caused by implicit section flags and/or
type information by instituting a policy that all .section
declarations must explicitly state the flags and type.

Most of this change was achieved using

    perl -pi \
      -e 's/".text"$/".text", "ax", \@progbits/ ; ' \
      -e 's/".text16"$/".text16", "ax", \@progbits/ ; ' \
      -e 's/".text16.null"$/".text16.null", "ax", \@progbits/ ; ' \
      -e 's/".text16.data"$/".text16.data", "aw", \@progbits/ ; ' \
      -e 's/".data"$/".data", "aw", \@progbits/ ; ' \
      -e 's/".data16"$/".data16", "aw", \@progbits/ ; ' \
      -e 's/".bss"$/".bss", "aw", \@nobits/ ; ' \
      -e 's/".bss16"$/".bss16", "aw", \@nobits/ ; ' \
      -e 's/".prefix"$/".prefix", "ax", \@progbits/ ; ' \
      -e 's/".prefix.lib"$/".prefix.lib", "awx", \@progbits/ ; ' \
      -e 's/".prefix.data"$/".prefix.data", "aw", \@progbits/ ; ' \
      -e 's/".weak"$/".weak", "a", \@nobits/ ; ' \
      `git grep -l '\.section'`
tags/v0.9.7
Michael Brown 15 年前
父节点
当前提交
c9e5b12473

+ 3
- 3
src/arch/i386/core/gdbidt.S 查看文件

11
  * Interrupt Descriptor Table
11
  * Interrupt Descriptor Table
12
  ****************************************************************************
12
  ****************************************************************************
13
  */
13
  */
14
-	.section ".data16"
14
+	.section ".data16", "aw", @progbits
15
 	.globl idtr
15
 	.globl idtr
16
 idtr:
16
 idtr:
17
 idt_limit:
17
 idt_limit:
68
  * Destroys %ax, %bx, and %di.
68
  * Destroys %ax, %bx, and %di.
69
  ****************************************************************************
69
  ****************************************************************************
70
  */
70
  */
71
-	.section ".text16"
71
+	.section ".text16", "ax", @progbits
72
 	.code16
72
 	.code16
73
 	.globl idt_init
73
 	.globl idt_init
74
 idt_init:
74
 idt_init:
100
  * Interrupt handlers
100
  * Interrupt handlers
101
  ****************************************************************************
101
  ****************************************************************************
102
  */
102
  */
103
-	.section ".text"
103
+	.section ".text", "ax", @progbits
104
 	.code32
104
 	.code32
105
 
105
 
106
 /* POSIX signal numbers for reporting traps to GDB */
106
 /* POSIX signal numbers for reporting traps to GDB */

+ 2
- 4
src/arch/i386/drivers/net/undiisr.S 查看文件

10
 	
10
 	
11
 	.text
11
 	.text
12
 	.arch i386
12
 	.arch i386
13
-	.section ".text16", "ax", @progbits
14
-	.section ".data16", "aw", @progbits
15
 	.code16
13
 	.code16
16
 
14
 
17
-	.section ".text16"
15
+	.section ".text16", "ax", @progbits
18
 	.globl undiisr
16
 	.globl undiisr
19
 undiisr:
17
 undiisr:
20
 	
18
 	
75
 	popw	%ds
73
 	popw	%ds
76
 	iret
74
 	iret
77
 
75
 
78
-	.section ".data16"
76
+	.section ".data16", "aw", @progbits
79
 undinet_params:
77
 undinet_params:
80
 status:			.word	0
78
 status:			.word	0
81
 funcflag:		.word	0
79
 funcflag:		.word	0

+ 18
- 21
src/arch/i386/firmware/pcbios/e820mangler.S 查看文件

18
 	
18
 	
19
 	.text
19
 	.text
20
 	.arch i386
20
 	.arch i386
21
-	.section ".text16", "ax", @progbits
22
-	.section ".data16", "aw", @progbits
23
-	.section ".text16.data", "aw", @progbits
24
 	.code16
21
 	.code16
25
 
22
 
26
 #define SMAP 0x534d4150
23
 #define SMAP 0x534d4150
62
  *
59
  *
63
  ****************************************************************************
60
  ****************************************************************************
64
  */
61
  */
65
-	.section ".data16"
62
+	.section ".data16", "aw", @progbits
66
 	.align 16
63
 	.align 16
67
 	.globl hidemem_base
64
 	.globl hidemem_base
68
 	.globl hidemem_umalloc
65
 	.globl hidemem_umalloc
94
  *  %ecx:%ebx	Length of windowed region
91
  *  %ecx:%ebx	Length of windowed region
95
  ****************************************************************************
92
  ****************************************************************************
96
  */
93
  */
97
-	.section ".text16"
94
+	.section ".text16", "ax", @progbits
98
 window_region:
95
 window_region:
99
 	/* Convert (start,len) to (start, end) */
96
 	/* Convert (start,len) to (start, end) */
100
 	addl	%eax, %ebx
97
 	addl	%eax, %ebx
132
  *  %ax		Modified memory above 1M in 1kB blocks
129
  *  %ax		Modified memory above 1M in 1kB blocks
133
  ****************************************************************************
130
  ****************************************************************************
134
  */
131
  */
135
-	.section ".text16"
132
+	.section ".text16", "ax", @progbits
136
 patch_1m:
133
 patch_1m:
137
 	pushal
134
 	pushal
138
 	/* Convert to (start,len) format and call truncate */
135
 	/* Convert to (start,len) format and call truncate */
162
  *  %bx		Modified memory above 16M in 64kB blocks
159
  *  %bx		Modified memory above 16M in 64kB blocks
163
  ****************************************************************************
160
  ****************************************************************************
164
  */
161
  */
165
-	.section ".text16"
162
+	.section ".text16", "ax", @progbits
166
 patch_16m:
163
 patch_16m:
167
 	pushal
164
 	pushal
168
 	/* Convert to (start,len) format and call truncate */
165
 	/* Convert to (start,len) format and call truncate */
193
  *  %bx		Modified memory above 16MB, in 64kB blocks
190
  *  %bx		Modified memory above 16MB, in 64kB blocks
194
  ****************************************************************************
191
  ****************************************************************************
195
  */
192
  */
196
-	.section ".text16"
193
+	.section ".text16", "ax", @progbits
197
 patch_1m_16m:
194
 patch_1m_16m:
198
 	call	patch_1m
195
 	call	patch_1m
199
 	call	patch_16m
196
 	call	patch_16m
219
  *
216
  *
220
  ****************************************************************************
217
  ****************************************************************************
221
  */
218
  */
222
-	.section ".text16"
219
+	.section ".text16", "ax", @progbits
223
 get_underlying_e820:
220
 get_underlying_e820:
224
 
221
 
225
 	/* If the requested region is in the cache, return it */
222
 	/* If the requested region is in the cache, return it */
308
 	jmp	get_underlying_e820
305
 	jmp	get_underlying_e820
309
 	.size	get_underlying_e820, . - get_underlying_e820
306
 	.size	get_underlying_e820, . - get_underlying_e820
310
 
307
 
311
-	.section ".data16"
308
+	.section ".data16", "aw", @progbits
312
 underlying_e820_index:
309
 underlying_e820_index:
313
 	.word	0xffff /* Initialise to an invalid value */
310
 	.word	0xffff /* Initialise to an invalid value */
314
 	.size underlying_e820_index, . - underlying_e820_index
311
 	.size underlying_e820_index, . - underlying_e820_index
315
 
312
 
316
-	.section ".bss16"
313
+	.section ".bss16", "aw", @nobits
317
 underlying_e820_ebx:
314
 underlying_e820_ebx:
318
 	.long	0
315
 	.long	0
319
 	.size underlying_e820_ebx, . - underlying_e820_ebx
316
 	.size underlying_e820_ebx, . - underlying_e820_ebx
320
 
317
 
321
-	.section ".bss16"
318
+	.section ".bss16", "aw", @nobits
322
 underlying_e820_cache:
319
 underlying_e820_cache:
323
 	.space	E820MAXSIZE
320
 	.space	E820MAXSIZE
324
 	.size underlying_e820_cache, . - underlying_e820_cache
321
 	.size underlying_e820_cache, . - underlying_e820_cache
325
 
322
 
326
-	.section ".bss16"
323
+	.section ".bss16", "aw", @nobits
327
 underlying_e820_cache_size:
324
 underlying_e820_cache_size:
328
 	.long	0
325
 	.long	0
329
 	.size	underlying_e820_cache_size, . - underlying_e820_cache_size
326
 	.size	underlying_e820_cache_size, . - underlying_e820_cache_size
342
  *
339
  *
343
  ****************************************************************************
340
  ****************************************************************************
344
  */
341
  */
345
-	.section ".text16"
342
+	.section ".text16", "ax", @progbits
346
 get_windowed_e820:
343
 get_windowed_e820:
347
 
344
 
348
 	/* Preserve registers */
345
 	/* Preserve registers */
417
  *
414
  *
418
  ****************************************************************************
415
  ****************************************************************************
419
  */
416
  */
420
-	.section ".text16"
417
+	.section ".text16", "ax", @progbits
421
 get_nonempty_e820:
418
 get_nonempty_e820:
422
 
419
 
423
 	/* Record entry parameters */
420
 	/* Record entry parameters */
462
  *
459
  *
463
  ****************************************************************************
460
  ****************************************************************************
464
  */
461
  */
465
-	.section ".text16"
462
+	.section ".text16", "ax", @progbits
466
 get_mangled_e820:
463
 get_mangled_e820:
467
 
464
 
468
 	/* Get a nonempty region */
465
 	/* Get a nonempty region */
496
  * INT 15,e820 handler
493
  * INT 15,e820 handler
497
  ****************************************************************************
494
  ****************************************************************************
498
  */
495
  */
499
-	.section ".text16"
496
+	.section ".text16", "ax", @progbits
500
 int15_e820:
497
 int15_e820:
501
 	pushw	%ds
498
 	pushw	%ds
502
 	pushw	%cs:rm_ds
499
 	pushw	%cs:rm_ds
510
  * INT 15,e801 handler
507
  * INT 15,e801 handler
511
  ****************************************************************************
508
  ****************************************************************************
512
  */
509
  */
513
-	.section ".text16"
510
+	.section ".text16", "ax", @progbits
514
 int15_e801:
511
 int15_e801:
515
 	/* Call previous handler */
512
 	/* Call previous handler */
516
 	pushfw
513
 	pushfw
536
  * INT 15,88 handler
533
  * INT 15,88 handler
537
  ****************************************************************************
534
  ****************************************************************************
538
  */
535
  */
539
-	.section ".text16"
536
+	.section ".text16", "ax", @progbits
540
 int15_88:
537
 int15_88:
541
 	/* Call previous handler */
538
 	/* Call previous handler */
542
 	pushfw
539
 	pushfw
557
  * INT 15 handler
554
  * INT 15 handler
558
  ****************************************************************************
555
  ****************************************************************************
559
  */
556
  */
560
-	.section ".text16"
557
+	.section ".text16", "ax", @progbits
561
 	.globl int15
558
 	.globl int15
562
 int15:
559
 int15:
563
 	/* See if we want to intercept this call */
560
 	/* See if we want to intercept this call */
580
 	ljmp	*%cs:int15_vector
577
 	ljmp	*%cs:int15_vector
581
 	.size int15, . - int15
578
 	.size int15, . - int15
582
 	
579
 	
583
-	.section ".text16.data"
580
+	.section ".text16.data", "aw", @progbits
584
 	.globl int15_vector
581
 	.globl int15_vector
585
 int15_vector:
582
 int15_vector:
586
 	.long 0
583
 	.long 0

+ 8
- 11
src/arch/i386/interface/pxe/pxe_entry.S 查看文件

18
  */
18
  */
19
 
19
 
20
 	.arch i386
20
 	.arch i386
21
-	.section ".text16", "awx", @progbits
22
-	.section ".text16.data", "aw", @progbits
23
-	.section ".data16", "aw", @progbits
24
 
21
 
25
 /****************************************************************************
22
 /****************************************************************************
26
  * !PXE structure
23
  * !PXE structure
27
  ****************************************************************************
24
  ****************************************************************************
28
  */
25
  */
29
-	.section ".text16.data"
26
+	.section ".text16.data", "aw", @progbits
30
 	.globl ppxe
27
 	.globl ppxe
31
 	.align 16
28
 	.align 16
32
 ppxe:
29
 ppxe:
56
 	.size	ppxe, . - ppxe
53
 	.size	ppxe, . - ppxe
57
 
54
 
58
 	/* Define undiheader=0 as a weak symbol for non-ROM builds */
55
 	/* Define undiheader=0 as a weak symbol for non-ROM builds */
59
-	.section ".weak"
56
+	.section ".weak", "a", @nobits
60
 	.weak	undiheader
57
 	.weak	undiheader
61
 undiheader:
58
 undiheader:
62
 
59
 
64
  * PXENV+ structure
61
  * PXENV+ structure
65
  ****************************************************************************
62
  ****************************************************************************
66
  */
63
  */
67
-	.section ".text16.data"
64
+	.section ".text16.data", "aw", @progbits
68
 	.globl pxenv
65
 	.globl pxenv
69
 	.align 16
66
 	.align 16
70
 pxenv:
67
 pxenv:
108
 	 * somebody at Wyse has difficulty distinguishing between the
105
 	 * somebody at Wyse has difficulty distinguishing between the
109
 	 * words "may" and "must"...
106
 	 * words "may" and "must"...
110
 	 */
107
 	 */
111
-	.section ".text16.null"
108
+	.section ".text16.null", "ax", @progbits
112
 	.code16
109
 	.code16
113
 pxenv_null_entry:
110
 pxenv_null_entry:
114
 	jmp	pxenv_entry
111
 	jmp	pxenv_entry
115
 
112
 
116
-	.section ".text16"
113
+	.section ".text16", "ax", @progbits
117
 	.code16
114
 	.code16
118
 pxenv_entry:
115
 pxenv_entry:
119
 	pushl	$pxe_api_call
116
 	pushl	$pxe_api_call
137
  *   none
134
  *   none
138
  ****************************************************************************
135
  ****************************************************************************
139
  */
136
  */
140
-	.section ".text16"
137
+	.section ".text16", "ax", @progbits
141
 	.code16
138
 	.code16
142
 pxe_entry:
139
 pxe_entry:
143
 pxe_entry_sp:
140
 pxe_entry_sp:
186
  *   none
183
  *   none
187
  ****************************************************************************
184
  ****************************************************************************
188
  */
185
  */
189
-	.section ".text16"
186
+	.section ".text16", "ax", @progbits
190
 	.code16
187
 	.code16
191
 	.globl	pxe_int_1a
188
 	.globl	pxe_int_1a
192
 pxe_int_1a:
189
 pxe_int_1a:
205
 	popfw
202
 	popfw
206
 	ljmp	*%cs:pxe_int_1a_vector
203
 	ljmp	*%cs:pxe_int_1a_vector
207
 
204
 
208
-	.section ".text16.data"
205
+	.section ".text16.data", "aw", @progbits
209
 	.globl	pxe_int_1a_vector
206
 	.globl	pxe_int_1a_vector
210
 pxe_int_1a_vector:	.long 0
207
 pxe_int_1a_vector:	.long 0

+ 17
- 19
src/arch/i386/prefix/libprefix.S 查看文件

18
  */
18
  */
19
 
19
 
20
 	.arch i386
20
 	.arch i386
21
-	.section ".prefix.lib", "awx", @progbits
22
-	.section ".data16", "aw", @progbits
23
 
21
 
24
 /**
22
 /**
25
  * High memory temporary load address
23
  * High memory temporary load address
53
  *   %ds:di : next character in output buffer (if applicable)
51
  *   %ds:di : next character in output buffer (if applicable)
54
  *****************************************************************************
52
  *****************************************************************************
55
  */
53
  */
56
-	.section ".prefix.lib"
54
+	.section ".prefix.lib", "awx", @progbits
57
 	.code16
55
 	.code16
58
 	.globl	print_character
56
 	.globl	print_character
59
 print_character:
57
 print_character:
93
  *   %ds:di : next character in output buffer (if applicable)
91
  *   %ds:di : next character in output buffer (if applicable)
94
  *****************************************************************************
92
  *****************************************************************************
95
  */
93
  */
96
-	.section ".prefix.lib"
94
+	.section ".prefix.lib", "awx", @progbits
97
 	.code16
95
 	.code16
98
 	.globl	print_message
96
 	.globl	print_message
99
 print_message:
97
 print_message:
123
  *   %ds:di : next character in output buffer (if applicable)
121
  *   %ds:di : next character in output buffer (if applicable)
124
  *****************************************************************************
122
  *****************************************************************************
125
  */
123
  */
126
-	.section ".prefix.lib"
124
+	.section ".prefix.lib", "awx", @progbits
127
 	.code16
125
 	.code16
128
 	.globl	print_hex_dword
126
 	.globl	print_hex_dword
129
 print_hex_dword:
127
 print_hex_dword:
171
  *   %ds:di : next character in output buffer (if applicable)
169
  *   %ds:di : next character in output buffer (if applicable)
172
  *****************************************************************************
170
  *****************************************************************************
173
  */
171
  */
174
-	.section ".prefix.lib"
172
+	.section ".prefix.lib", "awx", @progbits
175
 	.code16
173
 	.code16
176
 	.globl	print_pci_busdevfn
174
 	.globl	print_pci_busdevfn
177
 print_pci_busdevfn:
175
 print_pci_busdevfn:
208
  *   %ds:di : next character in output buffer (if applicable)
206
  *   %ds:di : next character in output buffer (if applicable)
209
  *****************************************************************************
207
  *****************************************************************************
210
  */
208
  */
211
-	.section ".prefix.lib"
209
+	.section ".prefix.lib", "awx", @progbits
212
 	.code16
210
 	.code16
213
 	.globl	print_kill_line
211
 	.globl	print_kill_line
214
 print_kill_line:
212
 print_kill_line:
256
 #ifndef KEEP_IT_REAL
254
 #ifndef KEEP_IT_REAL
257
 
255
 
258
 	/* GDT for protected-mode calls */
256
 	/* GDT for protected-mode calls */
259
-	.section ".prefix.lib"
257
+	.section ".prefix.lib", "awx", @progbits
260
 	.align 16
258
 	.align 16
261
 pm_call_vars:
259
 pm_call_vars:
262
 gdt:
260
 gdt:
279
 	.equ	gdt_length, . - gdt
277
 	.equ	gdt_length, . - gdt
280
 	.size	gdt, . - gdt
278
 	.size	gdt, . - gdt
281
 
279
 
282
-	.section ".prefix.lib"
280
+	.section ".prefix.lib", "awx", @progbits
283
 	.align 16
281
 	.align 16
284
 pm_saved_gdt:	
282
 pm_saved_gdt:	
285
 	.long	0, 0
283
 	.long	0, 0
288
 	.equ	pm_call_vars_size, . - pm_call_vars
286
 	.equ	pm_call_vars_size, . - pm_call_vars
289
 #define PM_CALL_VAR(x) ( -pm_call_vars_size + ( (x) - pm_call_vars ) )
287
 #define PM_CALL_VAR(x) ( -pm_call_vars_size + ( (x) - pm_call_vars ) )
290
 
288
 
291
-	.section ".prefix.lib"
289
+	.section ".prefix.lib", "awx", @progbits
292
 	.code16
290
 	.code16
293
 pm_call:
291
 pm_call:
294
 	/* Preserve registers, flags, and RM return point */
292
 	/* Preserve registers, flags, and RM return point */
411
  *   None
409
  *   None
412
  ****************************************************************************
410
  ****************************************************************************
413
  */
411
  */
414
-	.section ".prefix.lib"
412
+	.section ".prefix.lib", "awx", @progbits
415
 	.code16
413
 	.code16
416
 copy_bytes:
414
 copy_bytes:
417
 	pushl %ecx
415
 	pushl %ecx
436
  *   none
434
  *   none
437
  ****************************************************************************
435
  ****************************************************************************
438
  */
436
  */
439
-	.section ".prefix.lib"
437
+	.section ".prefix.lib", "awx", @progbits
440
 	.code16
438
 	.code16
441
 install_block:
439
 install_block:
442
 	
440
 	
533
  *   none
531
  *   none
534
  ****************************************************************************
532
  ****************************************************************************
535
  */
533
  */
536
-	.section ".prefix.lib"
534
+	.section ".prefix.lib", "awx", @progbits
537
 	.code16
535
 	.code16
538
 	.globl	alloc_basemem
536
 	.globl	alloc_basemem
539
 alloc_basemem:
537
 alloc_basemem:
581
  *   none
579
  *   none
582
  ****************************************************************************
580
  ****************************************************************************
583
  */
581
  */
584
-	.section ".text16"
582
+	.section ".text16", "ax", @progbits
585
 	.code16
583
 	.code16
586
 	.globl	free_basemem
584
 	.globl	free_basemem
587
 free_basemem:
585
 free_basemem:
613
 	ret
611
 	ret
614
 	.size free_basemem, . - free_basemem
612
 	.size free_basemem, . - free_basemem
615
 
613
 
616
-	.section ".text16.data"
614
+	.section ".text16.data", "aw", @progbits
617
 	.globl	hooked_bios_interrupts
615
 	.globl	hooked_bios_interrupts
618
 hooked_bios_interrupts:
616
 hooked_bios_interrupts:
619
 	.word	0
617
 	.word	0
633
  *   none
631
  *   none
634
  ****************************************************************************
632
  ****************************************************************************
635
  */
633
  */
636
-	.section ".prefix.lib"
634
+	.section ".prefix.lib", "awx", @progbits
637
 	.code16
635
 	.code16
638
 	.globl install
636
 	.globl install
639
 install:
637
 install:
668
  *   none
666
  *   none
669
  ****************************************************************************
667
  ****************************************************************************
670
  */
668
  */
671
-	.section ".prefix.lib"
669
+	.section ".prefix.lib", "awx", @progbits
672
 	.code16
670
 	.code16
673
 	.globl install_prealloc
671
 	.globl install_prealloc
674
 install_prealloc:
672
 install_prealloc:
750
 	.size install_prealloc, . - install_prealloc
748
 	.size install_prealloc, . - install_prealloc
751
 
749
 
752
 	/* Vectors for far calls to .text16 functions */
750
 	/* Vectors for far calls to .text16 functions */
753
-	.section ".data16"
751
+	.section ".data16", "aw", @progbits
754
 #ifdef KEEP_IT_REAL
752
 #ifdef KEEP_IT_REAL
755
 init_libkir_vector:
753
 init_libkir_vector:
756
 	.word init_libkir
754
 	.word init_libkir
781
  *   none
779
  *   none
782
  ****************************************************************************
780
  ****************************************************************************
783
  */
781
  */
784
-	.section ".text16"
782
+	.section ".text16", "ax", @progbits
785
 	.code16
783
 	.code16
786
 	.globl uninstall
784
 	.globl uninstall
787
 uninstall:
785
 uninstall:

+ 1
- 3
src/arch/i386/prefix/nbiprefix.S 查看文件

1
 	.text
1
 	.text
2
 	.arch i386
2
 	.arch i386
3
-	.section ".prefix", "ax", @progbits
4
-	.section ".prefix.data", "aw", @progbits
5
 	.code16
3
 	.code16
6
-	.section ".prefix"
4
+	.section ".prefix", "ax", @progbits
7
 	.org 0
5
 	.org 0
8
 
6
 
9
 nbi_header:
7
 nbi_header:

+ 13
- 15
src/arch/i386/prefix/pxeprefix.S 查看文件

6
 	.text
6
 	.text
7
 	.arch i386
7
 	.arch i386
8
 	.org 0
8
 	.org 0
9
-	.section ".prefix", "ax", @progbits
10
-	.section ".prefix.data", "aw", @progbits
11
 	.code16
9
 	.code16
12
 
10
 
13
 #include <undi.h>
11
 #include <undi.h>
16
  * Entry point:	set operating context, print welcome message
14
  * Entry point:	set operating context, print welcome message
17
  *****************************************************************************
15
  *****************************************************************************
18
  */
16
  */
19
-	.section ".prefix"
17
+	.section ".prefix", "ax", @progbits
20
 	/* Set up our non-stack segment registers */
18
 	/* Set up our non-stack segment registers */
21
 	jmp	$0x7c0, $1f
19
 	jmp	$0x7c0, $1f
22
 1:	movw	%cs, %ax
20
 1:	movw	%cs, %ax
39
 	movw	$10f, %si
37
 	movw	$10f, %si
40
 	xorw	%di, %di
38
 	xorw	%di, %di
41
 	call	print_message
39
 	call	print_message
42
-	.section ".prefix.data"
40
+	.section ".prefix.data", "aw", @progbits
43
 10:	.asciz	"PXE->EB:"
41
 10:	.asciz	"PXE->EB:"
44
 	.previous
42
 	.previous
45
 
43
 
70
 	movb	$',', %al
68
 	movb	$',', %al
71
 	call	print_character
69
 	call	print_character
72
 	jmp	99f
70
 	jmp	99f
73
-	.section ".prefix.data"
71
+	.section ".prefix.data", "aw", @progbits
74
 10:	.asciz	" PXENV+ at "
72
 10:	.asciz	" PXENV+ at "
75
 	.previous
73
 	.previous
76
 
74
 
108
 	movb	$',', %al
106
 	movb	$',', %al
109
 	call	print_character
107
 	call	print_character
110
 	jmp	99f
108
 	jmp	99f
111
-	.section ".prefix.data"
109
+	.section ".prefix.data", "aw", @progbits
112
 10:	.asciz	" !PXE at "
110
 10:	.asciz	" !PXE at "
113
 	.previous
111
 	.previous
114
 
112
 
131
 	movw	$10f, %si
129
 	movw	$10f, %si
132
 	call	print_message
130
 	call	print_message
133
 	jmp	finished
131
 	jmp	finished
134
-	.section ".prefix.data"
132
+	.section ".prefix.data", "aw", @progbits
135
 10:	.asciz	" No PXE stack found!\n"
133
 10:	.asciz	" No PXE stack found!\n"
136
 	.previous
134
 	.previous
137
 99:	
135
 99:	
169
 	call	print_message
167
 	call	print_message
170
 	les	entry_segoff, %bx
168
 	les	entry_segoff, %bx
171
 	call	print_segoff
169
 	call	print_segoff
172
-	.section ".prefix.data"
170
+	.section ".prefix.data", "aw", @progbits
173
 10:	.asciz	" entry point at "
171
 10:	.asciz	" entry point at "
174
 	.previous
172
 	.previous
175
 	/* Print UNDI code segment */
173
 	/* Print UNDI code segment */
177
 	call	print_message
175
 	call	print_message
178
 	les	undi_code_segoff, %bx
176
 	les	undi_code_segoff, %bx
179
 	call	print_segoff
177
 	call	print_segoff
180
-	.section ".prefix.data"
178
+	.section ".prefix.data", "aw", @progbits
181
 10:	.asciz	"\n         UNDI code segment "
179
 10:	.asciz	"\n         UNDI code segment "
182
 	.previous
180
 	.previous
183
 	/* Print UNDI data segment */
181
 	/* Print UNDI data segment */
185
 	call	print_message
183
 	call	print_message
186
 	les	undi_data_segoff, %bx
184
 	les	undi_data_segoff, %bx
187
 	call	print_segoff
185
 	call	print_segoff
188
-	.section ".prefix.data"
186
+	.section ".prefix.data", "aw", @progbits
189
 10:	.asciz	", data segment "
187
 10:	.asciz	", data segment "
190
 	.previous
188
 	.previous
191
 	/* Print UNDI memory usage */
189
 	/* Print UNDI memory usage */
199
 	call	print_word
197
 	call	print_word
200
 	movw	$20f, %si
198
 	movw	$20f, %si
201
 	call	print_message
199
 	call	print_message
202
-	.section ".prefix.data"
200
+	.section ".prefix.data", "aw", @progbits
203
 10:	.asciz	" ("
201
 10:	.asciz	" ("
204
 20:	.asciz	"kB)\n"
202
 20:	.asciz	"kB)\n"
205
 	.previous
203
 	.previous
233
 	movb	$0x0a, %al
231
 	movb	$0x0a, %al
234
 	call	print_character
232
 	call	print_character
235
 	jmp	99f
233
 	jmp	99f
236
-	.section ".prefix.data"
234
+	.section ".prefix.data", "aw", @progbits
237
 10:	.asciz	"         UNDI device is PCI "
235
 10:	.asciz	"         UNDI device is PCI "
238
 	.previous
236
 	.previous
239
 
237
 
241
 	/* No device found, or device type not understood */
239
 	/* No device found, or device type not understood */
242
 	movw	$10f, %si
240
 	movw	$10f, %si
243
 	call	print_message
241
 	call	print_message
244
-	.section ".prefix.data"
242
+	.section ".prefix.data", "aw", @progbits
245
 10:	.asciz	"         Unable to determine UNDI physical device\n"
243
 10:	.asciz	"         Unable to determine UNDI physical device\n"
246
 	.previous
244
 	.previous
247
 
245
 
308
 	call	print_word
306
 	call	print_word
309
 	movw	$20f, %si
307
 	movw	$20f, %si
310
 	call	print_message
308
 	call	print_message
311
-	.section ".prefix.data"
309
+	.section ".prefix.data", "aw", @progbits
312
 10:	.asciz	"         "
310
 10:	.asciz	"         "
313
 20:	.asciz	"kB free base memory after PXE unload\n"
311
 20:	.asciz	"kB free base memory after PXE unload\n"
314
 	.previous
312
 	.previous
503
 	call	print_message
501
 	call	print_message
504
 	popw	%si
502
 	popw	%si
505
 	ret
503
 	ret
506
-	.section ".prefix.data"
504
+	.section ".prefix.data", "aw", @progbits
507
 10:	.asciz	"         UNDI API call "
505
 10:	.asciz	"         UNDI API call "
508
 20:	.asciz	" failed: status code "
506
 20:	.asciz	" failed: status code "
509
 30:	.asciz	"\n"
507
 30:	.asciz	"\n"

+ 20
- 23
src/arch/i386/transitions/librm.S 查看文件

19
 #define SIZEOF_I386_ALL_REGS	( SIZEOF_REAL_MODE_REGS + SIZEOF_I386_FLAGS )
19
 #define SIZEOF_I386_ALL_REGS	( SIZEOF_REAL_MODE_REGS + SIZEOF_I386_FLAGS )
20
 	
20
 	
21
 	.arch i386
21
 	.arch i386
22
-	.section ".text16", "ax", @progbits
23
-	.section ".text16.data", "aw", @progbits
24
-	.section ".data16", "aw", @progbits
25
 
22
 
26
 /****************************************************************************
23
 /****************************************************************************
27
  * Global descriptor table
24
  * Global descriptor table
47
 #else
44
 #else
48
 #define RM_LIMIT_16_19__AVL__SIZE__GRANULARITY 0x00
45
 #define RM_LIMIT_16_19__AVL__SIZE__GRANULARITY 0x00
49
 #endif
46
 #endif
50
-	.section ".data16"
47
+	.section ".data16", "aw", @progbits
51
 	.align 16
48
 	.align 16
52
 gdt:
49
 gdt:
53
 gdtr:		/* The first GDT entry is unused, the GDTR can fit here. */
50
 gdtr:		/* The first GDT entry is unused, the GDTR can fit here. */
99
  *   %edi : Physical base of protected-mode code (virt_offset)
96
  *   %edi : Physical base of protected-mode code (virt_offset)
100
  ****************************************************************************
97
  ****************************************************************************
101
  */
98
  */
102
-	.section ".text16"
99
+	.section ".text16", "ax", @progbits
103
 	.code16
100
 	.code16
104
 	.globl init_librm
101
 	.globl init_librm
105
 init_librm:
102
 init_librm:
149
 	popl	%eax
146
 	popl	%eax
150
 	lret
147
 	lret
151
 
148
 
152
-	.section ".text16"
149
+	.section ".text16", "ax", @progbits
153
 	.code16
150
 	.code16
154
 	.weak idt_init
151
 	.weak idt_init
155
 set_seg_base:
152
 set_seg_base:
177
  *
174
  *
178
  ****************************************************************************
175
  ****************************************************************************
179
  */
176
  */
180
-	.section ".text16"
177
+	.section ".text16", "ax", @progbits
181
 	.code16
178
 	.code16
182
 real_to_prot:
179
 real_to_prot:
183
 	/* Make sure we have our data segment available */
180
 	/* Make sure we have our data segment available */
209
 	orb	$CR0_PE, %al
206
 	orb	$CR0_PE, %al
210
 	movl	%eax, %cr0
207
 	movl	%eax, %cr0
211
 	data32 ljmp	$VIRTUAL_CS, $1f
208
 	data32 ljmp	$VIRTUAL_CS, $1f
212
-	.section ".text"
209
+	.section ".text", "ax", @progbits
213
 	.code32
210
 	.code32
214
 1:
211
 1:
215
 	/* Set up protected-mode data segments and stack pointer */
212
 	/* Set up protected-mode data segments and stack pointer */
240
 	ret
237
 	ret
241
 
238
 
242
 	/* Default IDTR with no interrupts */
239
 	/* Default IDTR with no interrupts */
243
-	.section ".data16"
240
+	.section ".data16", "aw", @progbits
244
 	.weak idtr
241
 	.weak idtr
245
 idtr:
242
 idtr:
246
 rm_idtr:
243
 rm_idtr:
266
  *
263
  *
267
  ****************************************************************************
264
  ****************************************************************************
268
  */
265
  */
269
-	.section ".text"
266
+	.section ".text", "ax", @progbits
270
 	.code32
267
 	.code32
271
 prot_to_real:
268
 prot_to_real:
272
 	/* Add return address to data to be moved to RM stack */
269
 	/* Add return address to data to be moved to RM stack */
296
 	movw	%ax, %gs
293
 	movw	%ax, %gs
297
 	movw	%ax, %ss
294
 	movw	%ax, %ss
298
 	ljmp	$REAL_CS, $1f
295
 	ljmp	$REAL_CS, $1f
299
-	.section ".text16"
296
+	.section ".text16", "ax", @progbits
300
 	.code16
297
 	.code16
301
 1:
298
 1:
302
 	/* Switch to real mode */
299
 	/* Switch to real mode */
328
 	 * rather than .data16 because code needs to be able to locate
325
 	 * rather than .data16 because code needs to be able to locate
329
 	 * the data segment.
326
 	 * the data segment.
330
 	 */
327
 	 */
331
-	.section ".data16"
328
+	.section ".data16", "aw", @progbits
332
 p2r_jump_vector:
329
 p2r_jump_vector:
333
 	.word	p2r_jump_target
330
 	.word	p2r_jump_target
334
 	.globl rm_cs
331
 	.globl rm_cs
335
 rm_cs:	.word 0
332
 rm_cs:	.word 0
336
 	.globl rm_ds
333
 	.globl rm_ds
337
-	.section ".text16.data"
334
+	.section ".text16.data", "aw", @progbits
338
 rm_ds:	.word 0
335
 rm_ds:	.word 0
339
 
336
 
340
 /****************************************************************************
337
 /****************************************************************************
378
 #define PC_OFFSET_FUNCTION ( PC_OFFSET_RETADDR + 4 )
375
 #define PC_OFFSET_FUNCTION ( PC_OFFSET_RETADDR + 4 )
379
 #define PC_OFFSET_END ( PC_OFFSET_FUNCTION + 4 )
376
 #define PC_OFFSET_END ( PC_OFFSET_FUNCTION + 4 )
380
 
377
 
381
-	.section ".text16"
378
+	.section ".text16", "ax", @progbits
382
 	.code16
379
 	.code16
383
 	.globl prot_call
380
 	.globl prot_call
384
 prot_call:
381
 prot_call:
403
 	movl	$PC_OFFSET_END, %ecx
400
 	movl	$PC_OFFSET_END, %ecx
404
 	pushl	$1f
401
 	pushl	$1f
405
 	jmp	real_to_prot
402
 	jmp	real_to_prot
406
-	.section ".text"
403
+	.section ".text", "ax", @progbits
407
 	.code32
404
 	.code32
408
 1:
405
 1:
409
 	/* Set up environment expected by C code */
406
 	/* Set up environment expected by C code */
419
 	movl	$PC_OFFSET_END, %ecx
416
 	movl	$PC_OFFSET_END, %ecx
420
 	pushl	$1f
417
 	pushl	$1f
421
 	jmp	prot_to_real
418
 	jmp	prot_to_real
422
-	.section ".text16"
419
+	.section ".text16", "ax", @progbits
423
 	.code16
420
 	.code16
424
 1:	
421
 1:	
425
 	/* Reload GDT and IDT, restore registers and flags and return */
422
 	/* Reload GDT and IDT, restore registers and flags and return */
475
 #define RC_OFFSET_FUNCTION ( RC_OFFSET_RETADDR + 4 )
472
 #define RC_OFFSET_FUNCTION ( RC_OFFSET_RETADDR + 4 )
476
 #define RC_OFFSET_END ( RC_OFFSET_FUNCTION + 4 )
473
 #define RC_OFFSET_END ( RC_OFFSET_FUNCTION + 4 )
477
 
474
 
478
-	.section ".text"
475
+	.section ".text", "ax", @progbits
479
 	.code32
476
 	.code32
480
 	.globl real_call
477
 	.globl real_call
481
 real_call:
478
 real_call:
487
 	movl	$( RC_OFFSET_RETADDR + 4 /* function pointer copy */ ), %ecx
484
 	movl	$( RC_OFFSET_RETADDR + 4 /* function pointer copy */ ), %ecx
488
 	pushl	$1f
485
 	pushl	$1f
489
 	jmp	prot_to_real
486
 	jmp	prot_to_real
490
-	.section ".text16"
487
+	.section ".text16", "ax", @progbits
491
 	.code16
488
 	.code16
492
 1:
489
 1:
493
 	/* Call real-mode function */
490
 	/* Call real-mode function */
503
 	movl	$RC_OFFSET_RETADDR, %ecx
500
 	movl	$RC_OFFSET_RETADDR, %ecx
504
 	pushl	$1f
501
 	pushl	$1f
505
 	jmp	real_to_prot
502
 	jmp	real_to_prot
506
-	.section ".text"
503
+	.section ".text", "ax", @progbits
507
 	.code32
504
 	.code32
508
 1:
505
 1:
509
 	/* Restore registers and return */
506
 	/* Restore registers and return */
514
 	/* Function vector, used because "call xx(%sp)" is not a valid
511
 	/* Function vector, used because "call xx(%sp)" is not a valid
515
 	 * 16-bit expression.
512
 	 * 16-bit expression.
516
 	 */
513
 	 */
517
-	.section ".data16"
514
+	.section ".data16", "aw", @progbits
518
 rc_function:	.word 0, 0
515
 rc_function:	.word 0, 0
519
 
516
 
520
 /****************************************************************************
517
 /****************************************************************************
551
  * to us.
548
  * to us.
552
  ****************************************************************************
549
  ****************************************************************************
553
  */
550
  */
554
-	.section ".data"
551
+	.section ".data", "aw", @progbits
555
 	.globl rm_sp
552
 	.globl rm_sp
556
 rm_sp:	.word 0
553
 rm_sp:	.word 0
557
 	.globl rm_ss
554
 	.globl rm_ss
567
  ****************************************************************************
564
  ****************************************************************************
568
  */
565
  */
569
 	/* Internal copies, created by init_librm (which runs in real mode) */
566
 	/* Internal copies, created by init_librm (which runs in real mode) */
570
-	.section ".data16"
567
+	.section ".data16", "aw", @progbits
571
 _virt_offset:	.long 0
568
 _virt_offset:	.long 0
572
 _text16:	.long 0
569
 _text16:	.long 0
573
 _data16:	.long 0
570
 _data16:	.long 0
574
 
571
 
575
 	/* Externally-visible copies, created by real_to_prot */
572
 	/* Externally-visible copies, created by real_to_prot */
576
-	.section ".data"
573
+	.section ".data", "aw", @progbits
577
 	.globl virt_offset
574
 	.globl virt_offset
578
 virt_offset:	.long 0	
575
 virt_offset:	.long 0	
579
 	.globl text16
576
 	.globl text16

+ 1
- 1
src/image/embed.S 查看文件

1
-	.section ".data", "aw"
1
+	.section ".data", "aw", @progbits
2
 	.balign 4
2
 	.balign 4
3
 	.globl _embedded_image_start
3
 	.globl _embedded_image_start
4
 _embedded_image_start:
4
 _embedded_image_start:

+ 2
- 2
src/tests/gdbstub_test.S 查看文件

1
 	.arch i386
1
 	.arch i386
2
 
2
 
3
-	.section ".data"
3
+	.section ".data", "aw", @progbits
4
 watch_me:
4
 watch_me:
5
 	.long 0xfeedbeef
5
 	.long 0xfeedbeef
6
 
6
 
7
-	.section ".text"
7
+	.section ".text", "ax", @progbits
8
 	.code32
8
 	.code32
9
 gdbstub_test:
9
 gdbstub_test:
10
 	/* 1. Read registers test */
10
 	/* 1. Read registers test */

正在加载...
取消
保存