Mirror of most important branches of the main Sortix repository
Go to file
Jonas 'Sortie' Termansen 36b01eb2d3 Fixed the horrible 'nofoo' bug!
When compiled with gcc 4.6.1, 32-bit Sortix would triple fault during
early boot: When the TLB is being flushed, somehow a garbage value had
sneaked into Sortix::Memory::currentdir, and a non-page aligned (and
garbage) page directory is loaded. (Triple fault, here we come!)

However, adding a volatile addr_t foo after the currentdir variable
actually caused the system to boot correctly - the garbage was written
into that variable instead. To debug the problem, I set the foo value
to 0: as long as !foo (hence the name nofoo) everything was alright.

After closer examination I found that the initrd open code wrote to a
pointer supplied by kernel.cpp. The element pointed to was on the
stack. Worse, its address was the same as currentdir (now foo).

Indeed, the stack had gone into the kernel's data segment!

Turns out that this gcc configuration stores variables in the data
segment in the reverse order they are defined in, whereas previous
compilers did the opposite. The hack used to set up the stack during
early boot relied on this (now obviously incorrect) fact.

In effect, the stack was initialized to the end of the stack, not
the start of it: completely ignoring all the nice stack space
allocated in kernel.cpp.

I did not see that one coming.
2011-12-25 03:41:59 +01:00
bench uptime(2) now reports usecs instead of msecs. 2011-12-04 21:27:21 +01:00
debsrc The produced deb file now contains the proper installed-size field. 2011-10-16 17:58:19 +02:00
games Added auto-completion to snake for debugging purposes. 2011-12-06 14:18:15 +01:00
initrd The Sortix programs are now compiled into initrd/. 2011-08-28 12:42:06 +02:00
isosrc/boot/grub Initial version of Sortix. 2011-08-05 14:25:00 +02:00
libmaxsi error(3) and perror(3) now writes to stderr. 2011-12-24 04:39:16 +01:00
mkinitrd Removed excess space. 2011-12-04 21:31:53 +01:00
mxmpp Removed references to mksound from mxmpp. 2011-12-04 21:33:23 +01:00
sortix Fixed the horrible 'nofoo' bug! 2011-12-25 03:41:59 +01:00
subsystem Initial version of Sortix. 2011-08-05 14:25:00 +02:00
utils Implemented large parts of the stdio(3), including fprintf. 2011-12-24 04:28:34 +01:00
.gitignore Initial signal support. Please squash improvements into this commit. 2011-11-23 00:19:09 +01:00
Makefile Begun development of Sortix 0.6. 2011-12-06 01:28:23 +01:00
crosscompilemakefile.mak Added -fno-exceptions to the cross compiler flags. 2011-12-16 18:46:56 +01:00
gpl.html Added the GNU licenses used for Sortix. 2011-08-27 14:47:43 +02:00
lgpl.html Added the GNU licenses used for Sortix. 2011-08-27 14:47:43 +02:00