How to use VESA VBE in qemu
Posted: Thu Dec 09, 2021 5:17 pm
My os runs well on bochs but not in qemu, and here is my code:
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:
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:
Here is my bochsrc file
I've put the results in Bochs(cap2.png) and qemu(cap1.png) on the attachment.
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);
}
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
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
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