sortix-mirror/sortix
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
..
fs Added isatty(2), which is used by editor. 2011-11-26 21:00:40 +01:00
x64 Fixed the horrible 'nofoo' bug! 2011-12-25 03:41:59 +01:00
x86 Fixed the horrible 'nofoo' bug! 2011-12-25 03:41:59 +01:00
x86-family Fixed the horrible 'nofoo' bug! 2011-12-25 03:41:59 +01:00
.gitignore Restored support for JSSortix using very ugly hacks. :( 2011-09-08 11:10:41 +02:00
Makefile Added a global variable at the end of the kernel to detect its size. 2011-12-23 13:09:09 +01:00
bits.h Initial version of Sortix. 2011-08-05 14:25:00 +02:00
descriptor_tables.cpp Added support for 64-bit interrupts. 2011-11-30 23:30:14 +01:00
descriptor_tables.h Added support for 64-bit interrupts. 2011-11-30 23:30:14 +01:00
descriptors.cpp Fixed descriptors not being reset by SysExit. 2011-11-22 19:12:04 +01:00
descriptors.h Fixed descriptors not being reset by SysExit. 2011-11-22 19:12:04 +01:00
device.cpp Unrefing a device that has never been ref'd will also destroy it. 2011-11-17 23:14:45 +01:00
device.h Added isatty(2), which is used by editor. 2011-11-26 21:00:40 +01:00
directory.cpp Implemented errno(3), added support in both kernel and utils. 2011-11-22 17:26:47 +01:00
directory.h Added chdir(2), getcwd(2), which mxsh and ls now uses. 2011-11-21 12:19:57 +01:00
elf.cpp Fixed bad filename written in elf.cpp. 2011-12-16 15:35:45 +01:00
elf.h Program loader now sets the correct program segment type. 2011-12-16 15:33:12 +01:00
end.cpp Added a global variable at the end of the kernel to detect its size. 2011-12-23 13:09:09 +01:00
filesystem.cpp Implemented errno(3), added support in both kernel and utils. 2011-11-22 17:26:47 +01:00
filesystem.h Added unlink(2) and rm(1). 2011-11-21 19:01:56 +01:00
initrd.cpp The initial ramdisk is now mapped onto a special location. 2011-12-22 14:13:18 +01:00
initrd.h The initial ramdisk is now mapped onto a special location. 2011-12-22 14:13:18 +01:00
interrupt.cpp Added support for 64-bit interrupts. 2011-11-30 23:30:14 +01:00
interrupt.h Added support for 64-bit interrupts. 2011-11-30 23:30:14 +01:00
io.cpp Added isatty(2), which is used by editor. 2011-11-26 21:00:40 +01:00
io.h Added pipe(2), write(2), and read(2). 2011-11-16 21:21:38 +01:00
kernel.cpp Fixed the horrible 'nofoo' bug! 2011-12-25 03:41:59 +01:00
keyboard.cpp Fixed uninitialized memory bug in the keyboard driver. 2011-12-01 17:30:14 +01:00
keyboard.h Removed obsolete IKeystrokable. 2011-11-02 19:43:48 +01:00
log.cpp Ported kernel to new syscall API and started cleaning up the old one. 2011-10-27 00:20:28 +02:00
log.h Removed lots of deprecated suff! 2011-09-06 19:51:47 +02:00
memorymanagement.h The initial ramdisk is now mapped onto a special location. 2011-12-22 14:13:18 +01:00
mount.cpp Added devfs, with files /tty and /null and mounted it at /dev. 2011-11-21 21:49:13 +01:00
mount.h Mount-points are now handled properly within the kernel. 2011-11-21 19:39:13 +01:00
multiboot.h Initial version of Sortix. 2011-08-05 14:25:00 +02:00
mxfs.cpp Initial version of Sortix. 2011-08-05 14:25:00 +02:00
mxfs.h Initial version of Sortix. 2011-08-05 14:25:00 +02:00
panic.cpp Added O=-ON and PANIC_SHORT=1 variables to the makefile. 2011-11-28 15:25:00 +01:00
panic.h Initial version of Sortix. 2011-08-05 14:25:00 +02:00
pci.cpp Removed lots of deprecated suff! 2011-09-06 19:51:47 +02:00
pci.h Initial version of Sortix. 2011-08-05 14:25:00 +02:00
pipe.cpp Implemented errno(3), added support in both kernel and utils. 2011-11-22 17:26:47 +01:00
pipe.h Added pipe(2), write(2), and read(2). 2011-11-16 21:21:38 +01:00
platform.h Initial version of Sortix. 2011-08-05 14:25:00 +02:00
process.cpp Added user-space memory allocation. 2011-12-16 13:24:49 +01:00
process.h Program loader now sets the correct program segment type. 2011-12-16 15:33:12 +01:00
scheduler.cpp Made Sortix compatible with gcc 4.6.1. 2011-12-25 00:10:56 +01:00
scheduler.h Added the _exit() system call. 2011-11-05 20:19:36 +01:00
serialterminal.cpp The cursor is disabled when displaying the VGA under JSVM. 2011-12-05 22:13:51 +01:00
serialterminal.h VGA now sort-of works under serial-connections. 2011-12-05 21:44:14 +01:00
signal.cpp Initial signal support. Please squash improvements into this commit. 2011-11-23 00:19:09 +01:00
signal.h Initial signal support. Please squash improvements into this commit. 2011-11-23 00:19:09 +01:00
sound.cpp Ported kernel to new syscall API and started cleaning up the old one. 2011-10-27 00:20:28 +02:00
sound.h Ported kernel to new syscall API and started cleaning up the old one. 2011-10-27 00:20:28 +02:00
stream.h Added a RAM filesystem. 2011-11-19 00:57:17 +01:00
syscall.cpp Made Sortix compatible with gcc 4.6.1. 2011-12-25 00:10:56 +01:00
syscall.h Added some support for blocking system calls in the kernel. 2011-11-07 00:48:20 +01:00
syscallnum.h Added user-space memory allocation. 2011-12-16 13:24:49 +01:00
system.h Initial version of Sortix. 2011-08-05 14:25:00 +02:00
thread.cpp Initial signal support. Please squash improvements into this commit. 2011-11-23 00:19:09 +01:00
thread.h Initial signal support. Please squash improvements into this commit. 2011-11-23 00:19:09 +01:00
time.cpp uptime(2) now reports usecs instead of msecs. 2011-12-04 21:27:21 +01:00
time.h Implemented the fork() system call and what it needed to work properly. 2011-11-01 01:00:20 +01:00
uart.cpp VGA now sort-of works under serial-connections. 2011-12-05 21:44:14 +01:00
uart.h Removed deprecated VGA API and moved it to /dev/vga. 2011-11-25 13:38:31 +01:00
user.h Initial version of Sortix. 2011-08-05 14:25:00 +02:00
vga.cpp VGA now sort-of works under serial-connections. 2011-12-05 21:44:14 +01:00
vga.h Removed deprecated VGA API and moved it to /dev/vga. 2011-11-25 13:38:31 +01:00
vgaterminal.cpp Fixed missing breaks in switch in vgaterminal.cpp. 2011-11-02 11:39:02 +01:00
vgaterminal.h Initial version of Sortix. 2011-08-05 14:25:00 +02:00