Page 1 of 1
[solved] qemu not working ?
Posted: Sun Feb 28, 2010 10:15 am
by donkeeland
Hello,
I don't think that's qemu is bugged...
I can't correctly display text into the 80x35 VGA buffer.
I follow the
http://wiki.osdev.org/Bare_Bones tutorial and it wasn't working on qemu.
Only the kernel.c is little bit different.
- kernel.c
- (768 Bytes) Downloaded 76 times
Finally i decide to fill all the screen and y add a surprise, i can't write every where in the screen like that.
i should do some thing like that for be sure to write char:
Code: Select all
for(int i=0; i < 150; i++)
*((char*)0xb8000) = 'A';
The last line of Y is only half writted...
Since one week i can;t get things correctly working on qemu.
But if i directly run the kernel on my hardware there is no problem without the for loop.
I test it on three computer:
- my computer(intel core 2 quad): qemu=NG hard=OK
- my laptop (AMD): qemu=NG hard=OK
- a friend computer (???): qemu=OK hard=???
qemu:
QEMU PC emulator version 0.11.0 (qemu-kvm-0.11.0), Copyright (c) 2003-2008 Fabrice Bellard
Linux dell 2.6.31-19-generic #56-Ubuntu SMP Thu Jan 28 01:26:53 UTC 2010 i686 GNU/Linux
Can you tell me if you have some idea about the problem and/or tell test it for see if you have the same problem.
Thank's
Re: qemu not working ?
Posted: Wed Mar 03, 2010 10:07 am
by js
donkeeland wrote:qemu-kvm-0.11.0
Make sure your hardware & kernel support kvm. AFAIK, this is the case only for recent stuff.
Also, try re-installing qemu via your distro's package manager, or even re-compiling it.
Anyway, like any software, QEMU isn't bug-free, I myself have some random bugs that sometimes occur when I run my OS (but, without re-compiling my OS, sometimes don't).
Re: qemu not working ?
Posted: Thu Mar 04, 2010 7:17 am
by qw
donkeeland wrote:Code: Select all
for(int i=0; i < 150; i++)
*((char*)0xb8000) = 'A';
Are you writing 'A' in the upper left corner of the screen 150 times?
Re: qemu not working ?
Posted: Thu Mar 04, 2010 9:30 am
by Combuster
Without colour, I might add...
Re: qemu not working ?
Posted: Thu Mar 04, 2010 12:49 pm
by Creature
So basically you're posting here because you think QEMU is broken, whilst you just posted code that puts the character A with a black background AND a black foreground in the SAME spot 150 times?
Re: qemu not working ?
Posted: Wed Mar 10, 2010 4:50 am
by donkeeland
Creature wrote:So basically you're posting here because you think QEMU is broken, whilst you just posted code that puts the character A with a black background AND a black foreground in the SAME spot 150 times?
I'm not posting here because is broken. I don't think that is it broken.
Yes, i do 150 times because a the first time it's not always works
So, after write memory after 150 times, the memory remember data ...
Re: qemu not working ?
Posted: Wed Mar 10, 2010 5:34 am
by mutex
That was a good one!
Re: qemu not working ?
Posted: Wed Mar 10, 2010 9:35 am
by Creature
donkeeland wrote:Creature wrote:So basically you're posting here because you think QEMU is broken, whilst you just posted code that puts the character A with a black background AND a black foreground in the SAME spot 150 times?
I'm not posting here because is broken. I don't think that is it broken.
Yes, i do 150 times because a the first time it's not always works
So, after write memory after 150 times, the memory remember data ...
Memory doesn't need 150 writes to remember what's stored in there, you only write once. Secondly, if you write a BLACK character to a BLACK background, of course you won't see anything.
Re: qemu not working ?
Posted: Thu Mar 11, 2010 8:26 am
by donkeeland
I know that the memory need only one write for remember the data and it's not a color problem.
For more visibility i shorten the sour to the minimum:
Code: Select all
void kmain(void* mbd, unsigned int magic )
{
unsigned char *videoram = (unsigned char *) 0xb8000;
int i;
for(i=0; i<150; i++)
{
videoram[0] = 'A';
videoram[1] = 0x0F; /* char white on black */
}
}
If i replace the 150 by 1, the character never display....
Re: qemu not working ?
Posted: Thu Mar 11, 2010 1:27 pm
by mutex
Okay...
What might be the case is that the emulator only update screen after N cycles.. That can be the case in Bochs some times when it comes to the display atleast. That is the window of the emulator output is not updated, but the state of the memory is correct. If you lower the cycles/refresh rate it might help.
Anyway your code should work like a charm on a real pc..
try doing like this;
Code: Select all
video[0] = 'A';
video[1] = 0x0f;
while(1);
I dont know quemu settings, but in bochs there is a config file option to set the refresh rate of the display.
-
Thomas
Re: qemu not working ?
Posted: Wed Mar 17, 2010 9:10 am
by donkeeland
Thanks thomasnilsen
I though that it was a problem with qemu.
But because i'm noob in kernel programming i was septic about a possibly qemu failure.
I searched about qemu vga settings, i found nothings good.
So finally i installed bochs and it's works pretty good !
Re: [solved] qemu not working ?
Posted: Fri Mar 19, 2010 11:08 am
by florianh80
I've got the same "problem" here a while ago.
A solution for this is to unload the kvm modules (kvm_intel or kvm_amd or whatever).
After that everything works fine with qemu.
Flo
Re: [solved] qemu not working ?
Posted: Fri Mar 19, 2010 7:18 pm
by donkeeland
florianh80 wrote:A solution for this is to unload the kvm modules (kvm_intel or kvm_amd or whatever).
After that everything works fine with qemu.
You're right, i try and it's work fine.
I prefer this solution because of the send_key command !!!