Commit Graph

40 Commits

Author SHA1 Message Date
Jonas 'Sortie' Termansen edd806fc74 Added a Refcounted class, useful for refcounted objects. 2012-02-21 20:12:52 +01:00
Jonas 'Sortie' Termansen 74dab2cbca Cleaned up the Sortix makefile. 2012-02-13 13:16:43 +01:00
Jonas 'Sortie' Termansen fec176fa15 Refactored the libmaxsi/ directory.
C and C++ files are now kept together and so are the mxmpp declarations.

Header files are now stored in include/ and mxmpp'd into preproc/.

All other code now -I ../libmaxsi/preproc.

And other stuff to make this happen, including refactoring Makefile.
2012-02-12 13:20:53 +01:00
Jonas 'Sortie' Termansen ead53567a1 Made the compile process a little less verbose. 2012-02-11 19:06:00 +01:00
Jonas 'Sortie' Termansen ed68db03fb Replaced SORTIX_EXTENSIONS macro with _SORTIX_SOURCE macro.
<features.h> declares _SORTIX_SOURCE if no conflicting macros are
declared, such as _GNU_SOURCE.

Fixed g++ automatically declaring _GNU_SOURCE, but Sortix isn't GNU.

Replaced SORTIX_UNIMPLEMENTED macro with __SORTIX_SHOW_UNIMPLEMENTED.
2012-02-11 18:51:55 +01:00
Jonas 'Sortie' Termansen 028867ab9d Removed the unused and deprecated old <libmaxsi/sortix-keyboard.h> API.
This has been entirely replaced by stdin and <sys/termmode.h>.
2012-02-10 13:46:26 +01:00
Jonas 'Sortie' Termansen fa9c7007b4 Implemented a terminal that reads from keyboard and writes to kernel log.
This terminal will provide the keyboard data in a couple modes as /dev/tty.
2012-02-10 13:28:28 +01:00
Jonas 'Sortie' Termansen 4ba906a157 Added a class for handling terminal linebuffering. 2012-02-10 13:28:28 +01:00
Jonas 'Sortie' Termansen ecc3114f2a Refactored the system to use the new Terminal interface.
This will allow development of a better terminal providing stdin.

Added new system calls settermmode(2) and gettermmode(2) declared in
<sys/termmode.h>. They allow querying and changing the current mode of
terminals (enabling raw keyboard data, signal handling, line buffering,
UTF-8 encoding stdin, and more). However, all that is unsupported by the
current terminal device driver.

Added KBKEY_ENCODE and KBKEY_DECODE macros to <sys/keycodes.h> which allows
encoding the kbkey format in UTF-32 characters.
2012-01-22 16:48:57 +01:00
Jonas 'Sortie' Termansen ead0e1523f Refactored the kernel keyboard API, but kept system calls compatible.
Caps lock now works as caps lock, not as shift lock.

This new design will allow implementing a working tty, such that stdin is
the only way to access the keyboard, instead of the current hacky way of
using a special system call to read from the keyboard.

Added a new system header file <sys/keycodes.h> defining the constants for
every key on the keyboard. This will be used in future APIs.

The main change is to split the keyboard driver into a class that reads
from the keyboard, while another class handles the translation into
printable characters (if possible). This allows a terminal driver based
on logical key presses and printable characters, instead of a terminal
driver based only on unicode-ish codes.
2012-01-22 15:53:50 +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 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 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 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 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 f232a054d3 Added O=-ON and PANIC_SHORT=1 variables to the makefile. 2011-11-28 15:25:00 +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 55240fb3f5 Added devfs, with files /tty and /null and mounted it at /dev. 2011-11-21 21:49:13 +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 190989646b Added an filesystem able to browse the initrd. 2011-11-20 16:25:32 +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 a7de7b4905 Added pipe(2), write(2), and read(2). 2011-11-16 21:21:38 +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 2afe9d1fd6 Implemented the fork() system call and what it needed to work properly.
This commit got completely out of control.

