Before I need to worry about any of that (ELF or Kernel loading) I need to get a bin to successfully copy a file into memory and execute it. At this point that is where I have been stuck for the last couple of days...
I don't think I will be using Grub, as I have heard from multiple places that I will eventually be required to come up with a custom bootloader and bootsector for the OS, so I think I am going to try to get that done in the first place. I just hope it isn;t the death of me
Time for a great big necro Thankfully this is actually my topic and I am not some new member.
So, I started working on modOS again and hve made a significant amount of progress in comparison to where I was previously.
At this point I have a basic memory manager in place (malloc, new, new, delete, and free are all implemented), interrupts up and working (PITs and Hardware interrupts), keyboard input (basic stuff, doesn't work with all characters at the moment, but all lower-case characters can be typed and displayed). For the moment I am using bochs to load the kernel and act like a bootloaded (as it does it for me), then I am using the CMOS method to figure out how much memory I have available and breaking that up into at most 64-KB blocks, which I can malloc and free from (in fact I am creating a "virtual" memory address for the keyboard driver I am using -- granted, I haven't implemented paging or virtual memory as of yet -- hopefully soon). For the moment I am using first-fit, but that is just because it is easy and quick to implement. I am planning on recoding it to worst-fit (which actually is better for use as it leaves larger average chunks instead of the possibility of a lot of small holes that don't work for other allocs).
I also have some screen shots to show:
The current boot screen:
And some keyboard input:
With any luck I will get to VGA mode here soon and have some images to show (I will probably do that before paging and virtual memory tables).
For those of you who haven't read through the related threads or simply don't remember, modOS is going to be a modular operating system (hence the name) and is written in C++ (except for the assembly portions). At the moment I am burning a floppy image for boot, but I am hoping to roll my own bootloader here at some point and get it burning to an iso for CD boots.
At the moment I am planning on going towards more of a micro kernel, but who knows. I may build it as a bit of both though (have some services running on the kernel proper and others on the user space).
However I have recently (last night) found that bochs is putting me directly into protected mode, meaning that I can't actually find out how much memory I have (though I can find some of it -- about 4 MB) (Oh, and I can't get to VGA-256 mode either), so instead of attempting to return to real mode I think I may just attempt to do a nice and simple bootloader (something that finds the amount of ram and which monitor modes are available to me, then get to protected mode, load the kernel and jump to it (doesn't sound that difficult, we shall see).
My current goal is to get modOS up and running in VMWare instead of bochs, now I just need to get there...
cool, i love OS projects. a good way to figure out how much RAM you have is when your kernel first starts running, set up a single flat segment descriptor from 0 and make it's limit 4 GB (max addressable RAM with 32-bits). then in 1 KB or 1 MB increments you can write a pattern into RAM locations and then read it back. if the pattern is where you wrote it, there is still physical memory at that point. do this until you can't read back the proper pattern.
i've done an OS myself, it uses real-mode but it does do multitasking and has multiple virtual terminals and pseudo-terminals. i felt the hardest part was handling file systems.
Now that I have written my bootloader script, it seems to have thrown me a ways back. My strings are no longer in the correct place (or at least I can't read them) even though I have my rodata section in the linker script as it should be and other than that I haven't been able to get things back to their previous point.
I also found that I had a number of errors in the OS code which caused my OS to panic when run in VMWare that bochs allowed to work anyways. So I have stripped the OS down to its most basic points and am attempting to solve the problems as I go (just need to fix the string issue when I can repair the IDT, etc.) until I get back to the point I was previously in... Though it is currently going VERY slowly, and I am actually considering trashing the project and starting from scratch with it. Hopefully it doesn't get to that point, but I think that's what I'll end up doing if I haven't solved this problem by next week (sad day).
For anyone who is also having this problem, or wants to see what the source (ugly as it is) currently looks like (stripped down to the essentials for the error to appear) it is all here.