User talk:Deafear: Difference between revisions

From QEMU
No edit summary
No edit summary
 
Line 1: Line 1:
An idea on emulation
Hi I just thought about this
 
Its available in the link: http://thekissinglink.blogspot.com/2011/02/idea-on-emulation.html
 
Reproduced below as-is:
 
Usually emulators read compiled binary kernels in machine language, get them executed and send the results back to virtual machine
Usually emulators read compiled binary kernels in machine language, get them executed and send the results back to virtual machine



Latest revision as of 03:37, 28 February 2011

Hi I just thought about this

Its available in the link: http://thekissinglink.blogspot.com/2011/02/idea-on-emulation.html

Reproduced below as-is:

Usually emulators read compiled binary kernels in machine language, get them executed and send the results back to virtual machine

The idea is to enhance the emulator to

    • A parser parses a kernel source written in a high level programming language or scripting language such as say ruby
    • Translate it to machine language code by either mapping to/or building a machine language binary stream based on the input parsed
    • Send the machine language code down to the real processor
    • Get it executed by the physical processor
    • Get the response back to the virtual machine

This would enable writing kernels in scripting languages which provide higher flexibility. The interpretor takes care of parsing and understanding the requirements provided in the scripting language and builds the right machine language binary stream. We can call these kernels __interpreted kernels__. I can imagine something like below:

view plainprint?

  1. kernel.vm:  
  2. ------------------  
  3.   
  4. #!/usr/bin/vm_emulator  
  5.   
  6. import emulator  
  7.   
  8. registers = {}  
  9.   
 10. registers['ds'] = 0x07c0  
 11. registers['es'] = 0x07c0  
 12. registers['ss'] = 0x8000  
 13. registers['sp'] = 0xf000  
 14.   
 15. #  
 16. # Real mode part  
 17. #  
 18. def main():  
 19.       realModeObj = emulator.RealMode(org = 0x7c00, registers, boot = 'floppy')  
 20.   
 21.       codeSegmentDetails = [0,0xFFFFF,CS_ACCES,1101b]  
 22.       dataSegmentDetails = [0,0xFFFFF,CS_ACCES,1101b]  
 23.   
 24.       realModeObj.setupGDT(codeSegmentDetails, dataSegmentDetails)  
 25.       realModeObj.disableInterrupts()  
 26.       realModeObj.loadGDT()  
 27.       realModeObj.enterProtectedMode()  
 28.   
 29.       protModeObj = emulator.protectedMode()  
 30.   
 31.       protModeObj.initMem()  
 32.       protModeObj.initVideo()  
 33.       protModeObj.idtInstall()  
 34.       protModeObj.isrsInstall()  
 35.       protModeObj.keyboardInstall()  
 36.       protModeObj.scanPCIBuses()  
 37.       protModeObj.enterInfiniteLoop()  


The kernel interpretor interprets this source and builds machine language code for each operation mentioned in the kernel and emulates it accordingly