Page 2 of 2
Posted: Thu Nov 01, 2007 10:32 pm
by Brynet-Inc
AusZero wrote:Yes I have read getting started, but I don't know much about stacks.
There is an OSDev wiki for a reason... not to mention the official Wikipedia.
http://www.osdev.org/wiki/Stack
http://en.wikipedia.org/wiki/Stack_%28data_structure%29
Seriously, having some programming experience before embarking on the "OSDev" journey is just a "Good Idea(TM)".
Posted: Fri Nov 02, 2007 6:10 am
by Combuster
AusZero wrote:Yes I have read getting started, but I don't know much about stacks.
Can you guess why the link I gave you pointed directly to the required knowledge section?

Posted: Fri Nov 02, 2007 9:37 am
by Pixion
Well,
IMHO I don't think this was too helpfull for AusZero...
What would help if he could post the errors he got during linking or loading.
As Pyrofan mentioned, you need to have a stack defined somewhere for your kernel to operate as for every call or interrupt it will store appropriate register information 'on the stack'. Here is how in Bran's tutorial he defined it in his main asm:
Code: Select all
; Here is the definition of our BSS section. Right now, we'll use
; it just to store the stack. Remember that a stack actually grows
; downwards, so we declare the size of the data before declaring
; the identifier '_sys_stack'
SECTION .bss
resb 8192 ; This reserves 8KBytes of memory here
_sys_stack:
And here Bran's accompanying ld script refering to the stack section bss:
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
If you are following another tutorial, something similar needs to be defined...
Posted: Fri Nov 02, 2007 2:21 pm
by meh
I may just forget about making an operating system temporarily.
Posted: Fri Nov 02, 2007 3:54 pm
by Pixion
Sure!
Never try, never succeed!
Posted: Fri Nov 02, 2007 9:30 pm
by rv6502
AusZero wrote:I may just forget about making an operating system temporarily.
AusZero wrote:Yes I have read getting started, but I don't know much about stacks.
/me bang head on wall ....
don't give up,
but you're trying to do a triple-jump-backflip-summer-sault when you're just starting to walk.
you need to learn more basic system programming skills before jumping into the whole blown OS thing.
learn some more assembly and how to interface assembly and a high-level language for starters, how compilers/assembler/linkers work, how other OSes work, lots of ressources on osdev.org and on the web in general.
not that you need much assembly to write an OS, but you will need *SOME* to make it work and a lot of assembly knowledge to debug things when they crash.
try making some old DOS games first, vga, then vesa, then with sound (irqs) then with dos extenders, then with your own dos extender, then you'll almost have the base for a kernel.
Posted: Fri Nov 02, 2007 10:55 pm
by iammisc
Don't give up on operating system development. You can't just jump into it without knowing about low-level computer languages. Try learning C and using it to make userspace apps and then, when you know C inside out, learn assembly language for the processor you're using and when you know that pretty well, *then* write your operating system.
Just think of the preparation as part of writing the actual operating system.
Hope to see you soon(well not too soon as it might not be enough time to learn C inside out).
Posted: Sat Nov 03, 2007 1:16 pm
by meh
I know C++, will that do?
Posted: Sat Nov 03, 2007 1:29 pm
by Pixion
C++ will do, as it is a superset of C.
However, I you want to get going, why not start by doing some of the many tutorials around?
-OSDev Wiki: Babysteps
-Bran's kernel
-etc.
Posted: Sat Nov 03, 2007 2:32 pm
by meh
Do you think I should learn assembly a little bit more before trying the tutorials?
Posted: Sun Nov 04, 2007 2:36 pm
by AJ
Hi,
My opinion of assembly is that you should at least be able to read through the source. Know things like what registers are available, what each register is used for and so on. The freely available Intel Manuals will help with that.
One of the pitfalls of learning applications programming (and something that took some getting around for me initially) is that you may think you are using an integral part of your chosen programming language, but you are actually using functionality which is provided by the OS or library author.
Take C++. Here you have useful tools such as try...catch. You can forget about that in system programming until you have actually written the necessary support (something which is a long way off for my OS). Same with RTTI. And New. And Delete. And Global/Static objects (granted, these are fairly easy to add support for)...oh - and you cant #include any header files you have not written / verified yourself. So if you are doing applications programming, remember that when you switch to systems programming you will have vastly reduced functionality to begin with.
My suggestion to you, is write a 'Hello World' boot loader so you get a feel for how the PC boots (and how stacks work

). When you are comfortable with all that, by all means switch to using GRUB and start using a higher level language. I really hope none of this puts you off, but hopefully it will prepare you more for the challenge.
Oh - and for some nice boot loader tutorials, try
http://www.osdever.net/ .
Cheers,
Adam
Posted: Sun Nov 04, 2007 6:24 pm
by meh
Thank you all for your help.
Posted: Mon Nov 05, 2007 1:09 pm
by JAAman
if you need a copy of the intel manuals, they can be downloaded or (preferably) ordered at the link in my signature