OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 6:35 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Getting Back into Osdev
PostPosted: Mon Nov 25, 2013 6:29 pm 
Offline
Member
Member

Joined: Fri Jul 23, 2010 8:26 am
Posts: 53
Finally decided to get back into Osdev after a two year hiatus now that I have a lot more time on my hands. :) This time though, I am using Linux (gcc, etc) instead of Windows (visual studio) as my development environment. This resulted in changing all of the inline assembly in my kernel to the GCC AT&T format, not difficult but time consuming. The kernel now compiles. Haven't been able to run it yet though, because of boot problems. Originally, I was linking to a binary because my custom-built boot loader expects a PE and I'm no longer using Windows as a development environment. So I just made a slight modification to the boot loader to load a flat binary. Problem was it didn't work, and I figured out that it was due to 16-bit addressing restrictions, the kernel was coming out as a 90kB file... So I have spent the last few days unsuccessfully trying to get grub to work, but it won't recognize my multiboot header for whatever reason. I don't know why, it occupies the first 12 bytes of the file (now an ELF file) and contains everything it should have for GRUB legacy as far as I can tell. Then I realized that the ELF file was only 5kB! All I have to do is get my working boot loader to parse ELF files and its all good :). No need to figure out grub and I am back to 100% my own software. Shouldn't be too difficult to program, my kernel already has a working ELF loader, I did it once, I can certainly do it again.

Jacob


Top
 Profile  
 
 Post subject: Re: Getting Back into Osdev
PostPosted: Mon Nov 25, 2013 6:52 pm 
Offline
Member
Member
User avatar

Joined: Mon Nov 05, 2012 8:31 pm
Posts: 286
Location: New Zealand
Welcome back!

What are you going to do if your kernel gets too big to load with your bootloader (due to 16-bit addressing restrictions)? That's one of my worries at the moment.

_________________
Currently developing Lithium OS (LiOS).

Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."


Top
 Profile  
 
 Post subject: Re: Getting Back into Osdev
PostPosted: Mon Nov 25, 2013 8:23 pm 
Offline
Member
Member

Joined: Fri Jul 23, 2010 8:26 am
Posts: 53
I have 64kB to play with and with the ELF format, I am only at 5kB and am getting to the point where other modules could be loaded separately after the kernel, by the kernel, all in protected mode.

Jacob


Top
 Profile  
 
 Post subject: Re: Getting Back into Osdev
PostPosted: Tue Nov 26, 2013 7:38 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 30, 2013 8:11 am
Posts: 70
Nice to hear that!
I am new here.
Quote:
This time though, I am using Linux (gcc, etc) instead of Windows (visual studio) as my development environment

Great! :twisted: (VS is a decent IDE, for all sorts of things, but most osdeving sites assume that you're on a UNIX-like environment.
Even this wiki.)
Quote:
the kernel was coming out as a 90kB file

90KB? Wow. (Huge amount of strings? data? functionality?)
Quote:
my kernel already has a working ELF loader

Great! Congrats! =D> (I am still struggling with binaries. :P )

_________________
When you say, "I wrote a program that crashed Windows," people just stare at you blankly and say, "Hey, I got those with the system, for free." - Linus Torvalds
64 bit Kernel in early development
http://github.com/nerdguy12/core64


Top
 Profile  
 
 Post subject: Re: Getting Back into Osdev
PostPosted: Wed Nov 27, 2013 2:32 pm 
Offline
Member
Member

Joined: Fri Jul 23, 2010 8:26 am
Posts: 53
Actually, it turned out that it was linking to 5kB because it was only linking the entry file (assembly file containing multiboot info and start point).
So I kept at it with Grub Legacy and finally got it working. The file is coming out at 70kB which is probably due to my inefficiencies when I first started working on this, not to mention there are a lot of files all containing a lot of debugging strings.

Next step is to fix up my ISRs. When using the Windows compiler, I just used naked functions. The plan is to use a common ISR in an assembly file which will call the intended handler using an ISR table. Shouldn't be too difficult, though I always tell myself that and well... it's osdev.

Then I can get back to remaking (3rd complete rewrite) my fat driver, then clean some things up, then upgrade my memory manager, then multitasking, then porting stuff, then self-hosting. :)

Jacob


Top
 Profile  
 
 Post subject: Re: Getting Back into Osdev
PostPosted: Wed Nov 27, 2013 4:45 pm 
Offline
Member
Member
User avatar

Joined: Mon Nov 05, 2012 8:31 pm
Posts: 286
Location: New Zealand
Hoozim wrote:
So I kept at it with Grub Legacy and finally got it working. The file is coming out at 70kB which is probably due to my inefficiencies when I first started working on this, not to mention there are a lot of files all containing a lot of debugging strings.

With my bootloader, I can load up to 400KiB in real mode... why is your limit 64KiB?

_________________
Currently developing Lithium OS (LiOS).

Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."


Top
 Profile  
 
 Post subject: Re: Getting Back into Osdev
PostPosted: Thu Nov 28, 2013 4:06 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 30, 2013 8:11 am
Posts: 70
Quote:
With my bootloader, I can load up to 400KiB in real mode... why is your limit 64KiB?

Wow. Sounds like one day I could make your bootloader load a dos 3d game. (Take Quake 1, implement all the required int 0x21 calls and some other dos things, and make your bootloader load the game? How's that? Assuming the bootloader doesn't boot through a Floppy Disk (since quake is pretty huge) Could be nice for a holiday project)
@OP : Are you in Real Mode or Protected Mode or Long Mode or Virtual 8086 Mode or Unreal Mode?
Seeing that you're using GCC, it seems you're either in PMode or Long Mode.
Why that 64KB Limit?

_________________
When you say, "I wrote a program that crashed Windows," people just stare at you blankly and say, "Hey, I got those with the system, for free." - Linus Torvalds
64 bit Kernel in early development
http://github.com/nerdguy12/core64


Top
 Profile  
 
 Post subject: Re: Getting Back into Osdev
PostPosted: Fri Dec 06, 2013 9:28 pm 
Offline
Member
Member

Joined: Fri Jul 23, 2010 8:26 am
Posts: 53
Sorry for the late reply, been very busy. The reason for the 64kB limit has to do with the way my boot loader handles 16-bit segmentation. I could probably change it fairly easily but I have GRUB working beautifully and with limited time for this, I would much rather spend it on my kernel and userland software. I am getting fairly close to being able to port software over to it :) .

Jacob


Top
 Profile  
 
 Post subject: Re: Getting Back into Osdev
PostPosted: Fri Dec 06, 2013 11:29 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 30, 2013 8:11 am
Posts: 70
If I get you right, you load the kernel in Real Mode in a segment and then copy it over to the 1MB Mark (Or whatever) using
a rep movsd. I used that method for my 32 bit Kernel.
Quote:
port software over to it

I would want to see GCC one day running on it. :D

_________________
When you say, "I wrote a program that crashed Windows," people just stare at you blankly and say, "Hey, I got those with the system, for free." - Linus Torvalds
64 bit Kernel in early development
http://github.com/nerdguy12/core64


Top
 Profile  
 
 Post subject: Re: Getting Back into Osdev
PostPosted: Sat Dec 07, 2013 6:59 pm 
Offline
Member
Member

Joined: Fri Jul 23, 2010 8:26 am
Posts: 53
That's exactly what I do, I load it in real mode. Switch to protected mode and copy it all over the 1mB mark. I can't wait to get GCC running on it!

Jacob


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 39 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