QEMU Black Screen After Grub Menu

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
lordseanington
Posts: 3
Joined: Tue Aug 08, 2017 3:53 pm

QEMU Black Screen After Grub Menu

Post by lordseanington »

I used the mingw toolset to create a i686-elf cross compiler attempting to follow the Bare Bones and Meaty Skeleton cross compiler. Once it finished building, I built the files with the commands

Code: Select all

i686-elf-g++ -c kernel.cpp -o kernel.o -ffreestanding -O2 -Wall -Wextra -fno-exceptions -fno-rtti
i686-elf-as boot.asm -o boot.o
i686-elf-gcc -T linker.ld -o PinkSeagle.bin -ffreestanding -O2 -nostdlib boot.o kernel.o -lgcc
And then use grub-mkrescue in the Windows Unix Subsystem to create the iso.

My kernel is straight from Bare Bones, and the asm has a modification to accout for the name of the main function being modified in compilation to '_Z11kernel_mainv'. The linking script is also straight from bare bones.

The kernel is checked by grub-file and has a valid multiboot header, and i start up QEMU.
It gets to the grub menu, i hit enter over my operating system and QEMU shows a black screen with a blinking cursor. I saw no errors during building, creating the cross compiler, or from mkrescue, so I'm confused.

Any Help is Appreciated,
My Thanks
Sean
lordseanington
Posts: 3
Joined: Tue Aug 08, 2017 3:53 pm

Re: QEMU Black Screen After Grub Menu

Post by lordseanington »

After some more experimentation, I added

Code: Select all

movl $0x07690748, 0xb8000

to the assembly and Hi displayed as it ought to.

Edit After Toying Around:
Should have toyed around with it a bit longer. Apparently a small error had occurred and i forgot to clean my build environment each time, so it was re-linking with an old kernel.o. The old kernel.o was just to test the cross compiler and did nothing.
Also, for some reason, the modification that i had made to the asm because the compiler dresses up the function name(that previously worked) now does not, and had to use just kernel_main.

I apologize for my stupidity. :?
LtG
Member
Member
Posts: 384
Joined: Thu Aug 13, 2015 4:57 pm

Re: QEMU Black Screen After Grub Menu

Post by LtG »

FYI, using:
extern "C"

will make the c++ compiler not mangle the name, so you can call the function name from c and thus from assembly as well. You should use that for all the functions that you need to call from outside c++, and all "internal" code (code that is not called from outside c++) you should not use 'extern "C"'.
lordseanington
Posts: 3
Joined: Tue Aug 08, 2017 3:53 pm

Re: QEMU Black Screen After Grub Menu

Post by lordseanington »

Thanks for the tip, it runs well now and i can get to work on a memory manager now.
Post Reply