James Molloy's Tutorial Known Bugs: Difference between revisions

Adding another problem. James Molloy, i advise you to learn a bit more about C and OSDev.
[unchecked revision][unchecked revision]
(Adding another problem. James Molloy, i advise you to learn a bit more about C and OSDev.)
Line 47:
 
The GCC documentation mentions that the <tt>memset</tt>, <tt>memcpy</tt>, <tt>memmove</tt> and <tt>memcmp</tt> functions must always be present. The compiler uses these automatically for certain optimization purposes and even code that doesn't use them can automatically generate calls to them. You should add them at your earliest convenience.
 
== Problem: Function defining ==
 
In some code (like the GDT loading code), some functions that need to be used in a function are only defined after the function. This WILL cause an error since C can only "execute commands" if they are already defined, not defined later.
 
== Problem: Interrupt handlers corrupt interrupted state ==
Line 102 ⟶ 106:
 
It's advisable to get a copy of <tt>multiboot.h</tt> from the GRUB source code rather than copied from the tutorial. Beware, the copy in the GRUB documentation is out of date, use one from an official release.
 
 
== Problem: Multitasking ==
 
It is strongly recommended that you write your own implementation of this and disregard the tutorial. The tutorial attempts to implement forking kernel threads by searching for magic values on the stack, which is insanity. If you wish to create a new kernel thread, simply decide which registers it should have and point its stack pointer at its freshly allocated stack. It will then start executing at your desired entry point. The part where it disables paging is bad and you should just map the source and destination physical frames at appropriate virtual addresses and memcpy with paging on at all times. Section 9.3 in particular is insanity and has blown up at least one well-established hobby operating system.
 
 
=== Inline Assembly optimiser problem with GCC 4.8 ===
Anonymous user