All Projects → justinian → jsix

justinian / jsix

Licence: other
A hobby operating system for x86_64, boots with UEFI.

Programming Languages

C++
36643 projects - #6 most used programming language
python
139335 projects - #7 most used programming language
c
50402 projects - #5 most used programming language
assembly
5116 projects
shell
77523 projects
GAP
223 projects

Projects that are alternatives of or similar to jsix

FoxOS
The FoxOS main repository
Stars: ✭ 48 (-20%)
Mutual labels:  x64, x86-64, os, uefi
biefircate
Running x86-16 or x86-32 code from x86-64 UEFI; _very experimental_ • mirror of https://gitlab.com/tkchia/biefircate • developer notes at https://gitlab.com/tkchia/biefircate/-/blob/main/doc/NOTES.asciidoc
Stars: ✭ 47 (-21.67%)
Mutual labels:  x64, x86-64, os, uefi
AiliceOS
AiliceOS: Build an x86_64 and UEFI OS using Rust
Stars: ✭ 59 (-1.67%)
Mutual labels:  x86-64, os, uefi
X86 Bare Metal Examples
Dozens of minimal operating systems to learn x86 system programming. Tested on Ubuntu 17.10 host in QEMU 2.10 and real hardware. Userland cheat at: https://github.com/cirosantilli/linux-kernel-module-cheat#userland-assembly ARM baremetal setup at: https://github.com/cirosantilli/linux-kernel-module-cheat#baremetal-setup 学习x86系统编程的数十个最小操作系统。 已在QE…
Stars: ✭ 3,985 (+6541.67%)
Mutual labels:  x64, x86-64
oberon-07-compiler
Oberon-07 compiler for x64 (Windows, Linux), x86 (Windows, Linux, KolibriOS), MSP430x{1,2}xx, STM32 Cortex-M3
Stars: ✭ 45 (-25%)
Mutual labels:  x64, x86-64
Reloaded.Assembler
Minimal .NET wrapper around the simple, easy to use Flat Assembler written by Tomasz Grysztar. Supports both x64 and x86 development.
Stars: ✭ 17 (-71.67%)
Mutual labels:  x64, x86-64
Capstone.NET
.NET Core and .NET Framework binding for the Capstone Disassembly Framework
Stars: ✭ 108 (+80%)
Mutual labels:  x64, x86-64
Asm Cli
Interactive shell of assembly language(X86/X64) based on unicorn and keystone
Stars: ✭ 211 (+251.67%)
Mutual labels:  x64, x86-64
Labeless
Labeless is a multipurpose IDA Pro plugin system for labels/comments synchronization with a debugger backend, with complex memory dumping and interactive Python scripting capabilities.
Stars: ✭ 378 (+530%)
Mutual labels:  x64, x86-64
Rappel
A linux-based assembly REPL for x86, amd64, armv7, and armv8
Stars: ✭ 818 (+1263.33%)
Mutual labels:  x64, x86-64
Beelzebub
The Lord of Flies - A hobby operating system
Stars: ✭ 24 (-60%)
Mutual labels:  x64, x86-64
Fasmg Ebc
An EFI Byte Code (EBC) assembler, based on fasmg
Stars: ✭ 17 (-71.67%)
Mutual labels:  x64, uefi
Evoasm.rb
An AIMGP (Automatic Induction of Machine code by Genetic Programming) engine
Stars: ✭ 91 (+51.67%)
Mutual labels:  x64, x86-64
Efifs
EFI FileSystem drivers
Stars: ✭ 272 (+353.33%)
Mutual labels:  x64, uefi
catsight
Cross-platform process memory inspector
Stars: ✭ 150 (+150%)
Mutual labels:  x64, x86-64
Uefi Ntfs
UEFI:NTFS - Boot NTFS partitions from UEFI
Stars: ✭ 386 (+543.33%)
Mutual labels:  x64, uefi
Asm
Assembly Tutorial for DOS
Stars: ✭ 125 (+108.33%)
Mutual labels:  x64, x86-64
kasm
Assembler library for Kotlin
Stars: ✭ 40 (-33.33%)
Mutual labels:  x64, x86-64
profiler-api
The portable version of JetBrains profiler API for .NET Framework / .NET Core / .NET / .NET Standard / Mono
Stars: ✭ 21 (-65%)
Mutual labels:  x64, x86-64
Distorm
Powerful Disassembler Library For x86/AMD64
Stars: ✭ 829 (+1281.67%)
Mutual labels:  x64, x86-64

jsix

The jsix operating system

jsix is a custom multi-core x64 operating system that I am building from scratch. It's far from finished, or even being usable (see the Status and Roadmap section, below) but all currently-planned major kernel features are now implemented to at least a passable level.

