Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I am using the exact code for the loader.s, kernel.c, and linker.ld that you can find here:http://wiki.osdev.org/Bare_Bones. When I run the commands, I get this:
I am using Cygwin on Windows XP. The commands ran in the bash file compile.sh are:
For undefined reference to kmain:
* use a GCC Cross-Compiler
* use -fno-leading-underscores
* add underscores for each c function you call from assembly
they're just warnings. ignore them.
Warnings indicate bugs, potential bugs, bad coding practice or design, so you should fix them, not ignore them. Let alone tell others to do so
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Warnings indicate bugs, potential bugs, bad coding practice or design, so you should fix them, not ignore them. Let alone tell others to do so
yes... i actually meant just the ones stated. i see no way of correcting them, and i doubt anyone else does without adding useless, functionless, time-wasting, space-filling code.
and before you say it... yes, i need to think more before posting.
Combuster wrote:yes... i actually meant just the ones stated. i see no way of correcting them, and i doubt anyone else does without adding useless, functionless, time-wasting, space-filling code.
In this case, you are right.
Sincerely speaking, I didn't know GCC warned against unused parameters. I thought it would only warn against unused (non-parameter) local variables.
which, again, is bad practice. the kernel should never return. especially if you're using C++ because of the destructors list.
also the fact that the parameters defined there are commented out so they wont be compiled, and that therefore means the variables don't actually exist. resulting in an incomplete multiboot header.
xDDunce wrote:which, again, is bad practice. the kernel should never return.
Are you sure? I think this is just an implementation detail.
The main() can be just the "bootup driver[1]", which falls out of scope once the multitasking stuff is on.
And it's not the kernel that is returning. It's just the main() function, which happens to be in the kernel binary.
JJ
[1] A driver is someone/thing that drives. Not necessary in the "device driver" sense.
even so, isn't a driver just another program but with higher priviliges than just plain old user mode? just like the kernel. so returning from any main() function (be it main(), kmain() or anything similar) should not be done as it will cause a termination of the program.
In kernel space, there is no C library, no runtime. What main does when it returns is not defined until YOU program it.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Combuster wrote:In kernel space, there is no C library, no runtime. What main does when it returns is not defined until YOU program it.
and by standard (standard being what the general consensus [can't spell ] does), that will be your destructors list (if using C++) which kills all global classes. which, if done unintentionaly, will cause triple faults left, right and center. so technicly, you should return when shutting down (if at all), to ensure all important data is written to disk and such. followed by the actual shutdown sequence. it's the fastest, simplest and most reliable way. and from what i see, most (if not all) tutorials do it, along with many of the open source projects i have taken a look at recently.
make sure you are using the cross compiler version, as the gcc you download is not compiled as a cross compiler, you have to specificalyl recompie it to be a true cross compiler, otherwise it will mangle the function names (as it should).