OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 3:02 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: QEMU Black Screen After Grub Menu
PostPosted: Tue Aug 08, 2017 4:34 pm 
Offline

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


Top
 Profile  
 
 Post subject: Re: QEMU Black Screen After Grub Menu
PostPosted: Tue Aug 08, 2017 5:36 pm 
Offline

Joined: Tue Aug 08, 2017 3:53 pm
Posts: 3
After some more experimentation, I added
Code:
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. :?


Top
 Profile  
 
 Post subject: Re: QEMU Black Screen After Grub Menu
PostPosted: Wed Aug 09, 2017 7:24 am 
Offline
Member
Member

Joined: Thu Aug 13, 2015 4:57 pm
Posts: 384
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"'.


Top
 Profile  
 
 Post subject: Re: QEMU Black Screen After Grub Menu
PostPosted: Wed Aug 09, 2017 1:27 pm 
Offline

Joined: Tue Aug 08, 2017 3:53 pm
Posts: 3
Thanks for the tip, it runs well now and i can get to work on a memory manager now.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 59 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group