The design goals of the project are:

  • Modernity - I'm not interested in designing for legacy systems, or running on all hardware out there. My target is only 64 bit architectures, and modern commodity hardware. Currently that means x64 systems with Nehalem or newer CPUs and UEFI firmware. (See this list for the currently required CPU features.) Eventually I'd like to work on an AArch64 port, partly to force myself to factor out the architecture-dependent pieces of the code base.

  • Modularity - I'd like to pull as much of the system out into separate processes as possible, in the microkernel fashion. A sub-goal of this is to explore where the bottlenecks of such a microkernel are now, and whether eschewing legacy hardware will let me design a system that's less bogged down by the traditional microkernel problems.

  • Exploration - I'm really mostly doing this to have fun learning and exploring modern OS development. Initial feature implementations may temporarily throw away modular design to allow for exploration of the related hardware.

A note on the name: This kernel was originally named Popcorn, but I have since discovered that the Popcorn Linux project is also developing a kernel with that name, started around the same time as this project. So I've renamed this kernel jsix (Always styled jsix or j6, never capitalized) as an homage to L4, xv6, and my wonderful wife.

Status and Roadmap

The following major feature areas are targets for jsix development:

UEFI boot loader

Done. The bootloader loads the kernel and initial userspace programs, and sets up necessary kernel arguments about the memory map and EFI GOP framebuffer. Possible future ideas:

  • take over more init-time functions from the kernel
  • rewrite it in Zig

Memory

Virtual memory: Sufficient. The kernel manages virtual memory with a number of kinds of vm_area objects representing mapped areas, which can belong to one or more vm_space objects which represent a whole virtual memory space. (Each process has a vm_space, and so does the kernel itself.)

Remaining to do:

  • TLB shootdowns
  • Page swapping
  • Large / huge page support

Physical page allocation: Sufficient. The current physical page allocator implementation uses a group of blocks representing up-to-1GiB areas of usable memory as defined by the bootloader. Each block has a three-level bitmap denoting free/used pages.

Future work:

  • Align blocks so that their first page is 1GiB-aligned, making finding free large/huge pages easier.

Multitasking

Sufficient. The global scheduler object keeps separate ready/blocked lists per core. Cores periodically attempt to balance load via work stealing.

User-space tasks are able to create threads as well as other processes.

API

Syscalls: Sufficient. User-space tasks are able to make syscalls to the kernel via fast SYSCALL/SYSRET instructions. Syscalls made via libj6 look to both the callee and the caller like standard SysV ABI function calls. The implementations are wrapped in generated wrapper functions which validate the request, check capabilities, and find the appropriate kernel objects or handles before calling the implementation functions.

IPC: Working, needs optimization. The current IPC primitives are:

  • Mailboxes: endpoints for asynchronously-delivered small messages. Currently these messages are double-copied - once from the caller into a kernel buffer, and once from the kernel to the receiver. This works and is not a major cause of slowdown, but will need to be optimized in the future.
  • Channels: endpoints for asynchronous uni-directional streams of bytes. Currently these also suffer from a double-copy problem, and should probably be replaced eventually by userspace shared memory communication.
  • Events: objects that can be signalled to send asynchronous notifications to waiting threads.

Hardware Support

  • Framebuffer driver: In progress. Currently on machines with a video device accessible by UEFI, jsix starts a user-space framebuffer driver that only prints out kernel logs.
  • Serial driver: In progress. The current UART currently only exposes COM1 as an output channel, but no input or other serial ports are exposed.
  • USB driver: To do
  • AHCI (SATA) driver: To do

Building

jsix uses the Ninja build tool, and generates the build files for it with the configure script. The build also relies on a custom toolchain sysroot, which can be downloaded or built using the scripts in jsix-os/toolchain.

Other build dependencies:

  • clang: the C/C++ compiler
  • nasm: the assembler
  • lld: the linker
  • mtools: for creating the FAT image

The configure script has some Python dependencies - these can be installed via pip, though doing so in a python virtual environment is recommended. Installing via pip will also install ninja.

A Debian 11 (Bullseye) system can be configured with the necessary build dependencies by running the following commands from the jsix repository root:

sudo apt install clang lld nasm mtools python3-pip python3-venv
python3 -m venv ./venv
source venv/bin/activate
pip install -r requirements.txt
peru sync

Setting up the sysroot

Build or download the toolchain sysroot as mentioned above with jsix-os/toolchain, and symlink the built toolchain directory as sysroot at the root of this project.

# Example if both the toolchain and this project are cloned under ~/src
ln -s ~/src/toolchain/toolchains/llvm-13 ~/src/jsix/sysroot

Building and running jsix

Once the toolchain has been set up, running the ./configure script (see ./configure --help for available options) will set up the build configuration, and ninja -C build (or wherever you put the build directory) will actually run the build. If you have qemu-system-x86_64 installed, the qemu.sh script will to run jsix in QEMU -nographic mode.

I personally run this either from a real debian amd64 bullseye machine or a windows WSL debian bullseye installation. Your mileage may vary with other setups and distros.

Running the test suite

jsix now has the test_runner userspace program that runs various automated tests. It is not included in the default build, but if you use the test.yml manifest it will be built, and can be run with the test.sh script or the qemu.sh script.

./configure --manifest=assets/manifests/test.yml
if ./test.sh; then echo "All tests passed!"; else echo "Failed."; fi
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].