Browse Source

[pcbios] Do not switch to real mode to check for timer interrupt

The currticks() function is called at least once per TCP packet, and
so is performance-critical.  Switching to real mode just to allow the
timer interrupt to fire is expensive when running inside a virtual
machine, and imposes a significant performance cost.

Fix by enabling interrupts without switching to real mode.  This
results in an approximately 100% increase in download speed when
running under KVM.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 years ago
parent
commit
e4593909a8
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      src/arch/i386/interface/pcbios/bios_timer.c

+ 4
- 4
src/arch/i386/interface/pcbios/bios_timer.c View File

@@ -44,10 +44,10 @@ static unsigned long bios_currticks ( void ) {
44 44
 	uint8_t midnight;
45 45
 
46 46
 	/* Re-enable interrupts so that the timer interrupt can occur */
47
-	__asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
48
-					   "nop\n\t"
49
-					   "nop\n\t"
50
-					   "cli\n\t" ) : : );
47
+	__asm__ __volatile__ ( "sti\n\t"
48
+			       "nop\n\t"
49
+			       "nop\n\t"
50
+			       "cli\n\t" );
51 51
 
52 52
 	get_real ( ticks, BDA_SEG, 0x006c );
53 53
 	get_real ( midnight, BDA_SEG, 0x0070 );

Loading…
Cancel
Save