I'm coding an operating system

Questions about programming languages and debugging
reparto
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 288
Joined: 27 May 2013, 11:30
10

Re: I'm coding an operating system

Post by reparto »

I have some spare stuff I could sacrifice.

I have a Sempron chip, AM2 board (Foxconn i think) and some DDR2 RAM. I could probably run this of a USB stick so I shouldn't need a hard drive.

Apart from the obvious like PSU etc. anything else I need to do to test this out.
Selling invisible pets:
Dogs - 0.5 Bitcoins
Cats - 0.7 Bitcoins
Unicorns - 10 Bitcoins
Chimpanzee - 2 Bitcoins

PM me if you are interested, will ship via priority airmail, will accept escrow services

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: I'm coding an operating system

Post by bad_brain »

hm, the next thing should maybe utilize basic file manipulation....like read/write... :-k
Image

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Re: I'm coding an operating system

Post by Gogeta70 »

Reparto: I'm not sure it's ready to run on a real computer. Virtual machines simulate perfect conditions - like really fast I/O, little to no hardware errors, etc. So while my Keyboard driver may work perfectly in a virtual machine, it may fail to initialize the PS2 controller due to lack of error checking at the moment. There are other things too, but that's just an example. Thanks for the offer though, i may take it to that level some day...

So currently i'm working on making it do context switching. This is really f*cking hard. And i'm kinda stuck on it right now, but i'm enjoying the challenge. It kind of went on the back burner for a bit because of some stuff i had to take care of. Also, i'm balancing this project with another project of mine, so i won't be getting stuff on this done as fast. Which i think is a good thing, since i won't be burning myself out on one project.

bad_brain:

I believe you're right. I need to implement a basic file system. I've been reading up on file system implementation... it's amazing how much of an abstraction files really are. I'm thinking about trying to implement an FAT32 driver, but we'll see what i can do.

First things first - i need to finish the code for multi-tasking! ](*,)
¯\_(ツ)_/¯ It works on my machine...

User avatar
Lundis
Distorter of Reality
Distorter of Reality
Posts: 543
Joined: 22 Aug 2008, 16:00
15
Location: Deadlock of Awesome
Contact:

Re: I'm coding an operating system

Post by Lundis »

Nice project! I set out to do the same 3 years ago, but I guess I got distracted by life when I started uni. I got a couple of letters on my screen at least... The biggest challenge when writing an OS is the lack of documentation imo.

Anyway, I managed to get a couple of books (ATA/ATAPI, USB, SATA, PCI, PCIE architecture) from some website (they charged a lot for the books but you could get the links to the PDFs from google :-99 ). They are rather hard to read, but hit me on IRC if you're interested in them. You might have some use for the ATA/ATAPI one for your hdd drivers ;)

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Re: I'm coding an operating system

Post by Gogeta70 »

Okay, so i've got some basic context switching working. It's incomplete, but the results of what i've got are visible.

I have updated the main post with a new screenshot and binary/source files.

I had a bit of trouble wrapping my head around what i needed to do to make a context switch. After slowly piecing together the code, i got a better idea of what needs to happen. Right now, processes and threads are basically the same thing, since a process only consists of a single thread. I'm going to expand on this later, but for now processes will stay this way (until i implement a filesystem).

So, doing a context switch involves a couple of things: You have to switch stacks for each thread, you have to save the processor registers onto the threads stack, switch out the stack, and restore the registers from the next thread's stack. Aside from doing that, you have to load a new page directory table for each process, so that each process has it's own address space. Basically, it goes like this:

