Commit Graph

54 Commits

Author SHA1 Message Date
Jonas 'Sortie' Termansen 1ce55af846 Created framework for video drivers.
This supports dynamic loading and unloading of graphics drivers, mode
switching and detection and flexible kernel access to the framebuffer.
2012-07-30 19:00:24 +02:00
Jonas 'Sortie' Termansen 494636b8eb Added some filesystem utility classes. 2012-07-24 19:56:33 +02:00
Jonas 'Sortie' Termansen f5c4b64aff The console can now be rendered to any text buffer.
The console renderer now renders to a text buffer, which can be implemented
on any device, whether it's the VGA text buffer or a bitmap graphics device
with font rendering. This replaces the older code that could only render to
a VGA framebuffer and where the input parsing was tightly coupled with the
device rendering phase.
2012-07-24 14:48:14 +02:00
Jonas 'Sortie' Termansen 22990b77b8 Refactored the internal kernel memory management API.
It is now permission-oriented, not just user/kernel oriented.

Added <sys/mman.h> with nice PROT_{READ,WRITE,EXEC,FORK} constants.
2012-07-06 17:18:07 +02:00
Jonas 'Sortie' Termansen 2046482e77 Added support for MSRs, PAT and MTRRs.
This provides control over the caching of memory, which makes write-combined
IO possible. Graphics drivers can use this to transfer data at a much higher
rate to the video memory.

The implementation is a bit hacky but it'll do for now. It provides enough
support for the experimental VBE driver to work on the real computers I
tested it on, even if the BIOS uses screwed up default MTRRs.

The virtual memory layer now automatically uses the PAT feature if available
but in a backwards compatible manner and otherwise just tries to approximate
PAT features if they are asked for.
2012-07-01 00:55:36 +02:00
Jonas 'Sortie' Termansen bd489eb73a Forward compatbility with the kthread branch. 2012-05-04 13:13:44 +02:00
Jonas 'Sortie' Termansen db79994e64 Refactored all the sortix headers into a include directory.
Also got rid of trailing white space. That corrupted .git/.

Big ass-commit because of recovered .git directory.
2012-03-22 00:52:29 +01:00
Jonas 'Sortie' Termansen 0364ce6f55 Added a new COM Port driver.
Any detected COM ports available as /dev/comN.

It currently utilizes AGAIN to do polling in user-space. This prevents it
from locking up the whole system and makes it respond to the SIGINT hack.

There is also a more reliable and faster polling-blocking mode, but it locks
up the entire system.

The main interrupt mode is broken, perhaps by a bug in VirtualBox.
2012-03-17 15:48:42 +01:00
Jonas 'Sortie' Termansen 8a9a0c58ea Added kernelinfo(2), which reads a kernel information string.
Currently it lets you query the name of the kernel, its version, and the
build timestamp of the kernelinfo.cpp file.
2012-03-07 18:04:59 +01:00
Jonas 'Sortie' Termansen 4b2c22d480 Added access(2). 2012-03-05 15:46:23 +01:00
Jonas 'Sortie' Termansen aa72efdb2c Added <sortix/timeval.h> to the list of public headers. 2012-03-04 22:18:53 +01:00
Jonas 'Sortie' Termansen db7781c54a Install <sortix/*.h> headers in sysroot. 2012-03-04 16:04:12 +01:00
Jonas 'Sortie' Termansen cfbbf67247 make CALLTRACE=1 to enable printing primitive calltraces upon panic.
This won't work with optimizations turned fully on.

Added protection against double panics.
2012-03-02 14:08:25 +01:00
Jonas 'Sortie' Termansen b4f47f0f79 Split descriptor_tables.cpp into a gdt.cpp and idt.cpp.
This was about time, since descriptor_tables was a really bad name!
2012-03-01 00:15:28 +01:00
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