Browse Source

[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>
tags/v1.20.1
Michael Brown 11 years ago
parent
commit
03e76c34d8
1 changed files with 12 additions and 12 deletions
  1. 12
    12
      src/arch/i386/transitions/librm.S

+ 12
- 12
src/arch/i386/transitions/librm.S View File

209
 	movl	%cr0, %eax
209
 	movl	%cr0, %eax
210
 	orb	$CR0_PE, %al
210
 	orb	$CR0_PE, %al
211
 	movl	%eax, %cr0
211
 	movl	%eax, %cr0
212
-	data32 ljmp	$VIRTUAL_CS, $1f
212
+	data32 ljmp	$VIRTUAL_CS, $r2p_pmode
213
 	.section ".text", "ax", @progbits
213
 	.section ".text", "ax", @progbits
214
 	.code32
214
 	.code32
215
-1:
215
+r2p_pmode:
216
 	/* Set up protected-mode data segments and stack pointer */
216
 	/* Set up protected-mode data segments and stack pointer */
217
 	movw	$VIRTUAL_DS, %ax
217
 	movw	$VIRTUAL_DS, %ax
218
 	movw	%ax, %ds
218
 	movw	%ax, %ds
294
 	movw	%ax, %fs
294
 	movw	%ax, %fs
295
 	movw	%ax, %gs
295
 	movw	%ax, %gs
296
 	movw	%ax, %ss
296
 	movw	%ax, %ss
297
-	ljmp	$REAL_CS, $1f
297
+	ljmp	$REAL_CS, $p2r_rmode
298
 	.section ".text16", "ax", @progbits
298
 	.section ".text16", "ax", @progbits
299
 	.code16
299
 	.code16
300
-1:
300
+p2r_rmode:
301
 	/* Switch to real mode */
301
 	/* Switch to real mode */
302
 	movl	%cr0, %eax
302
 	movl	%cr0, %eax
303
 	andb	$0!CR0_PE, %al
303
 	andb	$0!CR0_PE, %al
400
 
400
 
401
 	/* Switch to protected mode and move register dump to PM stack */
401
 	/* Switch to protected mode and move register dump to PM stack */
402
 	movl	$PC_OFFSET_END, %ecx
402
 	movl	$PC_OFFSET_END, %ecx
403
-	pushl	$1f
403
+	pushl	$pc_pmode
404
 	jmp	real_to_prot
404
 	jmp	real_to_prot
405
 	.section ".text", "ax", @progbits
405
 	.section ".text", "ax", @progbits
406
 	.code32
406
 	.code32
407
-1:
407
+pc_pmode:
408
 	/* Call function */
408
 	/* Call function */
409
 	leal	PC_OFFSET_IX86(%esp), %eax
409
 	leal	PC_OFFSET_IX86(%esp), %eax
410
 	pushl	%eax
410
 	pushl	%eax
413
 
413
 
414
 	/* Switch to real mode and move register dump back to RM stack */
414
 	/* Switch to real mode and move register dump back to RM stack */
415
 	movl	$PC_OFFSET_END, %ecx
415
 	movl	$PC_OFFSET_END, %ecx
416
-	pushl	$1f
416
+	pushl	$pc_rmode
417
 	jmp	prot_to_real
417
 	jmp	prot_to_real
418
 	.section ".text16", "ax", @progbits
418
 	.section ".text16", "ax", @progbits
419
 	.code16
419
 	.code16
420
-1:	
420
+pc_rmode:
421
 	/* Reload GDT and IDT, restore registers and flags and return */
421
 	/* Reload GDT and IDT, restore registers and flags and return */
422
 	movw	%sp, %bp
422
 	movw	%sp, %bp
423
 	data32 lgdt (%bp)
423
 	data32 lgdt (%bp)
475
 
475
 
476
 	/* Switch to real mode and move register dump to RM stack  */
476
 	/* Switch to real mode and move register dump to RM stack  */
477
 	movl	$( RC_OFFSET_RETADDR + 4 /* function pointer copy */ ), %ecx
477
 	movl	$( RC_OFFSET_RETADDR + 4 /* function pointer copy */ ), %ecx
478
-	pushl	$1f
478
+	pushl	$rc_rmode
479
 	jmp	prot_to_real
479
 	jmp	prot_to_real
480
 	.section ".text16", "ax", @progbits
480
 	.section ".text16", "ax", @progbits
481
 	.code16
481
 	.code16
482
-1:
482
+rc_rmode:
483
 	/* Call real-mode function */
483
 	/* Call real-mode function */
484
 	popl	rc_function
484
 	popl	rc_function
485
 	popal
485
 	popal
491
 
491
 
492
 	/* Switch to protected mode and move register dump back to PM stack */
492
 	/* Switch to protected mode and move register dump back to PM stack */
493
 	movl	$RC_OFFSET_RETADDR, %ecx
493
 	movl	$RC_OFFSET_RETADDR, %ecx
494
-	pushl	$1f
494
+	pushl	$rc_pmode
495
 	jmp	real_to_prot
495
 	jmp	real_to_prot
496
 	.section ".text", "ax", @progbits
496
 	.section ".text", "ax", @progbits
497
 	.code32
497
 	.code32
498
-1:
498
+rc_pmode:
499
 	/* Restore registers and return */
499
 	/* Restore registers and return */
500
 	popal
500
 	popal
501
 	ret
501
 	ret

Loading…
Cancel
Save