Commit Graph

47 Commits

Author SHA1 Message Date
Jonas 'Sortie' Termansen 2ef6804ead Add networking stack.
This change adds all the kernel parts of a network stack. The network stack
is partial but implements many of the important parts.

Add if(4) network interface abstraction. Network interfaces are registered
in a global list that can be iterated and each assigned an unique integer
identifier.

Add reference counted packets with a cache that recycles recent packets.

Add support for lo(4) loopback and ether(4) ethernet network interfaces.
The /dev/lo0 loopback device is created automatically on boot.

Add arp(4) address resolution protocol driver for translation of inet(4)
network layer addresses into ether(4) link layer addresses. arp(4) entries
are cached and evicted from the cache when needed or when the entry has not
been used for a while. The cache is limited to 256 entries for now.

Add ip(4) internet protocol version 4 support. IP fragmentation and options
are not implemented yet.

Add tcp(4) transmission control protocol sockets for a reliable transport
layer protocol that provides a reliable byte stream connection between two
hosts. The implementation is incomplete and does not yet implement out of
band data, options, and high performance extensions.

Add udp(4) user datagram protocol sockets for a connectionless transport
layer that provides best-effort delivery of datagrams.

Add ping(4) sockets for a best-effort delivery of echo datagrams.

Change type of sa_family_t from unsigned short to uint16_t.

Add --disable-network-drivers to the kernel(7) options and expose it with a
bootloader menu. tix-iso-bootconfig can set this option by default.

Import CRC32 code from libz for the Ethernet checksum.

This is a compatible ABI change that adds features to socket(2) (AF_INET,
IPPROTO_TCP, IPPROTO_UDP, IPPROTO_PING), the ioctls for if(4), socket
options, and the lo0 loopback interface.

This commit is based on work by Meisaka Yukara contributed as the commit
bbf7f1e8a5238a2bd1fe8eb1d2cc5c9c2421e2c4. Almost no lines of this work
remains in this final commit as it has been rewritten or refactored away
over the years, see the individual file headers for which files contain
remnants of this work.

Co-authored-by: Meisaka Yukara <Meisaka.Yukara@gmail.com>
2022-12-11 13:40:34 +01:00
Jonas 'Sortie' Termansen 322c8317d6 Fix non-throwing operator new failure checks being optimized away. 2022-04-26 01:08:19 +02:00
Jonas 'Sortie' Termansen 4e86394e3d Fix the kernel having an .init section linked at a high address.
The .init section for global constructors in the kernel is unused at the
moment as the _init function is never invoked, but its existence means
it got linked at 128 MiB on i686. This address isn't mapped by the
kernel and the bootloader requires the machine to have that much
physical memory. Unfortunately that meant the i686 build didn't work on
machines with less than 129 MiB of memory.
2022-01-12 21:19:53 +01:00
Jonas 'Sortie' Termansen 5e7605fad2 Implement threading primitives that truly sleep.
The idle thread is now actually run when the system is idle because it
truly goes idle. The idle thread is made power efficient by using the hlt
instruction rather than a busy loop.

The new futex(2) system call is used to implement fast user-space mutexes,
condition variables, and semaphores. The same backend and design is used as
kutexes for truly sleeping kernel mutexes and condition variables.

The new exit_thread(2) flag EXIT_THREAD_FUTEX_WAKE wakes a futex.

Sleeping on clocks in the kernel now uses timers for true sleep.

The interrupt worker thread now truly sleeps when idle.

Kernel threads are now named.

This is a compatible ABI change.
2021-06-23 22:10:47 +02:00
Jonas 'Sortie' Termansen 3b036b6c5d Add getdnsconfig(2) and setdnsconfig(2). 2021-06-13 23:27:52 +02:00
Jonas 'Sortie' Termansen 4b2cf28bbf Add socket(2).
This removes the /dev/net socket interface.

This is an incompatible ABI change.
2017-02-14 20:43:31 +01:00
Jonas 'Sortie' Termansen ce54be34da Add VirtualBox Guest Additions. 2016-11-27 11:18:49 +01:00
Jonas 'Sortie' Termansen b38c84852c Add pseudo terminals.
This is a compatible ABI change riding on the previous commit's bump.
2016-11-23 22:31:05 +01:00
Jonas 'Sortie' Termansen 9603be8e65 Split LogTerminal into a base class with the core terminal semantics.
No semantic change.
2016-11-05 17:00:43 +01:00
Jonas 'Sortie' Termansen a97e1ef16c Modernize carray(1) and fix missing allocation checks.
Add short options for most long options. Rename the -i option to -H, but
support -i for compatibility until the next release cycle, where -i will
become the short option of --identifier. Rename --include to --headers
and support --include until the next release cycle.

Add carray(1) manual page which makes --help unnecessary, and remove
--version as it surely matches your local Sortix version.
2016-09-29 00:01:41 +02:00
Jonas 'Sortie' Termansen 01b59c1947 Convert libc to C. 2016-03-03 23:02:23 +01:00
Jonas 'Sortie' Termansen 3487b62152 Remove dead MTRR code from the kernel. 2016-02-29 01:37:31 +01:00
Jonas 'Sortie' Termansen 02c6316e95 Remove kernel debugger, old kernel US layout and kernel symbol code.
The debugger has fallen behind and has become a maintenance burden.  It was
the only user of the old kernel US layout system, which is good to get rid
of.  The debugger didn't work with graphical output and was likely to
conflict with the new keyboard system if used, which no longer triggered it.
The kernel symbol code was removed to simplify the kernel.

