Emulators

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
System123
Member
Member
Posts: 196
Joined: Mon Jul 07, 2008 1:25 am

Emulators

Post by System123 »

Hi

I am currently still battling with my OS. It runs perfectly on Bochs, VMWare, InnoTek Virtual Box, and QEMU. However, it does not run properly on either of my computers. It gets to a point and stops. Is there another Emulator which I can try which will behave like my pc so I don't have to reboot every 5minutes to check if my changes worked.

Thanks
Gizmic OS
Currently - Busy with FAT12 driver and VFS
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Re: Emulators

Post by inflater »

Check the stack! :)
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: Emulators

Post by neon »

Virtual PC?
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
System123
Member
Member
Posts: 196
Joined: Mon Jul 07, 2008 1:25 am

Re: Emulators

Post by System123 »

Tried it aswel same problem.

@Inflater: I have checked the stack, In fact I have moved my stack to after the kernel now. It functions fine on the emulator so the only thing I can think of is that it looses itself when running on the pc.
Gizmic OS
Currently - Busy with FAT12 driver and VFS
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Re: Emulators

Post by 01000101 »

Do you initializing all your variables, arrays, and structures before use? One of the core differences between emulators and real hardware is that there is usually garbage left in memory on real computers. If you don't clear memory areas before use, you may be reading garbage values or reading code past the 'end of strings/buffers' when they should be null terminated.
User avatar
kmtdk
Member
Member
Posts: 263
Joined: Sat May 17, 2008 4:05 am
Location: Cyperspace, Denmark
Contact:

Re: Emulators

Post by kmtdk »

well
have you entered pmode, and a20 activatede ( just to be sure), and as 01000101 says, are you sure about what values you are reading( not garbage values), and are you sure about loading sectors ( is it hdd, fdd, or usb ???), cause if it is fdd ( and your own driver) then it migth work perfect on emu, but not real.

i can test it when i have time ..
if you have a image, and can tell me what is supossed to happen ....

KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Emulators

Post by Love4Boobies »

You're right about the A20 gate. I know Bochs has it enabled when its BIOS transfers control to the OS (as opposed to what normal BIOSes do). Is this the same for QEMU, Virtual PC, VMWare, VirtualBox, etc?
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
System123
Member
Member
Posts: 196
Joined: Mon Jul 07, 2008 1:25 am

Re: Emulators

Post by System123 »

I enable A20, and go to PMODE, It jumps to the kernel fine and initilises my GDT, IDT, ISR, Keyboard. The 2nd stage loader is not my own code. I borrowed it and I will make my own at a later stage. It enables interrupts and the keyboard works fine but it doesn't continue executing after that. after STI I have code to clear the screen this never gets called though on my PC.

I will sit and check my variables. I thought maybe the Pascal stack frame it puts around procedures is causing the error? could this be true?
Gizmic OS
Currently - Busy with FAT12 driver and VFS
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: Emulators

Post by neon »

after STI I have code to clear the screen this never gets called though on my PC.
This may be an indication that the fault lies in a hardware interrupt handler. And, if it fails in Virtual PC (Which uses hardware support) then test your system in Virtual PC by making changes to it instead of real hardware for now while you try to pinpoint where the problem is at.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
System123
Member
Member
Posts: 196
Joined: Mon Jul 07, 2008 1:25 am

Re: Emulators

Post by System123 »

It works fine on all my emulators. I am trying to find the error.
Gizmic OS
Currently - Busy with FAT12 driver and VFS
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Emulators

Post by Love4Boobies »

System123 wrote:It works fine on all my emulators. I am trying to find the error.
Of the above, only Bochs is an emulator. The rest are virtual machines.

Interrupt support should be accurate for these programs, though. If you don't STI, does it still happen?
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
System123
Member
Member
Posts: 196
Joined: Mon Jul 07, 2008 1:25 am

Re: Emulators

Post by System123 »

If I don't STI then it carries on as it should. It clears the screen and print my headers.
Gizmic OS
Currently - Busy with FAT12 driver and VFS
Post Reply