Re: EFI and the future of BIOS
Posted: Fri Sep 09, 2011 10:23 pm
Hi,
For a simple emulator, on average you're probably going to need about 30 instructions to emulate one instruction, so it's going to be about 30 times slower than real hardware. If changing the window into screen memory is 100 emulated instructions then it's going to cost 3000 real instructions. On a slow CPU (e.g. 2 cycles per instruction with 100 million cycles per second) that might take about 60 us. Even if the estimate is wrong and it's 100 times slower you'd still be able to do it 60 times per second.
However; this topic is about EFI and EFI doesn't have VBE. Basically, by the time your OS is "ready" (maybe 10 years) the real mode emulator will be useless for almost all end-users (who would've all shifted to EFI anyway). Rather than spending time implementing an "eventually useless anyway" emulator, it might be a lot more sensible to spend that time implementing a basic native video driver (e.g. mode setting and not much else) for Intel's video (which will be more useful for end-users in the long run).
Cheers,
Brendan
It wouldn't be too hard to estimate. For almost all video cards, there'd be a "display start register" or maybe two of them (e.g. "display start high register" and "display start low register"). VBE would have some "if(function_number == ??)" code then some parameter checking, then some shift & mask operations, and a few writes (to IO ports or memory mapped registers). With some saving/loading registers on the stack and other misc. overhead I'd estimate around 100 instructions.DavidCooper wrote:The speed of emulating code to change screen mode isn't at all important, but when changing the window into the screen memory or changing the first byte to display (for smooth scrolling in any direction) it wants to be reasonably fast, so I'd be interested to know if you've discovered how many instructions typically need to be emulated on each call for these functions to get a better idea of how important the speed issue actually might be - at the moment I don't know if it's worth putting in the effort to make a complex, fast emulator or if a simple, slow one would do the job without a noticeable delay. Have you tested your emulator to see how quickly it emulates code compared with running the same code directly, and how well do you think it'll compare with other emulators?
For a simple emulator, on average you're probably going to need about 30 instructions to emulate one instruction, so it's going to be about 30 times slower than real hardware. If changing the window into screen memory is 100 emulated instructions then it's going to cost 3000 real instructions. On a slow CPU (e.g. 2 cycles per instruction with 100 million cycles per second) that might take about 60 us. Even if the estimate is wrong and it's 100 times slower you'd still be able to do it 60 times per second.
However; this topic is about EFI and EFI doesn't have VBE. Basically, by the time your OS is "ready" (maybe 10 years) the real mode emulator will be useless for almost all end-users (who would've all shifted to EFI anyway). Rather than spending time implementing an "eventually useless anyway" emulator, it might be a lot more sensible to spend that time implementing a basic native video driver (e.g. mode setting and not much else) for Intel's video (which will be more useful for end-users in the long run).
Cheers,
Brendan