]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[librm] Add meaningful labels at section changes
authorMichael Brown <mcb30@ipxe.org>
Wed, 30 Apr 2014 17:03:10 +0000 (18:03 +0100)
committerMichael Brown <mcb30@ipxe.org>
Fri, 2 May 2014 14:23:20 +0000 (15:23 +0100)
The mode-transition code involves paths which switch back and forth
between the .text and .text16 sections.  At present, only the start of
each function is labelled, which makes it difficult to decode
addresses within the parts of the function existing in a different
section.

Add explicit labels at the start of each section change, so that
addresses can be meaningfully decoded to the nearest label.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/i386/transitions/librm.S

index 0e550def11ffde9b2ed273b9f50e87715efd4059..18ceb0d6159bf5913d24b6f0204facdc910fda05 100644 (file)
@@ -209,10 +209,10 @@ real_to_prot:
        movl    %cr0, %eax
        orb     $CR0_PE, %al
        movl    %eax, %cr0
-       data32 ljmp     $VIRTUAL_CS, $1f
+       data32 ljmp     $VIRTUAL_CS, $r2p_pmode
        .section ".text", "ax", @progbits
        .code32
-1:
+r2p_pmode:
        /* Set up protected-mode data segments and stack pointer */
        movw    $VIRTUAL_DS, %ax
        movw    %ax, %ds
@@ -294,10 +294,10 @@ prot_to_real:
        movw    %ax, %fs
        movw    %ax, %gs
        movw    %ax, %ss
-       ljmp    $REAL_CS, $1f
+       ljmp    $REAL_CS, $p2r_rmode
        .section ".text16", "ax", @progbits
        .code16
-1:
+p2r_rmode:
        /* Switch to real mode */
        movl    %cr0, %eax
        andb    $0!CR0_PE, %al
@@ -400,11 +400,11 @@ prot_call:
 
        /* Switch to protected mode and move register dump to PM stack */
        movl    $PC_OFFSET_END, %ecx
-       pushl   $1f
+       pushl   $pc_pmode
        jmp     real_to_prot
        .section ".text", "ax", @progbits
        .code32
-1:
+pc_pmode:
        /* Call function */
        leal    PC_OFFSET_IX86(%esp), %eax
        pushl   %eax
@@ -413,11 +413,11 @@ prot_call:
 
        /* Switch to real mode and move register dump back to RM stack */
        movl    $PC_OFFSET_END, %ecx
-       pushl   $1f
+       pushl   $pc_rmode
        jmp     prot_to_real
        .section ".text16", "ax", @progbits
        .code16
-1:     
+pc_rmode:
        /* Reload GDT and IDT, restore registers and flags and return */
        movw    %sp, %bp
        data32 lgdt (%bp)
@@ -475,11 +475,11 @@ real_call:
 
        /* Switch to real mode and move register dump to RM stack  */
        movl    $( RC_OFFSET_RETADDR + 4 /* function pointer copy */ ), %ecx
-       pushl   $1f
+       pushl   $rc_rmode
        jmp     prot_to_real
        .section ".text16", "ax", @progbits
        .code16
-1:
+rc_rmode:
        /* Call real-mode function */
        popl    rc_function
        popal
@@ -491,11 +491,11 @@ real_call:
 
        /* Switch to protected mode and move register dump back to PM stack */
        movl    $RC_OFFSET_RETADDR, %ecx
-       pushl   $1f
+       pushl   $rc_pmode
        jmp     real_to_prot
        .section ".text", "ax", @progbits
        .code32
-1:
+rc_pmode:
        /* Restore registers and return */
        popal
        ret