浏览代码

[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 10 年前
父节点
当前提交
03e76c34d8
共有 1 个文件被更改,包括 12 次插入12 次删除
  1. 12
    12
      src/arch/i386/transitions/librm.S

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

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

正在加载...
取消
保存