User talk:Deafear: Difference between revisions

From QEMU
(Created page with 'An idea on emulation 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 th…')
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
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


The idea is to enhance the emulator to
The idea is to enhance the emulator to


1. A parser parses a kernel source written in a high level programming language or scripting language such as say ruby
** A parser parses a kernel source written in a high level programming language or scripting language such as say ruby
2. Translate it to machine language code by either mapping to/or building a machine language binary stream based on the input parsed
** Translate it to machine language code by either mapping to/or building a machine language binary stream based on the input parsed
3. Send the machine language code down to the real processor
** Send the machine language code down to the real processor
4. Get it executed by the physical processor
** Get it executed by the physical processor
5. Get the response back to the virtual machine
** 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:
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:
Line 51: Line 56:
   36.      protModeObj.scanPCIBuses()   
   36.      protModeObj.scanPCIBuses()   
   37.      protModeObj.enterInfiniteLoop()   
   37.      protModeObj.enterInfiniteLoop()   
kernel.vm:
------------------
#!/usr/bin/vm_emulator
import emulator
registers = {}
registers['ds'] = 0x07c0
registers['es'] = 0x07c0
registers['ss'] = 0x8000
registers['sp'] = 0xf000
#
# Real mode part
#
def main():
      realModeObj = emulator.RealMode(org = 0x7c00, registers, boot = 'floppy')
      codeSegmentDetails = [0,0xFFFFF,CS_ACCES,1101b]
      dataSegmentDetails = [0,0xFFFFF,CS_ACCES,1101b]
      realModeObj.setupGDT(codeSegmentDetails, dataSegmentDetails)
      realModeObj.disableInterrupts()
      realModeObj.loadGDT()
      realModeObj.enterProtectedMode()
      protModeObj = emulator.protectedMode()
      protModeObj.initMem()
      protModeObj.initVideo()
      protModeObj.idtInstall()
      protModeObj.isrsInstall()
      protModeObj.keyboardInstall()
      protModeObj.scanPCIBuses()
      protModeObj.enterInfiniteLoop()




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

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