Browse Source

[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 years ago
parent
commit
5fbfe50ccb
1 changed files with 11 additions and 17 deletions
  1. 11
    17
      src/arch/x86/transitions/librm.S

+ 11
- 17
src/arch/x86/transitions/librm.S View File

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

Loading…
Cancel
Save