Added the fork(), getpid(), getppid(), sleep(), usleep() system calls, and
aliases in the Maxsi:: namespace.

Fixed a bug where zero-byte allocation would fail.

Worked on the DescriptorTable class which now works and can fork.

Got rid of some massive print-registers statements and replaced them with
the portable InterruptRegisters::LogRegisters() function.

Removed the SysExecuteOld function and replaced it with Process::Execute().

Rewrote the boot sequence in kernel.cpp such that it now loads the system
idle process 'idle' as PID 0, and the initization process 'init' as PID 1.

Rewrote the SIGINT hack.

Processes now maintain a family-tree structure and keep track of their
threads. PIDs are now allocated using a simple hack. Virtual memory
per-process can now be allocated using a simple hack. Processes can now be
forked. Fixed the Process::Execute function such that it now resets the
stack pointer to where the stack actually is - not just a magic value.
Removed the old and ugly Process::_endcodesection hack.

Rewrote the scheduler into a much cleaner and faster version. Debug code is
now moved to designated functions. The noop kernel-thread has been replaced
by a simple user-space infinite-loop program 'idle'.

The Thread class has been seperated from the Scheduler except in Scheduler-
related code. Thread::{Save,Load}Registers has been improved and has been
moved to $(CPU)/thread.cpp. Threads can now be forked. A new CreateThread
function creates threads properly and portably.

Added a MicrosecondsSinceBoot() function.

Fixed a crucial bug in MemoryManagement::Fork().

Added an 'idle' user-space program that is a noop infinite loop, which is
used by the scheduler when there is nothing to do.

Rewrote the 'init' program such that it now forks off a shell, instead of
becoming the shell.

Added the $$ (current PID) and $PPID (parent PPID) variables to the shell.
2011-11-01 01:00:20 +01:00
Jonas 'Sortie' Termansen c705bf39ff Ported kernel to new syscall API and started cleaning up the old one. 2011-10-27 00:20:28 +02:00
Jonas 'Sortie' Termansen 66192d1e86 Rewrote memory management again and added support for x64 and forking. 2011-10-10 01:02:57 +02:00
Jonas 'Sortie' Termansen cc61176e5b Restored support for JSSortix using very ugly hacks. :( 2011-09-08 11:10:41 +02:00
Jonas 'Sortie' Termansen 3859e1f566 Refactored interrupt system and got rid of old not-mine code. 2011-09-07 18:45:07 +02:00
Jonas 'Sortie' Termansen c157e65352 Removed lots of deprecated suff! 2011-09-06 19:51:47 +02:00
Jonas 'Sortie' Termansen d9c0c8d0cd Added a driver to parse the Sortix init ramdisk. 2011-08-27 20:08:33 +02:00
Jonas 'Sortie' Termansen 5c86cb4abd Processes now remember the memory segments it has loaded. 2011-08-27 16:46:00 +02:00
Jonas 'Sortie' Termansen 9db2c88aca Sortix can now load ELF executables into addresses spaces. 2011-08-23 00:42:56 +02:00
Jonas 'Sortie' Termansen 9995354f95 Moved CPU code shared by x86 and x64 into x86-family. 2011-08-12 17:33:18 +02:00
Jonas 'Sortie' Termansen 15ce53919c Added VGA API allowing userspace to easily access 0xB8000. 2011-08-11 22:03:13 +02:00
Jonas 'Sortie' Termansen 1026354e98 Sortix now uses the Device class.
This class is very WIP and is just experimental.
2011-08-08 15:20:08 +02:00
Jonas 'Sortie' Termansen 07b409c1a0 Added a wrapper class for handling file descriptors. 2011-08-07 19:47:43 +02:00
Jonas 'Sortie' Termansen 9b79673dcb Initial version of Sortix. 2011-08-05 14:25:00 +02:00