Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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'`
  • Loading branch information
Michael Brown committed Feb 15, 2009
1 parent ce2aa66 commit c9e5b12
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 102 deletions.
6 changes: 3 additions & 3 deletions src/arch/i386/core/gdbidt.S
Expand Up @@ -11,7 +11,7 @@
* Interrupt Descriptor Table
****************************************************************************
*/
.section ".data16"
.section ".data16", "aw", @progbits
.globl idtr
idtr:
idt_limit:
Expand Down Expand Up @@ -68,7 +68,7 @@ idt_fixed:
* Destroys %ax, %bx, and %di.
****************************************************************************
*/
.section ".text16"
.section ".text16", "ax", @progbits
.code16
.globl idt_init
idt_init:
Expand Down Expand Up @@ -100,7 +100,7 @@ idt_init:
* Interrupt handlers
****************************************************************************
*/
.section ".text"
.section ".text", "ax", @progbits
.code32

/* POSIX signal numbers for reporting traps to GDB */
Expand Down
6 changes: 2 additions & 4 deletions src/arch/i386/drivers/net/undiisr.S
Expand Up @@ -10,11 +10,9 @@

.text
.arch i386
.section ".text16", "ax", @progbits
.section ".data16", "aw", @progbits
.code16

.section ".text16"
.section ".text16", "ax", @progbits
.globl undiisr
undiisr:

Expand Down Expand Up @@ -75,7 +73,7 @@ exit: /* Restore registers and return */
popw %ds
iret

.section ".data16"
.section ".data16", "aw", @progbits
undinet_params:
status: .word 0
funcflag: .word 0
Expand Down
39 changes: 18 additions & 21 deletions src/arch/i386/firmware/pcbios/e820mangler.S
Expand Up @@ -18,9 +18,6 @@

.text
.arch i386
.section ".text16", "ax", @progbits
.section ".data16", "aw", @progbits
.section ".text16.data", "aw", @progbits
.code16

#define SMAP 0x534d4150
Expand Down Expand Up @@ -62,7 +59,7 @@
*
****************************************************************************
*/
.section ".data16"
.section ".data16", "aw", @progbits
.align 16
.globl hidemem_base
.globl hidemem_umalloc
Expand Down Expand Up @@ -94,7 +91,7 @@ memory_windows_end:
* %ecx:%ebx Length of windowed region
****************************************************************************
*/
.section ".text16"
.section ".text16", "ax", @progbits
window_region:
/* Convert (start,len) to (start, end) */
addl %eax, %ebx
Expand Down Expand Up @@ -132,7 +129,7 @@ window_region:
* %ax Modified memory above 1M in 1kB blocks
****************************************************************************
*/
.section ".text16"
.section ".text16", "ax", @progbits
patch_1m:
pushal
/* Convert to (start,len) format and call truncate */
Expand Down Expand Up @@ -162,7 +159,7 @@ patch_1m:
* %bx Modified memory above 16M in 64kB blocks
****************************************************************************
*/
.section ".text16"
.section ".text16", "ax", @progbits
patch_16m:
pushal
/* Convert to (start,len) format and call truncate */
Expand Down Expand Up @@ -193,7 +190,7 @@ patch_16m:
* %bx Modified memory above 16MB, in 64kB blocks
****************************************************************************
*/
.section ".text16"
.section ".text16", "ax", @progbits
patch_1m_16m:
call patch_1m
call patch_16m
Expand All @@ -219,7 +216,7 @@ patch_1m_16m:
*
****************************************************************************
*/
.section ".text16"
.section ".text16", "ax", @progbits
get_underlying_e820:

/* If the requested region is in the cache, return it */
Expand Down Expand Up @@ -308,22 +305,22 @@ get_underlying_e820:
jmp get_underlying_e820
.size get_underlying_e820, . - get_underlying_e820

.section ".data16"
.section ".data16", "aw", @progbits
underlying_e820_index:
.word 0xffff /* Initialise to an invalid value */
.size underlying_e820_index, . - underlying_e820_index

.section ".bss16"
.section ".bss16", "aw", @nobits
underlying_e820_ebx:
.long 0
.size underlying_e820_ebx, . - underlying_e820_ebx

.section ".bss16"
.section ".bss16", "aw", @nobits
underlying_e820_cache:
.space E820MAXSIZE
.size underlying_e820_cache, . - underlying_e820_cache

