How to use VESA VBE in qemu

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
michael
Posts: 12
Joined: Fri Nov 12, 2021 1:09 am

How to use VESA VBE in qemu

Post by michael »

My os runs well on bochs but not in qemu, and here is my code:

Code: Select all

void Start_Kernel(void){
	int *addr=(int*)0xffff800000a00000;
	for(int i=0;i<1440*20;i++){
		*addr=0x0032FA00;
		addr+=1;		
	}
	while(1);
}
This code will simply print a green stripe on the screen

According to my debug, I found that both qemu and Bochs are able to reach the while(1) successfully, but there're nothing printed on the qemu, while it runs correctly on Bochs. I now doubt it is the problem of SVGA mode(since I set SVGA into VESA VBE), and I wonder how can I let qemu support VESA VBE mode.

Here is the code I use to setup VESA VBE mode:

Code: Select all

   mov ax,4F02h
	mov bx,4180h
	int 10h
I already setup a pagetable and link the physical address of video memory(0xe0000000) with the linear address(0xffff800000a00000).

And here is the command I use to load os in to qemu:

Code: Select all

qemu-system-x86_64 -s -S -fda a.img
Here is my bochsrc file

Code: Select all

###############################################################
# Configuration file for Bochs
###############################################################

# how much memory the emulated machine will have
megs: 32

# filename of ROM images
romimage: file=/usr/share/bochs/BIOS-bochs-latest
vgaromimage: file=/usr/share/vgabios/vgabios.bin

# what disk images will be used
floppya: 1_44=a.img, status=inserted

# hard disk
#ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
# !! Remember to change these if the hd img is changed:
#    1. include/sys/config.h::MINOR_BOOT
#    2. boot/include/load.inc::ROOT_BASE
#    3. Makefile::HD
#    4. commands/Makefile::HD
#ata0-master: type=disk, path="80m.img", mode=flat, cylinders=162, heads=16, spt=63

# choose the boot disk.
boot: floppy

# where do we send log messages?
log: bochsout.txt

# disable the mouse
mouse: enabled=0

# enable key mapping, using US layout as default.
keyboard:  keymap=/usr/share/bochs/keymaps/x11-pc-us.map
I've put the results in Bochs(cap2.png) and qemu(cap1.png) on the attachment.
Attachments
cap1.PNG
cap2.PNG
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: How to use VESA VBE in qemu

Post by Octocontrabass »

michael wrote:I already setup a pagetable and link the physical address of video memory(0xe0000000)
Are you sure this is the physical address of video memory in QEMU?
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: How to use VESA VBE in qemu

Post by nexos »

I already setup a pagetable and link the physical address of video memory(0xe0000000)
That doesn't look right. In QEMU, video memory is at 0xFD000000 (IIRC).
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
Post Reply