The kernel debugger was an useful debugging feature, but it needs to be done
in a better way before it can be added back.
2016-02-22 00:12:26 +01:00
Jonas 'Sortie' Termansen 475bd7c26e Add support for multiple initrds. 2016-02-07 14:48:27 +01:00
Jonas 'Sortie' Termansen 398eee1a8b Add AHCI driver. 2016-02-02 22:47:49 +01:00
Jonas 'Sortie' Termansen 79e01c2eba Rewrite ATA driver. 2016-02-02 22:47:49 +01:00
Jonas 'Sortie' Termansen 9297ff2a20 Add PS/2 mouse driver. 2016-01-23 00:50:53 +01:00
Jonas 'Sortie' Termansen 306709fc4a Add PS/2 controller driver. 2016-01-23 00:50:53 +01:00
Jonas 'Sortie' Termansen dad5c57f33 Allow bootloader bitmap framebuffer modesetting. 2016-01-08 19:56:11 +01:00
Jonas 'Sortie' Termansen f60b2c6ec4 Add keyboard layout support to kernel. 2015-12-19 02:44:15 +01:00
Jonas 'Sortie' Termansen cee24359d8 Add psctl(2). 2015-12-12 19:28:07 +01:00
Jonas 'Sortie' Termansen 1acf16dea0 Fix kernel makefile finding crtbegin.o and crtend.o when not needed. 2015-12-12 16:53:42 +01:00
Jonas 'Sortie' Termansen 75cf34cb8e Add random device. 2015-08-22 01:04:58 +02:00
Jonas 'Sortie' Termansen a422c394b8 Initialize the GDT in the bootstrap assembly. 2015-08-21 21:25:00 +02:00
Jonas 'Sortie' Termansen e259e8ae52 Use standard compiler environment variables. 2015-05-10 16:56:22 +02:00
Jonas 'Sortie' Termansen 2874495111 Remove per-architecture exec-prefixes from filesystem hierarchy. 2015-04-23 20:02:03 +02:00
Jonas 'Sortie' Termansen 825029a24a Fix kernel Makefile cleaning root directory files if CPU is unset. 2015-02-11 17:47:18 +01:00
Jonas 'Sortie' Termansen 4f7c5ebdd3 Fix PCI code. 2015-02-08 22:58:32 +01:00
Jonas 'Sortie' Termansen 3ad7ab4fc3 Add gethostname(2) and sethostname(2). 2014-12-03 13:58:29 +01:00
Jonas 'Sortie' Termansen 2586685061 Ongoing build system maintainance. 2014-12-02 17:09:28 +01:00
Jonas 'Sortie' Termansen 35708fa900 Retire calltrace support in favor of the kernel debugger. 2014-12-01 21:38:06 +01:00
Jonas 'Sortie' Termansen e460be7a72 Add getentropy(2). 2014-11-28 13:35:51 +01:00
Jonas 'Sortie' Termansen 2ff72426ec Implement SO_RCVBUF and SO_SNDBUF for filesystem sockets. 2014-11-25 17:14:46 +01:00
Jonas 'Sortie' Termansen 9e6148f6ff Refactor default compiler options logic. 2014-11-24 17:10:50 +01:00
Jonas 'Sortie' Termansen ee13ffa715 Refactor kernel graphics support. 2014-11-19 00:08:49 +01:00
Jonas 'Sortie' Termansen 8f7c72abc1 Add utility functions for mapping PCI memory areas. 2014-11-18 23:14:49 +01:00
Jonas 'Sortie' Termansen 400eb2238f Refactor process id allocation and accounting. 2014-11-18 20:33:21 +01:00
Jonas 'Sortie' Termansen 25e07a9083 Refactor kernel interrupt and thread register support. 2014-11-18 20:33:21 +01:00
Jonas 'Sortie' Termansen 7b3e2fa229 Clean up kernel thread creation code. 2014-11-18 18:10:22 +01:00
Jonas 'Sortie' Termansen 534eb3ddd8 Fix libk being built with -mmmx, -msse and -msse2 on x86_64. 2014-05-28 17:42:19 +02:00
Jonas 'Sortie' Termansen 8c00a4145c Refactor kernel PAT, MTRR, and MSR usage. 2014-03-17 19:22:13 +01:00
Jonas 'Sortie' Termansen a133a7717e Refactor i386 and x86_64 interrupt support. 2014-03-17 19:22:13 +01:00
Jonas 'Sortie' Termansen fc713baba3 Rename libc-sortix to libk. 2014-03-01 14:37:42 +01:00
Jonas 'Sortie' Termansen cd254cd799 Remove kernel/utf8.{cpp,h}. 2014-03-01 14:37:41 +01:00
Jonas 'Sortie' Termansen c3f1550bba Remove kernel/serialterminal.{cpp,h}. 2014-03-01 14:37:41 +01:00
Jonas 'Sortie' Termansen 6788f0096e Preprocess assembly files with the C preprocessor. 2014-03-01 14:37:40 +01:00
Jonas 'Sortie' Termansen 98a87fa1e5 Rename Sortix kernel directory to kernel. 2014-03-01 14:37:39 +01:00
Renamed from sortix/Makefile (Browse further)