-System timer interrupt is called
-Save processor state to thread stack
-Save thread stack address (ESP register) to the Thread Information Block
-Load a kernel stack to use for the duration of the interrupt (to avoid muddling the next thread's stack)
-Switch out the old thread's page directory for the new thread's page directory
-Handle anything else needed in the timer interrupt (system clock, keyboard updates, etc)
-Save kernel stack address
-Load new thread's stack address from Thread Information Block into ESP register
-Pop the data registers and the EFLAGS register off the stack
-Finally, return from the system timer interrupt

As you can see, it's a lengthy process. Right now, my code only switches out stacks because everything is running in kernel memory, so i don't need new page directories for any new threads.

Well, that's all for now. Next, i think i'm going to make up a graphics driver.

Lundis: I'd love to see those books, so i'll see if i can catch you on IRC soon ^_^
¯\_(ツ)_/¯ It works on my machine...

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: I'm coding an operating system

Post by bad_brain »

to be honest it's progressing faster than I first expected.. 8O
which is quite annoying because it's totally over my head, noticed that in our quick IM convo yesterday... :oops: :lol:
Image

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Re: I'm coding an operating system

Post by Gogeta70 »

Unofficial update here :P

So i switched all the code for creating a process over to threads instead, as that was essentially what it was. Anyway, i have a basic graphics driver working now, and am starting on coding the graphical terminal :P

Image

I had it draw some RGB lines to the screen to test out the functionality of the driver. It works wonderfully (and is quite fast, as far as i can tell).
¯\_(ツ)_/¯ It works on my machine...

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Re: I'm coding an operating system

Post by ayu »

That picture made me dizzy as hell :-88
"The best place to hide a tree, is in a forest"

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Re: I'm coding an operating system

Post by Gogeta70 »

bad_brain: Don't worry, OS Development is over a lot of people's heads. Hell, i still don't fully grasp all the concepts behind it... it's a complex thing. :P

And yeah, it's progressing a lot faster than i expected as well. I never even dreamed that i would have a functional graphics driver so soon, or multi-threading capability :D

Cats: haha, yeah, it's not exactly a pretty image :P But it was a functional test.
¯\_(ツ)_/¯ It works on my machine...

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Re: I'm coding an operating system

Post by Gogeta70 »

Hey guys! So i've got a basic terminal started. You can type to the screen, backspace and enter work, and the screen scrolls.

I've updated the main post with a new screenshot and the newest source and ISO.

Look forward to a more complete terminal very soon, followed by a (hopefully) decent filesystem. I'm considering Ext2, but we'll see.
¯\_(ツ)_/¯ It works on my machine...

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Re: I'm coding an operating system

Post by Gogeta70 »

I thought i'd share this little bug i ran into just now, while working on the terminal's font rendering code...

Image

I'm rewriting the code that renders text to the screen because it was pretty slow, but this is what i got when i first tested my changes... XD
¯\_(ツ)_/¯ It works on my machine...

User avatar
Xonet
Moderator
Moderator
Posts: 202
Joined: 08 Jun 2005, 16:00
18
Location: Belgium
Contact:

Re: I'm coding an operating system

Post by Xonet »

Wow, that looks amazing, how did you get started on this? I can imagine the first steps are the hardest, actually getting something to run and then building onto that. Seeing this makes me realize how basic my understanding of low level comp architecture actually is, I got some courses on comp architecure at uni like everyone else, but as always, once learned and never practiced most is forgotten. You got me excited to google some more about OS dev. I'll be watching this thread closely :)

Good luck!
You cant spell slaughter without laughter.

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: I'm coding an operating system

Post by bad_brain »

oh, look what the cat dragged in....it's Xonet... 8O :lol:
Image

User avatar
Xonet
Moderator
Moderator
Posts: 202
Joined: 08 Jun 2005, 16:00
18
Location: Belgium
Contact:

Re: I'm coding an operating system

Post by Xonet »

bad_brain wrote:oh, look what the cat dragged in....it's Xonet... 8O :lol:
Well I promised I'd be more active on here again... in march, but then life happened (long story short I bought a flat and have been renovating for the last 5 monhts, so no social life at all atm)

Anyway, nice thread and I'm looking forward to see more progress *thumb*
You cant spell slaughter without laughter.

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Re: I'm coding an operating system

Post by Gogeta70 »

Hey, Xonet, long time no see! Don't worry fellas, this project isn't dead, just a bit neglected. Work took over, things got busy, you know the run of it. Anyway, the project has been slowly creeping back into my head lately, so i'll probably start fiddling with it again soon.

Maybe i'll play with it this weekend...
¯\_(ツ)_/¯ It works on my machine...

Post Reply