瀏覽代碼

[librm] Do not preserve flags unnecessarily

No callers of prot_to_phys, phys_to_prot, or intr_to_prot require the
flags to be preserved.  Remove the unnecessary pushfl/popfl pairs.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 年之前
父節點
當前提交
5fbfe50ccb
共有 1 個文件被更改,包括 11 次插入17 次删除
  1. 11
    17
      src/arch/x86/transitions/librm.S

+ 11
- 17
src/arch/x86/transitions/librm.S 查看文件

@@ -506,7 +506,7 @@ rm_gdtr:
506 506
  *
507 507
  * Switch from 32-bit protected mode with physical addresses to 32-bit
508 508
  * protected mode with virtual addresses.  %esp is adjusted to a
509
- * virtual address.  All other registers and flags are preserved.
509
+ * virtual address.  All other registers are preserved.
510 510
  *
511 511
  * The return address for this function should be a 32-bit physical
512 512
  * (sic) address.
@@ -517,8 +517,7 @@ rm_gdtr:
517 517
 	.code32
518 518
 	.globl phys_to_prot
519 519
 phys_to_prot:
520
-	/* Preserve registers and flags */
521
-	pushfl
520
+	/* Preserve registers */
522 521
 	pushl	%eax
523 522
 	pushl	%ebp
524 523
 
@@ -537,12 +536,11 @@ phys_to_prot:
537 536
 	subl	%ebp, %esp
538 537
 
539 538
 	/* Adjust return address to a virtual address */
540
-	subl	%ebp, 12(%esp)
539
+	subl	%ebp, 8(%esp)
541 540
 
542
-	/* Restore registers and flags, and return */
541
+	/* Restore registers and return */
543 542
 	popl	%ebp
544 543
 	popl	%eax
545
-	popfl
546 544
 	ret
547 545
 
548 546
 	/* Expose as _phys_to_virt for use by COMBOOT */
@@ -554,7 +552,7 @@ phys_to_prot:
554 552
  *
555 553
  * Switch from 32-bit protected mode with virtual addresses to 32-bit
556 554
  * protected mode with physical addresses.  %esp is adjusted to a
557
- * physical address.  All other registers and flags are preserved.
555
+ * physical address.  All other registers are preserved.
558 556
  *
559 557
  * The return address for this function should be a 32-bit virtual
560 558
  * (sic) address.
@@ -564,14 +562,13 @@ phys_to_prot:
564 562
 	.section ".text.prot_to_phys", "ax", @progbits
565 563
 	.code32
566 564
 prot_to_phys:
567
-	/* Preserve registers and flags */
568
-	pushfl
565
+	/* Preserve registers */
569 566
 	pushl	%eax
570 567
 	pushl	%ebp
571 568
 
572 569
 	/* Adjust return address to a physical address */
573 570
 	movl	VIRTUAL(virt_offset), %ebp
574
-	addl	%ebp, 12(%esp)
571
+	addl	%ebp, 8(%esp)
575 572
 
576 573
 	/* Switch to physical code segment */
577 574
 	cli
@@ -589,10 +586,9 @@ prot_to_phys:
589 586
 	movw	%ax, %ss
590 587
 	addl	%ebp, %esp
591 588
 
592
-	/* Restore registers and flags, and return */
589
+	/* Restore registers and return */
593 590
 	popl	%ebp
594 591
 	popl	%eax
595
-	popfl
596 592
 	ret
597 593
 
598 594
 	/* Expose as _virt_to_phys for use by COMBOOT */
@@ -605,7 +601,7 @@ prot_to_phys:
605 601
  * Switch from 32-bit protected mode with a virtual code segment and
606 602
  * either a physical or virtual stack segment to 32-bit protected mode
607 603
  * with normal virtual addresses.  %esp is adjusted if necessary to a
608
- * virtual address.  All other registers and flags are preserved.
604
+ * virtual address.  All other registers are preserved.
609 605
  *
610 606
  * The return address for this function should be a 32-bit virtual
611 607
  * address.
@@ -616,8 +612,7 @@ prot_to_phys:
616 612
 	.code32
617 613
 	.globl intr_to_prot
618 614
 intr_to_prot:
619
-	/* Preserve registers and flags */
620
-	pushfl
615
+	/* Preserve registers */
621 616
 	pushl	%eax
622 617
 
623 618
 	/* Check whether stack segment is physical or virtual */
@@ -636,9 +631,8 @@ intr_to_prot:
636 631
 	movw	%ax, %ss
637 632
 	subl	VIRTUAL(virt_offset), %esp
638 633
 1:
639
-	/* Restore registers and flags, and return */
634
+	/* Restore registers and return */
640 635
 	popl	%eax
641
-	popfl
642 636
 	ret
643 637
 
644 638
 	/* Expose as _intr_to_virt for use by GDB */

Loading…
取消
儲存