Page 2 of 3

Posted: Mon Mar 17, 2008 2:57 am
by cyr1x
Ring 3 not-used ?? That sounds horribly unstable as Ring0-2 are supervisor and can access all memory that is protected by paging(as paging only distinguishes between supervisor and user). And then Ring1-2 + 64-bit don't like each other :D, as there's no more base and limit checking.

Posted: Mon Mar 17, 2008 3:35 am
by jeroen
So what would you suggest? Run the kernel and drivers in ring 0, the modules in ring 1 (as in the document), skip ring 2 and run the end-user enviroment in ring 3? It does have certain limitations this way for the more advanced end-user. I was planning to get the GUI in ring 3 and keep the text-enviroment in ring 2 to have full system access when in textmode.

Posted: Mon Mar 17, 2008 3:40 am
by AJ
No - as you are specifically aiming for x86_64, run kernel code in ring 0 and user code in ring 3. Forget about the others. All your other security needs to be provided through careful choice of page privilege (user / supervisor) and certain system calls which are only available when privileged tasks are running.

Cheers,
Adam

Posted: Mon Mar 17, 2008 4:12 am
by JamesM
There's the other problem that ring 1 or 2 (I can't remember which) is used by some hypervisors, and is defined differently in later processors (safe, because noone uses them!)

So as AJ and others said, stick with rings 0 and 3. Every other system in the world ever has only 2 privilege levels. (MIPS has 3, but only ever uses 2. The third was added for a political reason.)

Posted: Mon Mar 17, 2008 4:33 am
by inph
@DanielLavin:
and
@jeroen:

Since you're new to OS Development, I really would recommend you try it before starting any sort of project on the subject. Create yourself a little Kernel and try implementing some basic features. Get a feel for the workflow; it's vastly vastly different from game development. If you think you're the kind of guy who will get excited when kalloc() works for the first time, or you get that first context switch that prints oodles of statistics to your screen, this kind of thing might suit you. If, on the other hand, you just want to rush to the point where you have something that resembles a modern OS visually, without a care for the architecture behind your OS, maybe you'll find it difficult to find the motivation.

If you enjoy Kernel/OS design, why create an ambitious project? You probably shouldnt be wasting so much time on design at this stage; it's best to gain some experience of what works and what doesn't, first. Why not just play around with a rough kernel and experiment with ideas. I restarted my OS project countless times now; greatly improving my understanding of kernel design on each iteration.

I think many people here would agree that the best way to start off with OS Dev, is to experiment while following manuals and other resources you find on the net (or your local book store). Your project can evolve into a more defined one in time. Be patient. If you can't be patient, then you're gonna have a real hard time finding the motivation to go through with even the smallest of projects.

Good luck :)

Phill.


EDIT: Regarding the issues you discuss about package management in the design doc:

add:
alias install='apt-get install'
alias delete='rm -rf'
alias rename='move'
etc. to your /etc/profile file, then you can do exactly as you described:
install appname
delete folder-name
etc.

Infact, on the linux distribution I use, it has an option to remove the package, it's config files and all redundant dependencies. It even does a keyword search if it doesn't find an exact match for the package name, and let's me choose what I require.

But then again, as has already been said, the command line is for power users, who don't tend to want all this abstraction (for good reasons). Your average Joe will want to use a GUI.

Sounds to me like you might have fun creating a Linux distribution of your own by the sounds of things. Most of what you describe can be implemented and has been implemented already.

Posted: Mon Mar 17, 2008 5:05 am
by jeroen
@inph: What you said, is true. The design document is a long term plan and of course the project will start with a simple hello-world kernel. But creating my own linux distributing will take away all the fun, it's not much more then making a package compilation and setting things up. I would sure be excited if I could make the kernel print hello world, or load an external file. But I want an ambitious project because I also want to achieve something.

@JamesM, AJ, cyr1x: Okay, thanks for the info :) It does make it less complicated like that.

Posted: Mon Mar 17, 2008 5:45 am
by nekros
How about designing for a while and post your final design? :D

Posted: Mon Mar 17, 2008 5:58 am
by jeroen
I will, sir, I sure will :)

@inph: An addition to what I said earlier, a quote of Eric Steven Raymond: "Hackers are naturally anti-authoritarian...the authoritarian attitude has to be fought wherever you find it, lest it smother you and other hackers.". That suits me a lot more then creating another Linux distro. :lol:

Posted: Mon Mar 17, 2008 6:19 am
by inph
jeroen wrote:I will, sir, I sure will :)

@inph: An addition to what I said earlier, a quote of Eric Steven Raymond: "Hackers are naturally anti-authoritarian...the authoritarian attitude has to be fought wherever you find it, lest it smother you and other hackers.". That suits me a lot more then creating another Linux distro. :lol:
Yeah, come to think of it, 'Linux distro' was a silly idea :)

Posted: Mon Mar 17, 2008 6:51 am
by 01000101
two thumbs up for the hacker misconceptions! *yay*

Posted: Mon Mar 17, 2008 8:27 am
by piranha
Hmmm......have you looked around in other sites? osdever.net for example?
Lots of tutorials there

And I agree, you should experiment first, I've made 3 kernels before the one I'm working on now, and the other 3 died because I started working on a GUI too early...

My suggestion is to get the kernel good before working on higher stuff.

-JL

Posted: Mon Mar 17, 2008 9:17 am
by DanielLavin
@inph

im the one into video game programing not Jeroen, he has been studying OS dev for quite some time (unlike me). nonetheless i thank you for your suggestions, and i do agree we should start small - and that is actually the plan.

yours,
D. Lavin

Posted: Tue Mar 18, 2008 12:26 am
by jeroen
I've been thinking about the planning, and I think it's best to create a Werewolf Research project first. Just to try out stuff, and learn the stuff. Everything that we get working in the Research project could be ported to the actual OS project.

@Piranha: I've been looking around on some sites, including bona fide~, thanks anyway. The kernel is the main project for any OS, or at least should be. Without a good kernel the system won't do* much properly. I'll just have to set up another 32-bit linux to compile the 32bit files (linker etc.), but that's okay. Long live multiple partitions and the ease of debian :)

*edit ._.

Posted: Tue Mar 18, 2008 8:18 am
by piranha
I'm compiling my 32bit kernel on a 64bit computer.
Just add flags to the compile/linker etc:
gcc -m32
ld -m elf_i386
as --32
nasm -f elf32

Works great.

-JL

Posted: Tue Mar 18, 2008 9:43 am
by jeroen
Thanks a lot for this :D I couldn't get ld to link for 32bit till now. Really, thanks a lot.