.section ".bss16"
.section ".bss16", "aw", @nobits
underlying_e820_cache_size:
.long 0
.size underlying_e820_cache_size, . - underlying_e820_cache_size
Expand All @@ -342,7 +339,7 @@ underlying_e820_cache_size:
*
****************************************************************************
*/
.section ".text16"
.section ".text16", "ax", @progbits
get_windowed_e820:

/* Preserve registers */
Expand Down Expand Up @@ -417,7 +414,7 @@ get_windowed_e820:
*
****************************************************************************
*/
.section ".text16"
.section ".text16", "ax", @progbits
get_nonempty_e820:

/* Record entry parameters */
Expand Down Expand Up @@ -462,7 +459,7 @@ get_nonempty_e820:
*
****************************************************************************
*/
.section ".text16"
.section ".text16", "ax", @progbits
get_mangled_e820:

/* Get a nonempty region */
Expand Down Expand Up @@ -496,7 +493,7 @@ get_mangled_e820:
* INT 15,e820 handler
****************************************************************************
*/
.section ".text16"
.section ".text16", "ax", @progbits
int15_e820:
pushw %ds
pushw %cs:rm_ds
Expand All @@ -510,7 +507,7 @@ int15_e820:
* INT 15,e801 handler
****************************************************************************
*/
.section ".text16"
.section ".text16", "ax", @progbits
int15_e801:
/* Call previous handler */
pushfw
Expand All @@ -536,7 +533,7 @@ int15_e801:
* INT 15,88 handler
****************************************************************************
*/
.section ".text16"
.section ".text16", "ax", @progbits
int15_88:
/* Call previous handler */
pushfw
Expand All @@ -557,7 +554,7 @@ int15_88:
* INT 15 handler
****************************************************************************
*/
.section ".text16"
.section ".text16", "ax", @progbits
.globl int15
int15:
/* See if we want to intercept this call */
Expand All @@ -580,7 +577,7 @@ int15:
ljmp *%cs:int15_vector
.size int15, . - int15

.section ".text16.data"
.section ".text16.data", "aw", @progbits
.globl int15_vector
int15_vector:
.long 0
Expand Down
19 changes: 8 additions & 11 deletions src/arch/i386/interface/pxe/pxe_entry.S
Expand Up @@ -18,15 +18,12 @@
*/

.arch i386
.section ".text16", "awx", @progbits
.section ".text16.data", "aw", @progbits
.section ".data16", "aw", @progbits

/****************************************************************************
* !PXE structure
****************************************************************************
*/
.section ".text16.data"
.section ".text16.data", "aw", @progbits
.globl ppxe
.align 16
ppxe:
Expand Down Expand Up @@ -56,15 +53,15 @@ pxe_segments:
.size ppxe, . - ppxe

/* Define undiheader=0 as a weak symbol for non-ROM builds */
.section ".weak"
.section ".weak", "a", @nobits
.weak undiheader
undiheader:

/****************************************************************************
* PXENV+ structure
****************************************************************************
*/
.section ".text16.data"
.section ".text16.data", "aw", @progbits
.globl pxenv
.align 16
pxenv:
Expand Down Expand Up @@ -108,12 +105,12 @@ pxenv:
* somebody at Wyse has difficulty distinguishing between the
* words "may" and "must"...
*/
.section ".text16.null"
.section ".text16.null", "ax", @progbits
.code16
pxenv_null_entry:
jmp pxenv_entry

.section ".text16"
.section ".text16", "ax", @progbits
.code16
pxenv_entry:
pushl $pxe_api_call
Expand All @@ -137,7 +134,7 @@ pxenv_entry:
* none
****************************************************************************
*/
.section ".text16"
.section ".text16", "ax", @progbits
.code16
pxe_entry:
pxe_entry_sp:
Expand Down Expand Up @@ -186,7 +183,7 @@ pxe_entry_common:
* none
****************************************************************************
*/
.section ".text16"
.section ".text16", "ax", @progbits
.code16
.globl pxe_int_1a
pxe_int_1a:
Expand All @@ -205,6 +202,6 @@ pxe_int_1a:
popfw
ljmp *%cs:pxe_int_1a_vector

.section ".text16.data"
.section ".text16.data", "aw", @progbits
.globl pxe_int_1a_vector
pxe_int_1a_vector: .long 0

0 comments on commit c9e5b12

Please sign in to comment.