GrieferAtWork / KOSmk2

Chaos operating system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KOS (Hooby) Operating System & Kernel

Like others of its kind, KOS (pronounced chaos) is a home-made operating system designed to be modular and highly compatible with both Linux/GLibC and Windows/MSVCrt.

This is the second rendition of KOS, the first of which remains available at "https://github.com/GrieferAtWork/kos-old-". Unlike the last one though, this time much more focus has been put on keeping the kernel core clean, actually implementing a modular system capable of loading kernel-level drivers/modules/libraries at runtime.

In addition, much more posix features have been implemented, such as a proper /dev filesystem, unix-signals and PID-namespaces alongside zombie processes wait()-ing to be killed (If you get my drift), as well as a large portion of focus having been directed towards memory management that allows what I call ALLOA (ALLocateOnAccess) as well as LOA (LoadOnAccess) and COW (CopyOnWrite) alongside SWAP capabilities, allowing lazy mapping of files to memory, not only in user-space, but also within the kernel itself.

Another strong aspect are the much more posix-conformant system headers including EVERYTHING that GLibC and most that MSVCrt has to offer in those same headers. (even when many things are but stubs until I want to run something that actually needs them...)

Many of the core ideas of the old KOS remain, such as signal-based synchronization (which was been greatly improved and simplified), and the inclusion of the linker being apart of the kernel (Thus allowing for much faster load times when running applications already in cache, as well as no redundancy when loading drivers vs. user-space applications).

But don't take my word for it. - You can actually run BUSYBOX and NCURSES on the thing!

And if you think that's pretty awesome, wait until you realize that this kernel can run and link .exe and .dll files compiled for Windows!

Like everything, this is another one-person project, with development (of this rendition) having started on 5.7.2017.

Chaos|KOS - Even more chaotic than last time.

Features

  • i486+ (Yes. Your machine can't be older than time itself...)
    • Protected-mode ring #3
    • Can run on real hardware
    • x86_64 (64-bit/longmode support)
  • QEMU
  • multiboot/multiboot2
    • Kernel commandline support
  • dynamic memory
    • ALLOA (ALLocateOnAccess)
    • LOA (LoadOnAccess)
    • COW (CopyOnWrite)
    • SWAP (SWAPping memory to disk)
    • memory-mapped files for reading/writing
  • syscall
    • Highly linux-compatible using 0x80 and same ids/registers
  • Unix-compliant user-space interfaces/APIs
    • ANSI-compliant Terminal
    • fork()/exec()/wait()/pipe()
    • shm_open()/mmap()/munmap()/mremap()/brk()/sbrk()
      • Full support for POSIX shared memory and file to memory mappings
    • signal()/raise()/kill()/sigprocmask()
      • Terminate/suspend/resume support for SIGKILL, SIGSTOP, SIGCONT
      • Signal-based exception handling (SIGSEGV, etc.)
    • open()/read()/write()/lseek()
    • fcntl()/ioctl()/openpty()
    • mount()/umount()
    • main()/argc/argv/environ
    • dlopen()/dlclose()/dlsym()
    • clone()/futex()/exit_group()
      • Linux-compatible multi-threading support
    • Can run BUSYBOX, NCURSES and DOOM!
  • Custom-made Libc
    • Binary (ABI) compatibility with both MSVCrt and GLibC
    • System headers designed with portability and clean namespaces
      • Use of <features.h> emulating GLibC, allowing for control of available features using *_SOURCE macros
      • Option to warn about use of non-portable functions
      • Redundant fallbacks of (some) KOS-specific extensions allows for use on other platforms
      • You can actually use KOS's /include folder to spoof MSVCrt and get a much more portable library at the same time!
    • Support for future-proof 64-bit time_t types and functions
  • multitasking/scheduler
    • PID-based addressing, including a mountable /proc filesystem
    • Per-thread everything (Page-directory, files, signals, you-name-it; just like linux...)
    • The only thing that what you call a process must have in common is a secondary, shared signal pool that is per-thread-group
    • Multi-core SMP support
    • low-cpu/true idle (Using per-cpu IDLE threads)
  • ELF binaries/libraries (no extension / .so)
  • PE binaries/libraries (.exe / .dll)
    • TRUE cross-platform native execution of binaries.
    • Putting the Portable back in PE (Which was intended to stand for PortableExecutable)
      • Natively run executables originally compiled for windows. (s.a.: apps/hybrid_demo/main.exe)
  • Disk I/O
    • Builtin driver for BIOS-disk support allows for access to boot USB stick
    • Partition tables
      • MBR
      • EFI
    • Filesystem
      • FAT-12/16/32
        • Including write support & symlink extension (using cygwin symlinks)
      • /dev
      • /proc
  • Drivers
    • PS/2 keyboard input
      • Supports all scansets (#1, #2 and #3)
    • Ne2000 ethernet driver
    • PCI enumeration & database
    • CMOS Real-time-clock
  • Modular kernel design (New features are loaded by drivers)

Planned (As seen in the old KOS)

  • local exception handling in user-space

Planned (As not seen in the old KOS)

  • /sys
  • pthread library (Although threading can already be done using fork() and clone())
  • IP-stack
  • WLAN support for "Atheros AR2427 Wireless" (That one's inside my test machine)

Build Requirements

  • See /INSTALL

About

Chaos operating system

License:zlib License


Languages

Language:C 90.9%Language:C++ 8.5%Language:Objective-C 0.4%Language:Shell 0.1%Language:Assembly 0.0%