Commit Graph

32 Commits

Author SHA1 Message Date
Jonas 'Sortie' Termansen 05b29ce25a Renamed rfork(2) to sfork(2) to avoid compatibility issues.
sfork is much like rfork except sharing is default for everything.

Eventually, I'll make a rfork(3) wrapper function around sfork(2) to
provide compatibility to BSD programs.

I don't like Linux clone(2): that's some messy function.
2012-04-04 00:29:25 +02:00
Jonas 'Sortie' Termansen 95a088fec5 Added a dummy implementation rfork(2) equal to fork(2).
Note that in my implementation, you share per default, unless you ask.
2012-04-02 16:30:13 +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 2cdeb575f8 Renamed EACCESS to EACCES.
Stupid POSIX.
2012-03-12 01:43:00 +01:00
Jonas 'Sortie' Termansen 75b14aa821 Refactored the descriptor table and added FD_CLOEXEC and FD_CLOFORK.
open(2) now also respects O_CLOEXEC and O_CLOFORK.
2012-03-04 21:06:49 +01:00
Jonas 'Sortie' Termansen 0ed0082070 Added execv(3) and execve(3).
Removed the older libmaxsi system call.
2012-03-02 15:00:11 +01:00
Jonas 'Sortie' Termansen 5fde8e13ed Blocking systemcalls now return EBLOCKING instead of EWOULDBLOCK.
EWOULDBLOCK is now used when it wanted to block, but didn't.
2012-02-10 13:28: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 acf1eebc98 Added user-space memory allocation. 2011-12-16 13:24:49 +01:00
Jonas 'Sortie' Termansen 6562da4092 waitpid(2) now returns ECHILD on error. 2011-12-01 14:54:19 +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 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 2b032b0414 Initial signal support. Please squash improvements into this commit. 2011-11-23 00:19:09 +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 9f35df813e Implemented errno(3), added support in both kernel and utils. 2011-11-22 17:26: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 d4590cefa1 Added chdir(2), getcwd(2), which mxsh and ls now uses. 2011-11-21 12:19:57 +01:00
Jonas 'Sortie' Termansen 446616b3aa Improved JSVM compabillity. 2011-11-20 15:58:42 +01:00
Jonas 'Sortie' Termansen ae599b6d67 Argv now works in main. 2011-11-09 23:18:26 +01:00
Jonas 'Sortie' Termansen 024f1581ea Added the wait() and waitpid() system call. 2011-11-07 00:59:48 +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 e110594ab2 Processes are listed in a global array sorted after pid. 2011-11-02 17:51:01 +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 4bc2841ef0 Restored the partial support for x64. 2011-09-08 21:09:14 +02:00
Jonas 'Sortie' Termansen 34e9ca277d Added a shell, a few programs, and added support for SIGINT. 2011-08-28 12:38:01 +02:00
Jonas 'Sortie' Termansen 2f9d08a800 Added a process execute API. 2011-08-28 12:38:01 +02:00
Jonas 'Sortie' Termansen 5c86cb4abd Processes now remember the memory segments it has loaded. 2011-08-27 16:46:00 +02:00