Convert to workspace
This commit is contained in:
parent
20df4eb072
commit
88fe204b02
136
Cargo.lock
generated
136
Cargo.lock
generated
@ -11,20 +11,6 @@ dependencies = [
|
|||||||
"sptr",
|
"sptr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "acpi"
|
|
||||||
version = "6.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4c85d96f36022f650ee6f184f1353d077124754cecf6a3e91085a708495c6f5a"
|
|
||||||
dependencies = [
|
|
||||||
"bit_field",
|
|
||||||
"bitflags",
|
|
||||||
"byteorder",
|
|
||||||
"log",
|
|
||||||
"pci_types",
|
|
||||||
"spinning_top",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "align-address"
|
name = "align-address"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
@ -49,36 +35,6 @@ version = "2.10.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
|
checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "build_const"
|
|
||||||
version = "0.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b4ae4235e6dac0694637c763029ecea1a2ec9e4e06ec2729bd21ba4d9c863eb7"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "byteorder"
|
|
||||||
version = "1.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core2"
|
|
||||||
version = "0.3.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "239fa3ae9b63c2dc74bd3fa852d4792b8b305ae64eeede946265b6af62f1fff3"
|
|
||||||
dependencies = [
|
|
||||||
"memchr",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crc"
|
|
||||||
version = "1.8.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb"
|
|
||||||
dependencies = [
|
|
||||||
"build_const",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "critical-section"
|
name = "critical-section"
|
||||||
version = "1.2.0"
|
version = "1.2.0"
|
||||||
@ -105,11 +61,6 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fdt"
|
|
||||||
version = "0.2.0-alpha1"
|
|
||||||
source = "git+https://github.com/repnop/fdt#059bb2383873f8001959456e36ec123228f67642"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flagset"
|
name = "flagset"
|
||||||
version = "0.4.7"
|
version = "0.4.7"
|
||||||
@ -128,35 +79,32 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gila"
|
name = "intbits"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5170c2c8ecda29c1bccb9d95ccbe107bc75fa084dc0c9c6087e719f9d46330e5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "kernel"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"acid_alloc",
|
"acid_alloc",
|
||||||
"acpi",
|
|
||||||
"enumflags2",
|
"enumflags2",
|
||||||
"fdt",
|
|
||||||
"flagset",
|
"flagset",
|
||||||
"free-list",
|
"free-list",
|
||||||
"intbits",
|
"intbits",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
"libgila",
|
||||||
"limine",
|
"limine",
|
||||||
"lzma-rs",
|
|
||||||
"num-derive",
|
"num-derive",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"raw-cpuid",
|
"raw-cpuid",
|
||||||
"spin 0.10.0",
|
"spin 0.10.0",
|
||||||
"talc",
|
"talc",
|
||||||
"tar-no-std",
|
|
||||||
"x86_64",
|
"x86_64",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "intbits"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5170c2c8ecda29c1bccb9d95ccbe107bc75fa084dc0c9c6087e719f9d46330e5"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "lazy_static"
|
||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
@ -166,6 +114,14 @@ dependencies = [
|
|||||||
"spin 0.9.8",
|
"spin 0.9.8",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libgila"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"num-derive",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "limine"
|
name = "limine"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
@ -184,28 +140,6 @@ dependencies = [
|
|||||||
"scopeguard",
|
"scopeguard",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "log"
|
|
||||||
version = "0.4.28"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "lzma-rs"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "git+https://github.com/glaeqen/lzma-no-std-rs/#5635feaf5923f54161e9582dddb80cd457c07223"
|
|
||||||
dependencies = [
|
|
||||||
"byteorder",
|
|
||||||
"core2",
|
|
||||||
"crc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "memchr"
|
|
||||||
version = "2.7.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-derive"
|
name = "num-derive"
|
||||||
version = "0.4.2"
|
version = "0.4.2"
|
||||||
@ -236,16 +170,6 @@ dependencies = [
|
|||||||
"portable-atomic",
|
"portable-atomic",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pci_types"
|
|
||||||
version = "0.10.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c4325c6aa3cca3373503b1527e75756f9fbfe5fd76be4b4c8a143ee47430b8e0"
|
|
||||||
dependencies = [
|
|
||||||
"bit_field",
|
|
||||||
"bitflags",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "portable-atomic"
|
name = "portable-atomic"
|
||||||
version = "1.11.1"
|
version = "1.11.1"
|
||||||
@ -263,9 +187,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.41"
|
version = "1.0.42"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"
|
checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
@ -312,15 +236,6 @@ dependencies = [
|
|||||||
"lock_api",
|
"lock_api",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "spinning_top"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d96d2d1d716fb500937168cc09353ffdc7a012be8475ac7308e1bdf0e3923300"
|
|
||||||
dependencies = [
|
|
||||||
"lock_api",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sptr"
|
name = "sptr"
|
||||||
version = "0.2.3"
|
version = "0.2.3"
|
||||||
@ -329,9 +244,9 @@ checksum = "5cdeee85371b1ec1f4b305c91787271a39f56b66e673bdbd73b7742150de5b0e"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.109"
|
version = "2.0.110"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2f17c7e013e88258aa9543dcbe81aca68a667a9ac37cd69c9fbc07858bfe0e2f"
|
checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -347,17 +262,6 @@ dependencies = [
|
|||||||
"lock_api",
|
"lock_api",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tar-no-std"
|
|
||||||
version = "0.4.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "715f9a4586706a61c571cb5ee1c3ac2bbb2cf63e15bce772307b95befef5f5ee"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"log",
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.22"
|
version = "1.0.22"
|
||||||
|
|||||||
50
Cargo.toml
50
Cargo.toml
@ -1,47 +1,3 @@
|
|||||||
[package]
|
[workspace]
|
||||||
name = "gila"
|
resolver = "3"
|
||||||
version = "0.3.1"
|
members = ["kernel", "libgila"]
|
||||||
edition = "2024"
|
|
||||||
license = "MIT"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
acid_alloc = { version = "0.1.0", features = ["alloc"] }
|
|
||||||
enumflags2 = "0.7.12"
|
|
||||||
flagset = "0.4.7"
|
|
||||||
free-list = { version = "0.3.1", features = ["x86_64"] }
|
|
||||||
intbits = "0.2.0"
|
|
||||||
lazy_static = { version = "1.5.0", default-features = false, features = ["spin_no_std"] }
|
|
||||||
limine = "0.5.0"
|
|
||||||
num-derive = "0.4.2"
|
|
||||||
num-traits = { version = "0.2.19", default-features = false }
|
|
||||||
once_cell = { version = "1.21.3", default-features = false, features = ["alloc", "critical-section"] }
|
|
||||||
spin = "0.10.0"
|
|
||||||
talc = "4.4.3"
|
|
||||||
# Optional Dependencies for Features
|
|
||||||
tar-no-std = "0.4.2"
|
|
||||||
fdt = { git = "https://github.com/repnop/fdt", version = "0.2.0-alpha1", optional = true }
|
|
||||||
acpi = { version = "6.0.1", optional = true }
|
|
||||||
lzma-rs = { git = "https://github.com/glaeqen/lzma-no-std-rs/", version = "0.2.0", default-features = false, optional = true }
|
|
||||||
|
|
||||||
[target.'cfg(target_arch = "x86_64")'.dependencies]
|
|
||||||
x86_64 = "0.15.2"
|
|
||||||
raw-cpuid = "11.6.0"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "gila"
|
|
||||||
path = "src/lib/lib.rs"
|
|
||||||
|
|
||||||
[[bin]]
|
|
||||||
name = "kernel"
|
|
||||||
path = "src/kernel/main.rs"
|
|
||||||
test = false
|
|
||||||
doctest = false
|
|
||||||
bench = false
|
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["acpi", "dtb", "uefi", "compression"]
|
|
||||||
acpi = ["dep:acpi"] # Support ACPI
|
|
||||||
dtb = ["dep:fdt"] # Support device tree blobs
|
|
||||||
uefi = [] # Enable UEFI dependent features
|
|
||||||
compression = ["dep:lzma-rs"] # Enable compressed initramfs
|
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
env_scripts = [
|
env_scripts = [
|
||||||
'''
|
'''
|
||||||
#!@duckscript
|
#!@duckscript
|
||||||
@ -21,6 +22,9 @@ env_scripts = [
|
|||||||
'''
|
'''
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[config]
|
||||||
|
default_to_workspace = false
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
# Directory for Limine binaries
|
# Directory for Limine binaries
|
||||||
LIMINEDIR = "/usr/share/limine"
|
LIMINEDIR = "/usr/share/limine"
|
||||||
@ -75,20 +79,20 @@ command = "rm"
|
|||||||
args = ["-rf", "build/initramfs", "build/initramfs.tar.lzma"]
|
args = ["-rf", "build/initramfs", "build/initramfs.tar.lzma"]
|
||||||
|
|
||||||
[tasks.lib]
|
[tasks.lib]
|
||||||
condition = { files_modified = { input = ["src/lib/**/*.rs"], output = ["${ARTIFACTDIR}/libgila.rlib"] }, fail_message = "(inputs unchanged)" }
|
condition = { files_modified = { input = ["libgila/src/**/*.rs"], output = ["${ARTIFACTDIR}/libgila.rlib"] }, fail_message = "(inputs unchanged)" }
|
||||||
dependencies = []
|
dependencies = []
|
||||||
command = "cargo"
|
command = "cargo"
|
||||||
args = ["build", "--profile", "${PROFILE}", "--lib"]
|
args = ["build", "--profile", "${PROFILE}", "-p", "libgila"]
|
||||||
|
|
||||||
[tasks.kernel]
|
[tasks.kernel]
|
||||||
condition = { files_modified = { input = [
|
condition = { files_modified = { input = [
|
||||||
"src/kernel/**/*.rs",
|
"kernel/src/**/*.rs",
|
||||||
"src/kernel/**/*.ld",
|
"kernel/src/**/*.ld",
|
||||||
"${ARTIFACTDIR}/libgila.rlib"
|
"${ARTIFACTDIR}/libgila.rlib"
|
||||||
], output = ["${ARTIFACTDIR}/kernel"] }, fail_message = "(inputs unchanged)" }
|
], output = ["${ARTIFACTDIR}/kernel"] }, fail_message = "(inputs unchanged)" }
|
||||||
dependencies = ["lib"]
|
dependencies = ["lib"]
|
||||||
command = "cargo"
|
command = "cargo"
|
||||||
args = ["build", "--profile", "${PROFILE}", "--bin", "kernel"]
|
args = ["build", "--profile", "${PROFILE}", "-p", "kernel"]
|
||||||
|
|
||||||
[tasks.bins]
|
[tasks.bins]
|
||||||
dependencies = []
|
dependencies = []
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
Gila is a Rust microkernel OS, inspired by microkernel projects such as seL4 and Redox. I aim to implement multitasking, userspace drivers, IPC, and sandboxing. I do not aim to make it POSIX-compatible, but it will likely end up sharing many features with POSIX operating systems. Its design philosophy is focused around simplicity, isolation, modularity, and minimal privilege.
|
Gila is a Rust microkernel OS, inspired by microkernel projects such as seL4, Zircon, and Redox. I aim to implement multitasking, userspace drivers, IPC, and sandboxing. I do not aim to make it POSIX-compatible, but it will likely end up sharing many features with POSIX operating systems. Its design philosophy is focused around simplicity, isolation, modularity, and minimal privilege.
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
@ -25,10 +25,7 @@ Information on the build system, repo structure, features, configuration options
|
|||||||
|
|
||||||
- Display console
|
- Display console
|
||||||
- Serial console
|
- Serial console
|
||||||
- Device discovery & APIs
|
|
||||||
- Power management
|
|
||||||
- Paging
|
- Paging
|
||||||
- initramfs decompression & manifest parsing
|
|
||||||
|
|
||||||
### Future/Desired
|
### Future/Desired
|
||||||
|
|
||||||
|
|||||||
@ -9,20 +9,14 @@ similar to (if not compatible with) D-Bus.
|
|||||||
## Boot Process
|
## Boot Process
|
||||||
|
|
||||||
Gila initializes as a bare kernel, with the bootloader providing an init RAM
|
Gila initializes as a bare kernel, with the bootloader providing an init RAM
|
||||||
filesystem in the form of a .tar.lzma archive. The kernel reads this file, and
|
filesystem in the form of a .tar.lzma archive.
|
||||||
launches an init process (`/system/bin/init`). The init process has its own
|
|
||||||
configuration file located at `/system/cfg/init.toml`, which should detail the
|
|
||||||
steps needed to bring the system up to a multi-user status. This config file
|
|
||||||
will also contain versioning information for compatibility, detailing which
|
|
||||||
kernel version and architecture it is compatible with.
|
|
||||||
|
|
||||||
If the init system needs to access a filesystem, it must first get the handle
|
To avoid having to implement things like LZMA, TAR, and ELF parsing into the
|
||||||
of the filesystem server. If the filesystem server is not running when this
|
kernel proper, Gila will use a compiled-in stub program as its first process.
|
||||||
handle request is made, the kernel will launch the server before returning its
|
This process will perform the necessary functionality to scan the initramfs,
|
||||||
handle. From there, the filesystem server will request the handle of the disk
|
read config files, load executables into memory, and start processes. This is
|
||||||
driver that corresponds to the requested filesystem. The kernel then launches
|
inspired by the Zircon microkernel's userboot setup. This userboot binary is
|
||||||
the disk driver server, and assigns it a seat based on the device it drives,
|
responsible for starting the proper init system.
|
||||||
granting it access to the memory region responsible for that device.
|
|
||||||
|
|
||||||
The benefit of this approach is threefold:
|
The benefit of this approach is threefold:
|
||||||
|
|
||||||
|
|||||||
@ -7,44 +7,44 @@ design details can be found in [SECURITY.md](SECURITY.md).
|
|||||||
|
|
||||||
## Navigating
|
## Navigating
|
||||||
|
|
||||||
- [kernel/](../src/kernel/): Kernel-specific code.
|
- [kernel/src/](../kernel/src/): Kernel-specific code.
|
||||||
- [arch/](../src/kernel/arch/): Architecture specific features like the
|
- [arch/](../kernel/src/arch/): Architecture specific features like the
|
||||||
display, serial, and interrupts. Each architecture is a subfolder,
|
display, serial, and interrupts. Each architecture is a subfolder,
|
||||||
containing a file or module for each feature.
|
containing a file or module for each feature.
|
||||||
- [boot/](../src/kernel/boot/mod.rs): Handles bootloader-managed data
|
- [boot/](../kernel/src/boot/mod.rs): Handles bootloader-managed data
|
||||||
structures. Gila uses Limine. Other bootloaders are NOT supported.
|
structures. Gila uses Limine. Other bootloaders are NOT supported.
|
||||||
- [params.rs](../src/kernel/boot/params.rs): Command line parameter parsing.
|
- [params.rs](../kernel/src/boot/params.rs): Command line parameter parsing.
|
||||||
- [modules.rs](../src/kernel/boot/modules.rs): Kernel module handling.
|
- [modules.rs](../kernel/src/boot/modules.rs): Kernel module handling.
|
||||||
- [constants.rs](../src/kernel/constants.rs): Constants referenced elsewhere
|
- [constants.rs](../kernel/src/constants.rs): Constants referenced elsewhere
|
||||||
in the kernel.
|
in the kernel.
|
||||||
- [device/](../src/kernel/device/mod.rs): Functions for discovering hardware
|
- [device/](../kernel/src/device/mod.rs): Functions for discovering hardware
|
||||||
and assigning drivers.
|
and assigning drivers.
|
||||||
- [acpi.rs](../src/kernel/device/acpi.rs): ACPI handling functions and
|
- [acpi.rs](../kernel/src/device/acpi.rs): ACPI handling functions and
|
||||||
structures.
|
structures.
|
||||||
- [log.rs](../src/kernel/log.rs): Logging structures, macros, and singletons
|
- [log.rs](../kernel/src/log.rs): Logging structures, macros, and singletons
|
||||||
for logging to serial or the display.
|
for logging to serial or the display.
|
||||||
- [interrupt/](../src/kernel/interrupt/mod.rs): Interrupt handlers with
|
- [interrupt/](../kernel/src/interrupt/mod.rs): Interrupt handlers with
|
||||||
platform-agnostic APIs.
|
platform-agnostic APIs.
|
||||||
- [main.rs](../src/kernel/main.rs): The entry point that gets called by the
|
- [main.rs](../kernel/src/main.rs): The entry point that gets called by the
|
||||||
bootloader.
|
bootloader.
|
||||||
- [memory.rs](../src/kernel/memory.rs): Types relating to memory regions and
|
- [memory.rs](../kernel/src/memory.rs): Types relating to memory regions and
|
||||||
allocation.
|
allocation.
|
||||||
- [panic.rs](../src/kernel/panic.rs): The panic handler and associated
|
- [panic.rs](../kernel/src/panic.rs): The panic handler and associated
|
||||||
functionality.
|
functionality.
|
||||||
- [process.rs](../src/kernel/process.rs): Process types and functions.
|
- [process.rs](../kernel/src/process.rs): Process types and functions.
|
||||||
- [syscall\_runner.rs](../src/kernel/syscall_runner.rs): Chooses a system call
|
- [syscall\_runner.rs](../kernel/src/syscall_runner.rs): Chooses a system call
|
||||||
by its ID and defers actual syscall execution to code in `src/lib/`.
|
by its ID and defers actual syscall execution to code in `src/lib/`.
|
||||||
- [lib/](../src/lib/lib.rs): Library that all Gila's binary programs will be
|
- [libgila/src/](../libgila/src/lib.rs): Library that all Gila's binary programs will be
|
||||||
built against. Some of this code is shared with the kernel.
|
built against. Some of this code is shared with the kernel.
|
||||||
- [arch/](../src/lib/arch/mod.rs): Architecture specific functionality like
|
- [arch/](../libgila/src/arch/mod.rs): Architecture specific functionality like
|
||||||
system call register storing/loading.
|
system call register storing/loading.
|
||||||
- [syscall.rs](../src/lib/syscall.rs): System call types common to apps and
|
- [syscall.rs](../libgila/src/syscall.rs): System call types common to apps and
|
||||||
the kernel.
|
the kernel.
|
||||||
|
|
||||||
## Building and running
|
## Building and running
|
||||||
|
|
||||||
Building a bootable kernel is easy. All you need to do is run
|
Building a bootable kernel is easy. All you need to do is run
|
||||||
`cargo build --bin kernel`, and a valid, bootable Limine executable will be
|
`cargo build -p kernel`, and a valid, bootable Limine executable will be
|
||||||
generated. However, it cannot be booted without installing it in a bootable
|
generated. However, it cannot be booted without installing it in a bootable
|
||||||
Limine filesystem, and it cannot do anything useful without an initramfs
|
Limine filesystem, and it cannot do anything useful without an initramfs
|
||||||
containing system servers, such as the init server and device drivers.
|
containing system servers, such as the init server and device drivers.
|
||||||
@ -88,20 +88,6 @@ and `iso` tasks will automatically be rerun if their input files change.
|
|||||||
> The `-p {profile}` argument must go between `cargo make` and the task
|
> The `-p {profile}` argument must go between `cargo make` and the task
|
||||||
argument.
|
argument.
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
Gila has four optional features, which I made optional in anticipation of a
|
|
||||||
potential future port to older systems which might not support modern
|
|
||||||
standards like UEFI or ACPI. They are all enabled by default. Disabling them
|
|
||||||
reduces kernel size and forces the kernel to fall back to other
|
|
||||||
implementations for some functionality like device discovery.
|
|
||||||
|
|
||||||
- `acpi`: Advanced Configuration and Power Interface, for device discovery &
|
|
||||||
power management
|
|
||||||
- `dtb`: Device Tree Blob, for device discovery in embedded systems
|
|
||||||
- `compression`: Compressed initramfs archive
|
|
||||||
- `uefi`: Universal Extensible Firmware Interface specific bootloader features
|
|
||||||
|
|
||||||
### Targets
|
### Targets
|
||||||
|
|
||||||
Gila ~~currently supports~~ aims to support four different CPU architectures:
|
Gila ~~currently supports~~ aims to support four different CPU architectures:
|
||||||
|
|||||||
@ -95,6 +95,13 @@ namespace, such as IPC and shared memory.
|
|||||||
|
|
||||||
### Capability based MAC
|
### Capability based MAC
|
||||||
|
|
||||||
|
Gila has no concept of ambient authority. Resource access is not governed
|
||||||
|
based on any inherent privilege level of the accessing process- rather,
|
||||||
|
processes must possess capabilities specific to that resource. A process
|
||||||
|
cannot defer a resource access to a process which already has the capability,
|
||||||
|
it must *copy* or *transfer* its own capability to that resource, to the
|
||||||
|
process which will access it.
|
||||||
|
|
||||||
Namespaces will be enforced using capabilities, where a process holds a
|
Namespaces will be enforced using capabilities, where a process holds a
|
||||||
capability object representing the namespace it is in, and the rights it has
|
capability object representing the namespace it is in, and the rights it has
|
||||||
within that namespace. By default, processes have no such capabilities, but
|
within that namespace. By default, processes have no such capabilities, but
|
||||||
|
|||||||
32
kernel/Cargo.toml
Normal file
32
kernel/Cargo.toml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
[package]
|
||||||
|
name = "kernel"
|
||||||
|
version = "0.3.1"
|
||||||
|
edition = "2024"
|
||||||
|
license = "MIT"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
acid_alloc = { version = "0.1.0", features = ["alloc"] }
|
||||||
|
enumflags2 = "0.7.12"
|
||||||
|
flagset = "0.4.7"
|
||||||
|
free-list = { version = "0.3.1", features = ["x86_64"] }
|
||||||
|
intbits = "0.2.0"
|
||||||
|
lazy_static = { version = "1.5.0", default-features = false, features = ["spin_no_std"] }
|
||||||
|
limine = "0.5.0"
|
||||||
|
num-derive = "0.4.2"
|
||||||
|
num-traits = { version = "0.2.19", default-features = false }
|
||||||
|
once_cell = { version = "1.21.3", default-features = false, features = ["alloc", "critical-section"] }
|
||||||
|
spin = "0.10.0"
|
||||||
|
talc = "4.4.3"
|
||||||
|
|
||||||
|
libgila = { path = "../libgila" }
|
||||||
|
|
||||||
|
[target.'cfg(target_arch = "x86_64")'.dependencies]
|
||||||
|
x86_64 = "0.15.2"
|
||||||
|
raw-cpuid = "11.6.0"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "kernel"
|
||||||
|
path = "src/main.rs"
|
||||||
|
test = false
|
||||||
|
doctest = false
|
||||||
|
bench = false
|
||||||
@ -1,7 +1,7 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
|
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
|
||||||
// Tell cargo to pass the linker script to the linker..
|
// Tell cargo to pass the linker script to the linker..
|
||||||
println!("cargo:rustc-link-arg=-Tsrc/kernel/arch/{arch}/linker.ld");
|
println!("cargo:rustc-link-arg=-Tkernel/src/arch/{arch}/linker.ld");
|
||||||
// ..and to re-run if it changes.
|
// ..and to re-run if it changes.
|
||||||
println!("cargo:rerun-if-changed=src/kernel/arch/{arch}linker.ld");
|
println!("cargo:rerun-if-changed=kernel/src/arch/{arch}linker.ld");
|
||||||
}
|
}
|
||||||
@ -4,8 +4,8 @@
|
|||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use crate::constants::KERNEL_BUILD_PROFILE;
|
use crate::constants::KERNEL_BUILD_PROFILE;
|
||||||
use crate::{LOGGER, LogLevel, format, log_info, log_trace, memory::HHDM_RESPONSE};
|
|
||||||
use crate::memory::alloc::boxed::Box;
|
use crate::memory::alloc::boxed::Box;
|
||||||
|
use crate::{LOGGER, LogLevel, format, log_info, log_trace, memory::HHDM_RESPONSE};
|
||||||
use free_list::{PAGE_SIZE, PageLayout};
|
use free_list::{PAGE_SIZE, PageLayout};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use spin::Mutex;
|
use spin::Mutex;
|
||||||
@ -1,46 +1,10 @@
|
|||||||
// Copyright (c) 2025 shibedrill
|
// Copyright (c) 2025 shibedrill
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
use enumflags2::{BitFlags, bitflags};
|
|
||||||
use lazy_static::lazy_static;
|
|
||||||
|
|
||||||
use crate::format;
|
use crate::format;
|
||||||
use crate::log::LogLevel;
|
use crate::log::LogLevel;
|
||||||
use crate::memory::alloc::string::String;
|
use crate::memory::alloc::string::String;
|
||||||
|
|
||||||
#[bitflags]
|
|
||||||
#[repr(u8)]
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
|
||||||
pub enum Features {
|
|
||||||
Acpi,
|
|
||||||
Dtb,
|
|
||||||
Compression,
|
|
||||||
Uefi,
|
|
||||||
}
|
|
||||||
|
|
||||||
lazy_static! {
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub static ref FEATURE_FLAGS: BitFlags<Features> = {
|
|
||||||
let mut temp_flags = BitFlags::<Features>::empty();
|
|
||||||
#[cfg(feature = "acpi")]
|
|
||||||
temp_flags.insert(Features::Acpi);
|
|
||||||
#[cfg(feature = "dtb")]
|
|
||||||
temp_flags.insert(Features::Dtb);
|
|
||||||
#[cfg(feature = "compression")]
|
|
||||||
temp_flags.insert(Features::Compression);
|
|
||||||
#[cfg(feature = "uefi")]
|
|
||||||
temp_flags.insert(Features::Uefi);
|
|
||||||
temp_flags
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub static INITRAMFS_DEFAULT_PATH: &str = if cfg!(feature = "compression") {
|
|
||||||
"/boot/initramfs.tar.lzma"
|
|
||||||
} else {
|
|
||||||
"/boot/initramfs.tar"
|
|
||||||
};
|
|
||||||
|
|
||||||
pub static LOG_DEFAULT_LEVEL: LogLevel = LogLevel::Info;
|
pub static LOG_DEFAULT_LEVEL: LogLevel = LogLevel::Info;
|
||||||
|
|
||||||
pub static KERNEL_BUILD_PROFILE: &str = {
|
pub static KERNEL_BUILD_PROFILE: &str = {
|
||||||
@ -9,7 +9,6 @@
|
|||||||
mod arch;
|
mod arch;
|
||||||
mod boot;
|
mod boot;
|
||||||
mod constants;
|
mod constants;
|
||||||
mod device;
|
|
||||||
mod interrupt;
|
mod interrupt;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod log;
|
mod log;
|
||||||
@ -23,12 +22,7 @@ use arch::x86_64::serial::SerialPort;
|
|||||||
use boot::{BASE_REVISION, params, *};
|
use boot::{BASE_REVISION, params, *};
|
||||||
use constants::*;
|
use constants::*;
|
||||||
use log::*;
|
use log::*;
|
||||||
use memory::alloc::{
|
use memory::alloc::{boxed::Box, format, string::String, vec};
|
||||||
boxed::Box,
|
|
||||||
format,
|
|
||||||
string::{String, ToString},
|
|
||||||
vec,
|
|
||||||
};
|
|
||||||
use params::*;
|
use params::*;
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
@ -100,7 +94,6 @@ unsafe extern "C" fn main() -> ! {
|
|||||||
.lock()
|
.lock()
|
||||||
.log_writeln("\tWelcome to the Gila microkernel!\n");
|
.log_writeln("\tWelcome to the Gila microkernel!\n");
|
||||||
log_info!("Booting gila version {}", kernel_version_string());
|
log_info!("Booting gila version {}", kernel_version_string());
|
||||||
log_info!("Enabled features: {}", FEATURE_FLAGS.to_string());
|
|
||||||
|
|
||||||
match boot::FIRMWARE_TYPE_REQUEST.get_response() {
|
match boot::FIRMWARE_TYPE_REQUEST.get_response() {
|
||||||
Some(resp) => log_info!(
|
Some(resp) => log_info!(
|
||||||
@ -118,8 +111,6 @@ unsafe extern "C" fn main() -> ! {
|
|||||||
|
|
||||||
log_info!("Trans rights!");
|
log_info!("Trans rights!");
|
||||||
|
|
||||||
device::init_statics();
|
|
||||||
|
|
||||||
if let Some(framebuffer_response) = FRAMEBUFFER_REQUEST.get_response() {
|
if let Some(framebuffer_response) = FRAMEBUFFER_REQUEST.get_response() {
|
||||||
let fb = framebuffer_response.framebuffers().next().unwrap();
|
let fb = framebuffer_response.framebuffers().next().unwrap();
|
||||||
log_info!("Framebuffer response received");
|
log_info!("Framebuffer response received");
|
||||||
@ -210,7 +210,6 @@ fn init_statics() {
|
|||||||
let _ = HHDM_RESPONSE;
|
let _ = HHDM_RESPONSE;
|
||||||
let _ = MODULE_RESPONSE;
|
let _ = MODULE_RESPONSE;
|
||||||
let _ = MEMMAP_RESPONSE;
|
let _ = MEMMAP_RESPONSE;
|
||||||
crate::device::init_statics();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[used]
|
#[used]
|
||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
use core::panic::*;
|
use core::panic::*;
|
||||||
|
|
||||||
use crate::{LOGGER, LogLevel};
|
|
||||||
use crate::format;
|
use crate::format;
|
||||||
|
use crate::{LOGGER, LogLevel};
|
||||||
|
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
pub fn panic(info: &PanicInfo) -> ! {
|
pub fn panic(info: &PanicInfo) -> ! {
|
||||||
12
libgila/Cargo.toml
Normal file
12
libgila/Cargo.toml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[package]
|
||||||
|
name = "libgila"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
num-derive = { version = "0.4.2", default-features = false }
|
||||||
|
num-traits = { version = "0.2.19", default-features = false }
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
# Stop appending lib to artifact names!!! it's already a library!!!
|
||||||
|
name = "gila"
|
||||||
@ -1,26 +0,0 @@
|
|||||||
// Copyright (c) 2025 shibedrill
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
// TODO: Implement per-arch memory handlers for ACPI memory map regions
|
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
|
||||||
use limine::{request::RsdpRequest, response::RsdpResponse};
|
|
||||||
|
|
||||||
use crate::{format, log::*, log_info, log_warning};
|
|
||||||
|
|
||||||
#[used]
|
|
||||||
#[unsafe(link_section = ".requests")]
|
|
||||||
pub static RSDP_REQUEST: RsdpRequest = limine::request::RsdpRequest::new();
|
|
||||||
|
|
||||||
lazy_static! {
|
|
||||||
pub static ref RSDP: Option<&'static RsdpResponse> = match RSDP_REQUEST.get_response() {
|
|
||||||
Some(resp) => {
|
|
||||||
log_info!("Device: Got RSDP pointer");
|
|
||||||
Some(resp)
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
log_warning!("Device: Did not get RSDP pointer, ACPI unavailable");
|
|
||||||
None
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
use fdt::*;
|
|
||||||
use lazy_static::lazy_static;
|
|
||||||
use limine::{request::DeviceTreeBlobRequest, response::DeviceTreeBlobResponse};
|
|
||||||
|
|
||||||
use crate::{format, log::*, log_info, log_trace, log_warning};
|
|
||||||
|
|
||||||
#[used]
|
|
||||||
#[unsafe(link_section = ".requests")]
|
|
||||||
pub static DTB_REQUEST: DeviceTreeBlobRequest = limine::request::DeviceTreeBlobRequest::new();
|
|
||||||
|
|
||||||
lazy_static! {
|
|
||||||
pub static ref DTB: Option<&'static DeviceTreeBlobResponse> = match DTB_REQUEST.get_response() {
|
|
||||||
Some(resp) => {
|
|
||||||
log_info!("Device: Got DTB pointer");
|
|
||||||
Some(resp)
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
log_warning!("Device: Did not get DTB pointer");
|
|
||||||
None
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub fn device_tree_parsed() -> Option<Fdt<'static>> {
|
|
||||||
if let Some(ok_dtb) = *DTB
|
|
||||||
&& let Ok(ok_parsed_dt) = unsafe { fdt::Fdt::from_ptr(ok_dtb.dtb_ptr() as *const u8) }
|
|
||||||
{
|
|
||||||
log_trace!("Device: Parsed device tree");
|
|
||||||
Some(ok_parsed_dt)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
// Copyright (c) 2025 shibedrill
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
#[cfg(feature = "acpi")]
|
|
||||||
mod acpi;
|
|
||||||
#[cfg(feature = "dtb")]
|
|
||||||
mod devtree;
|
|
||||||
|
|
||||||
use crate::log::{LOGGER, LogLevel};
|
|
||||||
use crate::{format, log_error};
|
|
||||||
|
|
||||||
// Just to check
|
|
||||||
pub fn init_statics() {
|
|
||||||
let dtb = {
|
|
||||||
#[cfg(feature = "dtb")]
|
|
||||||
{
|
|
||||||
devtree::DTB.is_some()
|
|
||||||
}
|
|
||||||
#[cfg(not(feature = "dtb"))]
|
|
||||||
false
|
|
||||||
};
|
|
||||||
let rdsp = {
|
|
||||||
#[cfg(feature = "acpi")]
|
|
||||||
{
|
|
||||||
acpi::RSDP.is_some()
|
|
||||||
}
|
|
||||||
#[cfg(not(feature = "acpi"))]
|
|
||||||
false
|
|
||||||
};
|
|
||||||
if !dtb & !rdsp {
|
|
||||||
log_error!("Device: Neither DTB nor ACPI available, booted system will be useless")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user