Jonas 'Sortie' Termansen
16dd39e467
Added a nice Log::PrintData function to the kernel.
...
This allows writing binary data to the kernel log.
2012-01-22 02:12:52 +01:00
Jonas 'Sortie' Termansen
1f3f85b609
Added a simple utf8 encoder in the kernel.
2012-01-22 00:56:58 +01:00
Jonas 'Sortie' Termansen
83aeec2514
Multiple threads can now wait on the same pipe.
2012-01-18 17:19:08 +01:00
Jonas 'Sortie' Termansen
ba2cb5103a
Made Device::IsType 'const', because it is.
2012-01-18 01:11:17 +01:00
Jonas 'Sortie' Termansen
35fc0f6dfe
Removed the old unused interrupt 177.
2012-01-15 19:00:05 +01:00
Jonas 'Sortie' Termansen
93fb66ff90
Refactored Interrupt handlers to provide a user pointer.
2012-01-15 18:32:42 +01:00
Jonas 'Sortie' Termansen
c8c34d3cdd
readdirents(2) now properly reports ERANGE.
2012-01-15 00:43:13 +01:00
Jonas 'Sortie' Termansen
f476a82498
Fixed idention error in ramfs.
2012-01-14 23:19:31 +01:00
Jonas 'Sortie' Termansen
c94f6b64c3
readdirents(2) now returns ERANGE if insufficient storage space
...
was provided, but that the needed size could be copied to d_namelen.
2012-01-14 23:06:18 +01:00
Jonas 'Sortie' Termansen
8ef439b328
Fixed NULL-pointer in SysReadDirEnts.
2012-01-14 22:57:17 +01:00
Jonas 'Sortie' Termansen
56084556bb
Added stubs for truncate(2) and ftruncate(3).
2012-01-14 16:37:21 +01:00
Jonas 'Sortie' Termansen
0519af33ee
Added stubs for rmdir(2) and mkdir(2).
2012-01-14 16:25:28 +01:00
Jonas 'Sortie' Termansen
ad200ffa91
Added getpagesize(2) with the new return type size_t.
...
This function is non-standard and size_t is better than int here.
2012-01-08 14:58:57 +01:00
Jonas 'Sortie' Termansen
d3ad36b181
Made detected ATA devices available as /dev/ataN block devices.
2012-01-08 14:21:36 +01:00
Jonas 'Sortie' Termansen
a3a2226bb5
Implemented a simple ATA PIO Mode driver that can read and write.
...
Read operations are enabled by default, but you must set DISKWRITE=1 in
makeflags before write operations are permitted. This protects against
accidentally corrupting the existing filesystems on the system.
2012-01-08 14:20:39 +01:00
Jonas 'Sortie' Termansen
4e0f57f4d7
DevFileWrapper now understands and respects O_TRUNC.
2012-01-08 14:15:51 +01:00
Jonas 'Sortie' Termansen
648b324385
Added lseek(2).
2011-12-26 23:12:12 +01:00
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
Jonas 'Sortie' Termansen
7bc1fa259e
Made Sortix compatible with gcc 4.6.1.
...
This commit fixes some instances of uninitialized memory.
In addition, the bootstrap tables for x64 are moved around a bit,
in this awful game of placing stuff where it won't collide with grub.
2011-12-25 00:10:56 +01:00
Jonas 'Sortie' Termansen
ffe3cc49f2
Now counting memory usage in a more solid manner.
2011-12-23 16:45:07 +01:00
Jonas 'Sortie' Termansen
ba9b715c59
Added a global variable at the end of the kernel to detect its size.
...
This lets the kernel use any memory not directly used by it or the
init ramdisk. Although, now we test whether the kernel fits into
the identitymapped area. It can't really grow down there, unless it
wants to collide with user-space. Instead, modules and the like
(when they are invented), should be put in the upper memory. Or in
their own user-space process, yay, microkernel!
2011-12-23 13:09:09 +01:00
Jonas 'Sortie' Termansen
0515111314
The initial ramdisk is now mapped onto a special location.
...
This fixes issues where it did not fit into the first few MiB,
or that GRUB loaded it someplace weird.
The kernel heap is now also protected against growing into the
ramdisk and the kernel stack.
2011-12-22 14:13:18 +01:00
Jonas 'Sortie' Termansen
a623b1b07e
Fixed registering memstat(2) multiple times.
2011-12-22 12:59:48 +01:00
Jonas 'Sortie' Termansen
c8c08e7b90
Moved the make-color-red code into DoWelcome in kernel.cpp.
2011-12-22 12:56:29 +01:00
Jonas 'Sortie' Termansen
0f5864602f
Fixed bad filename written in elf.cpp.
2011-12-16 15:35:45 +01:00
Jonas 'Sortie' Termansen
7cd28f097c
Program loader now sets the correct program segment type.
2011-12-16 15:33:12 +01:00
Jonas 'Sortie' Termansen
acf1eebc98
Added user-space memory allocation.
2011-12-16 13:24:49 +01:00
Jonas 'Sortie' Termansen
aae0ed3092
The cursor is disabled when displaying the VGA under JSVM.
2011-12-05 22:13:51 +01:00
Jonas 'Sortie' Termansen
2c728fc1f1
VGA now sort-of works under serial-connections.
2011-12-05 21:44:14 +01:00
Jonas 'Sortie' Termansen
9e5b9e3767
Hacks to make the JSVM serial driver work better.
2011-12-05 21:14:50 +01:00
Jonas 'Sortie' Termansen
cdb873271d
Increased hard-coded maximum JSVM initrd size to 2 MiB 512 KiB.
2011-12-05 19:43:27 +01:00
Jonas 'Sortie' Termansen
7e55f325fc
Don't check the initrd on JSVM.
2011-12-05 19:36:15 +01:00
Jonas 'Sortie' Termansen
854d9b171a
uptime(2) now reports usecs instead of msecs.
2011-12-04 21:27:21 +01:00
Jonas 'Sortie' Termansen
3b8bf9419d
Removed obsolete functions to read from the initrd.
...
Use the initrd filesystem instead.
2011-12-04 15:38:02 +01:00
Jonas 'Sortie' Termansen
b0859c6d92
usleep'ing for 0 usecs simply causes a context-switch.
2011-12-02 22:37:17 +01:00
Jonas 'Sortie' Termansen
f8129a17b2
Changed the build system for 64-bit quite a bit.
...
The kernel is now compiled 100% as 64-bit code and converted to ELF32.
2011-12-01 23:06:34 +01:00
Jonas 'Sortie' Termansen
8e8bb15a1b
Improved corruption panic message in initrd.cpp
2011-12-01 23:03:00 +01:00
Jonas 'Sortie' Termansen
b0884584a1
Added a very simple checksum field to the init ramdisk.
...
This uncovers a bug where the bootloader may corrupt the initrd on x64.
This is probably related to our kernel64 hack..
2011-12-01 21:44:11 +01:00
Jonas 'Sortie' Termansen
2faafd3f99
Stack is now aligned in 64-bit Sortix threads.
2011-12-01 21:43:35 +01:00
Jonas 'Sortie' Termansen
7304c8f528
Fixed uninitialized memory bug in the keyboard driver.
...
This often prevented the letter 'c' from working in x64.
2011-12-01 17:30:14 +01:00
Jonas 'Sortie' Termansen
6562da4092
waitpid(2) now returns ECHILD on error.
2011-12-01 14:54:19 +01:00
Jonas 'Sortie' Termansen
cf53e4a020
Fixed 64-bit resumed system calls.
2011-12-01 14:29:49 +01:00
Jonas 'Sortie' Termansen
c0c20860ed
Lots of improvements to 64-bit Sortix.
...
Fixed 64-bit-ness bug in BSR() and BSF().
Added 64-bit system call stubs in libmaxsi.
Added a Elf64 program loader.
Fixed uninitialized memory bug in the scheduler.
x64/boot.s now takes care of user-space memory permissions.
Fixed bug in x64/syscall.s
That's right. The system now boots in 64-bit mode.
It is horribly unstable, though.
2011-12-01 10:45:44 +01:00
Jonas 'Sortie' Termansen
f460c4abec
Added support for 64-bit interrupts.
2011-11-30 23:30:14 +01:00
Jonas 'Sortie' Termansen
f0ec4ffacc
Forgot to push %rbp in x64/syscall.s
2011-11-29 11:45:00 +01:00
Jonas 'Sortie' Termansen
0b1c2a77c9
x64 now compiles again and runs on real hardware.
...
A nasty bug was fixed that caused triple faults on systems with > 1 GiB RAM.
2011-11-29 01:31:54 +01:00
Jonas 'Sortie' Termansen
8c146f14c0
Added uptime(1).
2011-11-28 16:29:53 +01:00
Jonas 'Sortie' Termansen
f232a054d3
Added O=-ON and PANIC_SHORT=1 variables to the makefile.
2011-11-28 15:25:00 +01:00
Jonas 'Sortie' Termansen
cd936886e6
Writing to /dev/vga hides the cursor until a write to /dev/tty.
2011-11-27 12:03:33 +01:00
Jonas 'Sortie' Termansen
4f3a7230b0
Destroying the addressspace after exit prevents leak of at least 16 KiB.
2011-11-27 12:02:34 +01:00
Jonas 'Sortie' Termansen
06909c6df9
Fixed panic when executing non-existent file.
2011-11-27 00:20:23 +01:00
Jonas 'Sortie' Termansen
bd1b1fe3bc
Added isatty(2), which is used by editor.
2011-11-26 21:00:40 +01:00
Jonas 'Sortie' Termansen
3f50a335bb
devfs now correctly manages sizes of files.
...
This fixes a regression caused by the RAM fix a few commits ago.
2011-11-26 21:00:37 +01:00
Jonas 'Sortie' Termansen
ce9787a439
Greatly reduced RAM usage in ramfs.
2011-11-26 20:25:25 +01:00
Jonas 'Sortie' Termansen
9152443816
Added memstat, a program for displaying memory usage.
2011-11-26 20:14:57 +01:00
Jonas 'Sortie' Termansen
b6a0fd0374
Removed deprecated VGA API and moved it to /dev/vga.
2011-11-25 13:38:31 +01:00
Jonas 'Sortie' Termansen
724305f3a7
Merge commit '7a233f2938f4e28d61504853e2f6daf4904aab33'
...
Conflicts:
sortix/fs/ramfs.cpp
2011-11-24 15:38:45 +01:00
Jonas 'Sortie' Termansen
e72d086a8f
Disallow / in filenames in ramfs.
2011-11-23 17:51:18 +01:00
Jonas 'Sortie' Termansen
5bf22b2c4a
ramfs doesn't allow opening files as directories.
2011-11-23 14:14:59 +01:00
Jonas 'Sortie' Termansen
2b032b0414
Initial signal support. Please squash improvements into this commit.
2011-11-23 00:19:09 +01:00
Jonas 'Sortie' Termansen
46c0cc6a12
-1 is no longer an allowed system call.
...
This treats a nasty bug where forking and exiting before the child
causes the kernel to panic, because the syscall -1 is run, which
just contains a trash value that happened to be 0.
The cause is still unknown. Might be the scheduler.
This won't help me sleep at night.
2011-11-22 22:08:34 +01:00
Jonas 'Sortie' Termansen
b15763b2de
Fixed descriptors not being reset by SysExit.
...
Indirectly, this fixes the snake; snake; panic bug.
2011-11-22 19:12:04 +01:00
Jonas 'Sortie' Termansen
e234e0a2d4
execve(2) now sets errno=EACCESS on non-buffer files.
2011-11-22 18:21:01 +01:00
Jonas 'Sortie' Termansen
9deb183786
The ELF loader now uses errno.
2011-11-22 18:06:40 +01:00
Jonas 'Sortie' Termansen
1b56d01f17
Improved error codes in devfs.
2011-11-22 17:56:58 +01:00
Jonas 'Sortie' Termansen
9f35df813e
Implemented errno(3), added support in both kernel and utils.
2011-11-22 17:26:47 +01:00
Jonas 'Sortie' Termansen
8678ad6444
/ is no longer a valid filename under ramfs.
2011-11-22 15:33:47 +01:00
Jonas 'Sortie' Termansen
2c3fb60d52
execve(2) now works relative to current dir.
2011-11-22 15:27:58 +01:00
Jonas 'Sortie' Termansen
e8fb8d885b
execve(2) can now load programs from the filesystem.
...
Previously it was restricted to only the ramdisk.
2011-11-22 14:02:33 +01:00
Jonas 'Sortie' Termansen
324a9a1a22
Fixed bug in initfs causing panics.
2011-11-22 12:44:23 +01:00
Jonas 'Sortie' Termansen
55240fb3f5
Added devfs, with files /tty and /null and mounted it at /dev.
2011-11-21 21:49:13 +01:00
Jonas 'Sortie' Termansen
91a97a2667
Mount-points are now handled properly within the kernel.
2011-11-21 19:39:13 +01:00
Jonas 'Sortie' Termansen
8b2b52b9f6
Added unlink(2) and rm(1).
2011-11-21 19:01:56 +01:00
Jonas 'Sortie' Termansen
d4590cefa1
Added chdir(2), getcwd(2), which mxsh and ls now uses.
2011-11-21 12:19:57 +01:00
Jonas 'Sortie' Termansen
eb035d6a4a
Fixed tripple-fault when creating a new frame, after the current was gc'd.
...
We'll need to get rid of that awful VGA sometime soon.
2011-11-21 00:27:10 +01:00
Jonas 'Sortie' Termansen
313079483a
Missing files from the previous two commits. Ooops!
2011-11-21 00:19:55 +01:00
Jonas 'Sortie' Termansen
0b90ab534f
ramfs now supports O_TRUNC.
2011-11-21 00:12:20 +01:00
Jonas 'Sortie' Termansen
23fde42249
Added readdirents(2), which ls(1) now uses, and added dir devices.
...
The initfs and ramfs are now able to list their contents.
2011-11-21 00:02:53 +01:00
Jonas 'Sortie' Termansen
e3bb0dfc9d
Fixed bug in previous commit. Ooops.
2011-11-20 22:48:22 +01:00
Jonas 'Sortie' Termansen
c1849ed7d8
/ is no longer a valid filename in ramfs.
2011-11-20 22:47:39 +01:00
Jonas 'Sortie' Termansen
06c0777193
Improvements to sortix/mount.cpp
2011-11-20 17:07:34 +01:00
Jonas 'Sortie' Termansen
a6a2c400bf
Hard-code-mounted the initd at /bin.
2011-11-20 16:25:55 +01:00
Jonas 'Sortie' Termansen
190989646b
Added an filesystem able to browse the initrd.
2011-11-20 16:25:32 +01:00
Jonas 'Sortie' Termansen
446616b3aa
Improved JSVM compabillity.
2011-11-20 15:58:42 +01:00
Jonas 'Sortie' Termansen
002a1f9ea6
Hardcoded the PWD as '/'.
2011-11-19 10:32:29 +01:00
Jonas 'Sortie' Termansen
a0eebc01db
Added sortix/fs to the sortix/Makefile DIRS variable.
2011-11-19 01:08:51 +01:00
Jonas 'Sortie' Termansen
013e11ca5e
Added a RAM filesystem.
2011-11-19 00:57:17 +01:00
Jonas 'Sortie' Termansen
ae423eaeef
Added open(2).
...
Please note that mount points and file systems do not exist yet.
2011-11-19 00:57:17 +01:00
Jonas 'Sortie' Termansen
15329187b9
Unrefing a device that has never been ref'd will also destroy it.
2011-11-17 23:14:45 +01:00
Jonas 'Sortie' Termansen
708643d0f2
Fixed bug in dup(2).
2011-11-17 23:03:14 +01:00
Jonas 'Sortie' Termansen
dd349a150a
Merge branch 'master' of gitorious.org:sortix/sortix
...
Conflicts:
libmaxsi/c/hsrc/unistd.h
libmaxsi/io.cpp
sortix/io.cpp
sortix/syscallnum.h
2011-11-17 22:28:20 +01:00
Jonas 'Sortie' Termansen
05196f49b2
Added dup(2).
2011-11-17 20:34:04 +01:00
Jonas 'Sortie' Termansen
e8cd27c353
Added close(2) and fixed bugs in pipe(2) and others.
2011-11-17 10:22:43 +01:00
Jonas 'Sortie' Termansen
a7de7b4905
Added pipe(2), write(2), and read(2).
2011-11-16 21:21:38 +01:00
Jonas 'Sortie' Termansen
ae599b6d67
Argv now works in main.
2011-11-09 23:18:26 +01:00
Jonas 'Sortie' Termansen
9ba01ad3b2
Oh my god, did I include thread.cpp into kernel.cpp!?
2011-11-07 14:36:35 +01:00
Jonas 'Sortie' Termansen
024f1581ea
Added the wait() and waitpid() system call.
2011-11-07 00:59:48 +01:00
Jonas 'Sortie' Termansen
851ee78903
Added some support for blocking system calls in the kernel.
2011-11-07 00:48:20 +01:00
Jonas 'Sortie' Termansen
cfd7648ca9
Added the _exit() system call.
...
exit() will not call _exit() yet, we need support for wait() in the shell.
2011-11-05 20:19:36 +01:00
Jonas 'Sortie' Termansen
09b1252821
Added an AsIs() function to the Syscall namespace.
2011-11-05 20:03:17 +01:00