Real Mode Emulator
- thepowersgang
- Member
- Posts: 734
- Joined: Tue Dec 25, 2007 6:03 am
- Libera.chat IRC: thePowersGang
- Location: Perth, Western Australia
- Contact:
Real Mode Emulator
Over the last few days I have been working on a piece of code that emulates a real mode environment in protected mode.
I have not completed it yet but I can call at least on BIOS interrupt (Int 0x10, AH=0xF) without running into errors.
I would like an opinion of it from you guys.
http://aw-home.dyndns.org/wiki/index.ph ... e_Emulator - Entry on my site (self hosted so may not be up)
Attached is the source of the emulator itself without the testing kernel, I plan to post a full kernel on my website.
[EDIT 2014-03-13]
The above code is so old, it's legally allowed to drink (not really)
If you're interested in something recent, look at http://git.mutabah.net/rme2.git
I have not completed it yet but I can call at least on BIOS interrupt (Int 0x10, AH=0xF) without running into errors.
I would like an opinion of it from you guys.
http://aw-home.dyndns.org/wiki/index.ph ... e_Emulator - Entry on my site (self hosted so may not be up)
Attached is the source of the emulator itself without the testing kernel, I plan to post a full kernel on my website.
[EDIT 2014-03-13]
The above code is so old, it's legally allowed to drink (not really)
If you're interested in something recent, look at http://git.mutabah.net/rme2.git
- Attachments
-
- realModeEmu_0.2.zip
- Real Mode Emulator - Incomplete Version (Some opcodes have problems or are unimplemented)
- (7.34 KiB) Downloaded 331 times
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Re: Real Mode Emulator
why not just use virtual 8086 mode?
Re: Real Mode Emulator
@OP - Looks great, has support for the opcode prefixes and segment selectors. If I have time I'll try and incorporate this into my OS. Are you making the source Public Domain?
iammisc: There are a lot of reasons people won't use VM86 mode. Long mode disables access to VM86 (which is why I'm interested), for one.
iammisc: There are a lot of reasons people won't use VM86 mode. Long mode disables access to VM86 (which is why I'm interested), for one.
"Sufficiently advanced stupidity is indistinguishable from malice."
-
- Posts: 22
- Joined: Mon Dec 04, 2006 5:34 pm
Re: Real Mode Emulator
Nice piece of code, however right now there's no copyright information, meaning the code has "All rights reserved" and shouldn't be used anywhere without the author's approval.
Still, I guess it would be interesting for a few things... If it gets on public domain, I would definitly integrate it in my OS (which means I may fix things in it, and send fixes to the author )
EDIT: found code license there : http://aw-home.dyndns.org/wiki/index.ph ... ects:About
Still, I guess it would be interesting for a few things... If it gets on public domain, I would definitly integrate it in my OS (which means I may fix things in it, and send fixes to the author )
EDIT: found code license there : http://aw-home.dyndns.org/wiki/index.ph ... ects:About
All code on this website is free to be used for reference and can be used in a non-commercial project given that proper recognition is given to the original author (myself), thePowersGang or John Hodge.
- thepowersgang
- Member
- Posts: 734
- Joined: Tue Dec 25, 2007 6:03 am
- Libera.chat IRC: thePowersGang
- Location: Perth, Western Australia
- Contact:
Re: Real Mode Emulator
You are all allowed to use the code for your projects although if it goes commercial (Windows/Apple Commercial not linux) I would like some proper recognition.
As for features only some prefixes are supported. Loops are implemented (REP/LOOP) but segment overrides are not. Eventually I will implement them but I am lacking in time now as the school holidays have just finished and I'm in my last year so work is quite solid.
I would like if you find a bug/unimplemented opcode if you could post it on the talk page on my Wiki (you should be able to post anonymously.
As for features only some prefixes are supported. Loops are implemented (REP/LOOP) but segment overrides are not. Eventually I will implement them but I am lacking in time now as the school holidays have just finished and I'm in my last year so work is quite solid.
I would like if you find a bug/unimplemented opcode if you could post it on the talk page on my Wiki (you should be able to post anonymously.
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Re: Real Mode Emulator
Well, you're making a good progress thepowersgang, but I don't see a reason of emulating real mode. If somebody wants it, he'll just drop off protected mode for a while... yes I know it would be slow, but emulation isn't fast either...
Anyways I don't know about long mode OS'es if they can drop to rmode momentarily, maybe your code'll help in that case
Anyways I don't know about long mode OS'es if they can drop to rmode momentarily, maybe your code'll help in that case
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Derrick operating system: http://derrick.xf.cz (Slovak and English )
- thepowersgang
- Member
- Posts: 734
- Joined: Tue Dec 25, 2007 6:03 am
- Libera.chat IRC: thePowersGang
- Location: Perth, Western Australia
- Contact:
Re: Real Mode Emulator
I made it because I was having problems with dropping from PMode and I couldn't use vm86 without multitasking, and also because I wanted a challenge.
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Re: Real Mode Emulator
I agree, a real mode emulator is the way our project wants to go for accessing BIOS functions (i.e. VESA) from long mode. (Maybe even from 32-bit pmode...)
Nice job! I haven't haven't had the time to test it yet though. One of our project's devs has expressed an interest in making one of these for our project, however if that falls through I'd definately have a look at using this (with the correct copyright information attached, of course!).
Cheers,
James
Nice job! I haven't haven't had the time to test it yet though. One of our project's devs has expressed an interest in making one of these for our project, however if that falls through I'd definately have a look at using this (with the correct copyright information attached, of course!).
Cheers,
James
- thepowersgang
- Member
- Posts: 734
- Joined: Tue Dec 25, 2007 6:03 am
- Libera.chat IRC: thePowersGang
- Location: Perth, Western Australia
- Contact:
Re: Real Mode Emulator
I've just added support for segment overrides (it's a bit of a hack but should be sufficent).
Real Mode Emulator Page
Version is 0.4.2
Real Mode Emulator Page
Version is 0.4.2
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Re: Real Mode Emulator
Nice project - I may be someone else thinking of using it.
I would just be interested to know the following (not trying to play devil's advocate here); if I am thinking of adding support for virtualisation to my OS anyway, does your emulator have any specific benefits? I guess the obvious one is that if running on an older CPU with no virtualisation, you can use your version as a fall-back, but are there any other advantages?
Cheers,
Adam
I would just be interested to know the following (not trying to play devil's advocate here); if I am thinking of adding support for virtualisation to my OS anyway, does your emulator have any specific benefits? I guess the obvious one is that if running on an older CPU with no virtualisation, you can use your version as a fall-back, but are there any other advantages?
Cheers,
Adam
- thepowersgang
- Member
- Posts: 734
- Joined: Tue Dec 25, 2007 6:03 am
- Libera.chat IRC: thePowersGang
- Location: Perth, Western Australia
- Contact:
Re: Real Mode Emulator
The largest reason for this is to replace vm8086 when it's not available, but it could be used to provide kernel level emulation services when running on a non x86 platform.
*idea* Kernel level emulation layer for differing platforms (e.g. PPC, ARM, etc) - Any ideas?
*idea* Kernel level emulation layer for differing platforms (e.g. PPC, ARM, etc) - Any ideas?
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Re: Real Mode Emulator
It's not about real mode being slow, but inheritedly insecure. You really want your OS put in the hands of BIOS routines (that, for al we know, may even switch to pmode themselves)? In fact, there has been at least one implementation by Linux coders to do the same, so they could use the BIOS to do mode switching on modern cards (ATI, nVidia) on PPC machines. So yes, the OP is reinventing the wheel, but hey, aren't we all here?inflater wrote:I don't see a reason of emulating real mode. If somebody wants it, he'll just drop off protected mode for a while... yes I know it would be slow, but emulation isn't fast either...
JAL
Re: Real Mode Emulator
Portability: for running your OS on a different system (with a non-x86 CPU and a PCI gfx card).AJ wrote:if I am thinking of adding support for virtualisation to my OS anyway, does your emulator have any specific benefits? I guess the obvious one is that if running on an older CPU with no virtualisation, you can use your version as a fall-back, but are there any other advantages?
JAL
Re: Real Mode Emulator
OIC - good points!
Cheers,
Adam
Cheers,
Adam
- thepowersgang
- Member
- Posts: 734
- Joined: Tue Dec 25, 2007 6:03 am
- Libera.chat IRC: thePowersGang
- Location: Perth, Western Australia
- Contact:
Re: Real Mode Emulator
Plus you can't preempt real mode, an emulator can be.
Could anyone do some testing of the code for me? I'm a bit lacking in time at the moment but I will try to fix as many bugs as possible.
Could anyone do some testing of the code for me? I'm a bit lacking in time at the moment but I will try to fix as many bugs as possible.
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc