CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2008
    Location
    Land Of Sand
    Posts
    7

    Lightbulb IO level of abstraction in a Virtual Machine

    First, it is my pleasure to be a new member of this community

    Second, I am reading these days about virtual machines, and their architectures. I decided to write my own very simple easy to program hypothetical VM. I could easily imagine the level of abstraction needed to design my processor ISA and memory system. But I need some information about the IO interface.

    Which architecture is easier to implement and which of them is easier to program? : Memory mapped IO or port mapped IO. Basically, I just want to support keyboard input and simple screen output like a console, of course my VM environment is going to be implemented on top of windows .

    Sorry if what I am asking about is not clear enough.

    Best regards...
    Khaled Alshaya, CS student at KFUPM ..... Just another programmer!

  2. #2
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: IO level of abstraction in a Virtual Machine

    There are many different types of "Virtual Machines". At one end of the spectrum you have language environments such as the Javas VM. At the other end, you have complete system virtualization [VirtualPC, VMWare, Citrix/Zen]

    So the first questions is which type are you considering implementing?
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  3. #3
    Join Date
    Dec 2008
    Location
    Land Of Sand
    Posts
    7

    Smile Re: IO level of abstraction in a Virtual Machine

    I am not interested in an emulation of a real processor. What I am trying to design is a hypothetical machine like the Java virtual machine. I am not trying to do something big like JVM. My purpose is educational in first place. So the environment could contain an assembler, debugger and of course the executer. Maybe the best available example is the Ant Machine: The Ant Virtual Machine

    Thanks for your help...
    Last edited by Khaled.Alshaya; December 17th, 2008 at 10:28 AM.
    Khaled Alshaya, CS student at KFUPM ..... Just another programmer!

  4. #4
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: IO level of abstraction in a Virtual Machine

    Quote Originally Posted by Khaled.Alshaya View Post
    I am not interested in an emulation of a real processor. What I am trying to design is a hypothetical machine like the Java virtual machine. I am not trying to do something big like JVM. My purpose is educational in first place. So the environment could contain an assembler, debugger and of course the executer. Maybe the best available example is the Ant Machine: The Ant Virtual Machine

    Thanks for your help...
    Then start with a simple set of 2 instructions, one to write a character and one to read a character.

    Remember you will be defining the virtual architecture. Rather than attempting to come up with one on your own, it would probably be best to pick one of the 1970's generation microprocessors (8080, 6800, 1802, etc) to identify common instructions.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  5. #5
    Join Date
    Dec 2008
    Location
    Land Of Sand
    Posts
    7

    Smile Re: IO level of abstraction in a Virtual Machine

    Ok, I have a clear idea how the input operation could be done. What about the output?
    Is it a good idea to represent screen in the following way:
    If we assume that the screen of our machine is capable of drawing 80*25 characters. Then an example of output operation could be like this:
    Code:
    out  register, [Address]
    {Op src, des}
    Where [Address] = 0 -> 1999

    So the programmer could write the character where ever he wants on the screen. Is it a good idea?

    I understand from you that port-mapped IO is a better solution in my situation!
    By the way, I took a lot of ideas from the 68K which I studied in computer architecture class two years ago

    Thanks...
    Last edited by Khaled.Alshaya; December 17th, 2008 at 11:27 AM.
    Khaled Alshaya, CS student at KFUPM ..... Just another programmer!

  6. #6
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: IO level of abstraction in a Virtual Machine

    1) That would be one way, but you might want to start with a simple "teletype" style interface [ie a console with no cursor controls, atributes or anything else].

    2) Whay to you think IO needs to be Port or Memory mapped??? It is simpler to just define an INSTRUCTION (as I stated in my original reply). If you are going to use a "mapped" arrangement, then you have tradeoffs. Memory does not NEED any additional instructions (but does require a smart "linker"). Port requires additional instruction(s) - so is at least (probable more) work than a simple instruction.

    3) The 68K is a fairly complex architecture, but not a bad environment.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  7. #7
    Join Date
    Dec 2008
    Location
    Land Of Sand
    Posts
    7

    Re: IO level of abstraction in a Virtual Machine

    Thank you, your posts are very helpful. It is clear now.
    Khaled Alshaya, CS student at KFUPM ..... Just another programmer!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured