david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[librm] Add meaningful labels at section changes

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>
This commit is contained in:
Michael Brown 2014-04-30 18:03:10 +01:00
parent bd640bc364
commit 03e76c34d8
1 changed files with 12 additions and 12 deletions

View 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