Merge pull request #3 from birth-software/rename

Rename project to Birth
This commit is contained in:
David 2023-07-10 17:48:48 -06:00 committed by GitHub
commit 820e60a506
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 121 additions and 138 deletions

View File

@ -1,6 +1,6 @@
# Rise: an attempt to write a better operating system
# Birth: an attempt to write a better operating system
![Build status](https://img.shields.io/github/actions/workflow/status/davidgm94/rise/lightning.yml?branch=main)
![Build status](https://img.shields.io/github/actions/workflow/status/birth-software/birth/lightning.yml?branch=main)
An experiment of an operating system for modern 64-bit architectures which focuses on building robust, fast and usable system software and learning how to do it along the way.

17
bochsrc
View File

@ -1,17 +0,0 @@
cpu: count=2, reset_on_triple_fault=0
display_library: x, options="gui_debug"
megs: 512
clock: sync=realtime, time0=local
ata0-master: type=disk, path="zig-cache/rise_Debug_x86_64_rise_bios_normal_exe.hdd", mode=flat
boot: c
log: ./bochsout.txt
mouse: enabled=0
magic_break: enabled=1

View File

@ -23,7 +23,7 @@ const ExecutionEnvironment = common.ExecutionEnvironment;
const FilesystemType = common.FilesystemType;
const OptimizeMode = common.OptimizeMode;
const QEMUOptions = common.QEMUOptions;
const RiseProgram = common.RiseProgram;
const BirthProgram = common.BirthProgram;
const Suffix = common.Suffix;
const Target = common.Target;
@ -76,9 +76,9 @@ pub fn build(b_arg: *Build) !void {
try mods.setDependencies(.uefi, &.{ .lib, .privileged });
try mods.setDependencies(.limine_installer, &.{ .lib, .privileged });
try mods.setDependencies(.privileged, &.{ .lib, .bootloader });
try mods.setDependencies(.cpu, &.{ .privileged, .lib, .bootloader, .rise });
try mods.setDependencies(.rise, &.{.lib});
try mods.setDependencies(.user, &.{ .lib, .rise });
try mods.setDependencies(.cpu, &.{ .privileged, .lib, .bootloader, .birth });
try mods.setDependencies(.birth, &.{.lib});
try mods.setDependencies(.user, &.{ .lib, .birth });
break :blk mods;
};
@ -283,7 +283,7 @@ pub fn build(b_arg: *Build) !void {
.root_project_path = cpu_driver_path,
.target = target,
.optimize_mode = optimize_mode,
.modules = &.{ .lib, .bootloader, .privileged, .cpu, .rise },
.modules = &.{ .lib, .bootloader, .privileged, .cpu, .birth },
});
cpu_driver.force_pic = true;
@ -318,7 +318,7 @@ pub fn build(b_arg: *Build) !void {
.root_project_path = try std.mem.concat(b.allocator, u8, &.{ user_program_dir_path, "/", module.name }),
.target = user_target,
.optimize_mode = optimize_mode,
.modules = &.{ .lib, .user, .rise },
.modules = &.{ .lib, .user, .birth },
});
user_module.strip = false;
@ -331,16 +331,16 @@ pub fn build(b_arg: *Build) !void {
for (bootloaders) |bootloader_struct| {
const bootloader = bootloader_struct.id;
for (bootloader_struct.protocols) |boot_protocol| {
const rise_loader_path = "src/bootloader/rise/";
const birth_loader_path = "src/bootloader/birth/";
const limine_loader_path = "src/bootloader/limine/";
const bootloader_name = "loader";
const bootloader_modules = [_]ModuleID{ .lib, .bootloader, .privileged };
const bootloader_compile_step = switch (bootloader) {
.rise => switch (boot_protocol) {
.birth => switch (boot_protocol) {
.bios => switch (architecture) {
.x86_64 => blk: {
const bootloader_path = rise_loader_path ++ "bios";
const bootloader_path = birth_loader_path ++ "bios";
const executable = try addCompileStep(.{
.kind = executable_kind,
.name = bootloader_name,
@ -362,7 +362,7 @@ pub fn build(b_arg: *Build) !void {
else => return Error.architecture_not_supported,
},
.uefi => blk: {
const bootloader_path = rise_loader_path ++ "uefi";
const bootloader_path = birth_loader_path ++ "uefi";
const executable = try addCompileStep(.{
.kind = executable_kind,
.name = bootloader_name,
@ -420,7 +420,7 @@ pub fn build(b_arg: *Build) !void {
}
const execution_environments: []const ExecutionEnvironment = switch (bootloader) {
.rise, .limine => switch (boot_protocol) {
.birth, .limine => switch (boot_protocol) {
.bios => switch (architecture) {
.x86_64 => &.{.qemu},
else => return Error.architecture_not_supported,
@ -534,12 +534,12 @@ pub fn build(b_arg: *Build) !void {
}
const Options = struct {
arr: std.EnumArray(RiseProgram, *OptionsStep) = std.EnumArray(RiseProgram, *OptionsStep).initUndefined(),
arr: std.EnumArray(BirthProgram, *OptionsStep) = std.EnumArray(BirthProgram, *OptionsStep).initUndefined(),
pub fn createOption(options_struct: *Options, rise_program: RiseProgram) void {
pub fn createOption(options_struct: *Options, birth_program: BirthProgram) void {
const new_options = b.addOptions();
new_options.addOption(RiseProgram, "program_type", rise_program);
options_struct.arr.set(rise_program, new_options);
new_options.addOption(BirthProgram, "program_type", birth_program);
options_struct.arr.set(birth_program, new_options);
}
};
@ -681,14 +681,14 @@ const ModuleID = enum {
uefi,
limine,
limine_installer,
/// This module contains code that is used by Rise privileged programs
/// This module contains code that is used by birth privileged programs
privileged,
/// This module contains code that is unique to Rise CPU drivers
/// This module contains code that is unique to birth CPU drivers
cpu,
/// This module contains code that is used by userspace programs
user,
/// This module contains code that is interacting between userspace and cpu in Rise
rise,
/// This module contains code that is interacting between userspace and cpu in birth
birth,
};
pub const Modules = struct {

View File

@ -1,6 +1,6 @@
{
"architecture": "x86_64",
"bootloader": "rise",
"bootloader": "birth",
"boot_protocol": "uefi",
"execution_environment": "qemu",
"optimize_mode": "Debug",

View File

@ -1,7 +1,6 @@
{
"sector_count": 131072,
"sector_size": 512,
"image_name": "rise",
"partition_table": "gpt",
"partition": {
"name": "ESP",

View File

@ -1,8 +1,8 @@
const lib = @import("lib");
pub const arch = @import("rise/arch.zig");
pub const capabilities = @import("rise/capabilities.zig");
pub const syscall = @import("rise/syscall.zig");
pub const arch = @import("birth/arch.zig");
pub const capabilities = @import("birth/capabilities.zig");
pub const syscall = @import("birth/syscall.zig");
/// This struct is the shared part that the user and the cpu see
pub const UserScheduler = extern struct {

View File

@ -1,15 +1,15 @@
const lib = @import("lib");
const assert = lib.assert;
const rise = @import("rise");
const birth = @import("birth");
pub const UserScheduler = extern struct {
generic: rise.UserScheduler,
generic: birth.UserScheduler,
disabled_save_area: RegisterArena,
};
pub const RegisterArena = extern struct {
fpu: FPU align(lib.arch.stack_alignment),
registers: rise.arch.Registers,
registers: birth.arch.Registers,
pub fn contextSwitch(register_arena: *align(lib.arch.stack_alignment) const RegisterArena) noreturn {
assert(lib.isAligned(@intFromPtr(register_arena), lib.arch.stack_alignment));
@ -88,8 +88,8 @@ pub const Registers = extern struct {
)
:
: [registers] "{rdi}" (registers),
[ss] "i" (rise.arch.user_data_selector),
[cs] "i" (rise.arch.user_code_selector),
[ss] "i" (birth.arch.user_data_selector),
[cs] "i" (birth.arch.user_code_selector),
: "memory"
);
@ -129,9 +129,9 @@ pub const FPU = extern struct {
pub const user_code_selector = 0x43;
pub const user_data_selector = 0x3b;
pub inline fn syscall(options: rise.syscall.Options, arguments: rise.syscall.Arguments) rise.syscall.Result {
var first: rise.syscall.Result.Rise.First = undefined;
var second: rise.syscall.Result.Rise.Second = undefined;
pub inline fn syscall(options: birth.syscall.Options, arguments: birth.syscall.Arguments) birth.syscall.Result {
var first: birth.syscall.Result.Birth.First = undefined;
var second: birth.syscall.Result.Birth.Second = undefined;
asm volatile (
\\syscall
: [rax] "={rax}" (first),
@ -147,7 +147,7 @@ pub inline fn syscall(options: rise.syscall.Options, arguments: rise.syscall.Arg
);
return .{
.rise = .{
.birth = .{
.first = first,
.second = second,
},

View File

@ -2,8 +2,8 @@ const lib = @import("lib");
const assert = lib.assert;
const PhysicalAddress = lib.PhysicalAddress;
const rise = @import("rise");
const syscall = rise.syscall;
const birth = @import("birth");
const syscall = birth.syscall;
const Capabilities = @This();
@ -127,13 +127,13 @@ pub fn Syscall(comptime capability_type: Type, comptime command_type: Command(ca
pub const Result = usize;
pub const Arguments = []const u8;
inline fn toResult(raw_result: syscall.Result.Rise) Result {
inline fn toResult(raw_result: syscall.Result.Birth) Result {
return raw_result.second;
}
inline fn resultToRaw(result: Result) syscall.Result {
return syscall.Result{
.rise = .{
.birth = .{
.first = .{},
.second = result,
},
@ -165,13 +165,13 @@ pub fn Syscall(comptime capability_type: Type, comptime command_type: Command(ca
pub const Result = u32;
pub const Arguments = void;
inline fn toResult(raw_result: syscall.Result.Rise) Result {
inline fn toResult(raw_result: syscall.Result.birth) Result {
return @as(Result, @intCast(raw_result.second));
}
inline fn resultToRaw(result: Result) syscall.Result {
return syscall.Result{
.rise = .{
.birth = .{
.first = .{},
.second = result,
},
@ -188,12 +188,12 @@ pub fn Syscall(comptime capability_type: Type, comptime command_type: Command(ca
.get_command_buffer => struct {
pub const ErrorSet = Capabilities.ErrorSet(&.{});
pub const Result = noreturn;
pub const Arguments = *rise.CommandBuffer;
pub const Arguments = *birth.CommandBuffer;
pub const toResult = @compileError("noreturn unexpectedly returned");
inline fn toArguments(raw_arguments: syscall.Arguments) !Arguments {
const ptr = @as(?*rise.CommandBuffer, @ptrFromInt(raw_arguments[0])) orelse return error.invalid_input;
const ptr = @as(?*birth.CommandBuffer, @ptrFromInt(raw_arguments[0])) orelse return error.invalid_input;
return ptr;
}
@ -215,13 +215,13 @@ pub fn Syscall(comptime capability_type: Type, comptime command_type: Command(ca
pub const Result = PhysicalAddress;
pub const Arguments = usize;
inline fn toResult(raw_result: syscall.Result.Rise) Result {
inline fn toResult(raw_result: syscall.Result.birth) Result {
return PhysicalAddress.new(raw_result.second);
}
inline fn resultToRaw(result: Result) syscall.Result {
return syscall.Result{
.rise = .{
.birth = .{
.first = .{},
.second = result.value(),
},
@ -248,14 +248,14 @@ pub fn Syscall(comptime capability_type: Type, comptime command_type: Command(ca
inline fn resultToRaw(result: Result) syscall.Result {
return syscall.Result{
.rise = .{
.birth = .{
.first = .{},
.second = result,
},
};
}
inline fn toResult(raw_result: syscall.Result.Rise) Result {
inline fn toResult(raw_result: syscall.Result.birth) Result {
return raw_result.second;
}
},
@ -325,7 +325,7 @@ pub fn Syscall(comptime capability_type: Type, comptime command_type: Command(ca
}
break :blk syscall.Result{
.rise = .{
.birth = .{
.first = .{},
.second = 0,
},
@ -338,7 +338,7 @@ pub fn Syscall(comptime capability_type: Type, comptime command_type: Command(ca
inline else => |comptime_error| @field(@This().ErrorSet.Enum, @errorName(comptime_error)),
};
return syscall.Result{
.rise = .{
.birth = .{
.first = .{
.@"error" = @intFromEnum(error_enum),
},
@ -351,16 +351,16 @@ pub fn Syscall(comptime capability_type: Type, comptime command_type: Command(ca
pub fn blocking(arguments: Arguments) @This().ErrorSet.Error!Result {
const raw_arguments = if (Arguments != void) Types.argumentsToRaw(arguments) else [1]usize{0} ** raw_argument_count;
// TODO: make this more reliable and robust?
const options = rise.syscall.Options{
.rise = .{
const options = birth.syscall.Options{
.birth = .{
.type = capability,
.command = @intFromEnum(command),
},
};
const raw_result = rise.arch.syscall(options, raw_arguments);
const raw_result = birth.arch.syscall(options, raw_arguments);
const raw_error_value = raw_result.rise.first.@"error";
const raw_error_value = raw_result.birth.first.@"error";
comptime {
assert(!@hasField(@This().ErrorSet.Enum, "ok"));
assert(!@hasField(@This().ErrorSet.Enum, "success"));
@ -370,7 +370,7 @@ pub fn Syscall(comptime capability_type: Type, comptime command_type: Command(ca
return switch (raw_error_value) {
success => switch (Result) {
noreturn => unreachable,
else => toResult(raw_result.rise),
else => toResult(raw_result.birth),
},
else => switch (@as(@This().ErrorSet.Enum, @enumFromInt(raw_error_value))) {
inline else => |comptime_error_enum| @field(@This().ErrorSet.Error, @tagName(comptime_error_enum)),

View File

@ -2,20 +2,20 @@ const lib = @import("lib");
const assert = lib.assert;
const log = lib.log.scoped(.Syscall);
const rise = @import("rise");
const capabilities = rise.capabilities;
const birth = @import("birth");
const capabilities = birth.capabilities;
pub const argument_count = 6;
pub const Arguments = [argument_count]usize;
pub const Convention = enum(u1) {
linux = 0,
rise = 1,
birth = 1,
};
pub const Options = extern union {
general: General,
rise: Rise,
birth: Birth,
linux: Linux,
pub const General = packed struct(u64) {
@ -35,17 +35,17 @@ pub const Options = extern union {
pub fn NumberIntegerType(comptime convention: Convention) type {
return switch (convention) {
.rise => Rise.IDInteger,
.birth => birth.IDInteger,
.linux => u64,
};
}
};
pub const Rise = packed struct(u64) {
pub const Birth = packed struct(u64) {
type: capabilities.Type,
command: capabilities.Subtype,
reserved: lib.IntType(.unsigned, @bitSizeOf(u64) - @bitSizeOf(capabilities.Type) - @bitSizeOf(capabilities.Subtype) - @bitSizeOf(Convention)) = 0,
convention: Convention = .rise,
convention: Convention = .birth,
comptime {
Options.assertSize(@This());
@ -79,7 +79,7 @@ pub const Options = extern union {
pub const Result = extern union {
general: General,
rise: Rise,
birth: Birth,
linux: Linux,
pub const General = extern struct {
@ -90,7 +90,7 @@ pub const Result = extern union {
second: u64,
};
pub const Rise = extern struct {
pub const Birth = extern struct {
first: First,
second: Second,
@ -99,7 +99,7 @@ pub const Result = extern union {
@"error": u16 = 0,
padding2: u8 = 0,
padding3: u7 = 0,
convention: Convention = .rise,
convention: Convention = .birth,
};
pub const Second = u64;

View File

@ -283,7 +283,7 @@ pub const Information = extern struct {
@memset(page_counters, 0);
// Make sure pages are allocated to host the bootloader information and fetch memory entries from firmware (only non-UEFI)
if (bootloader_tag != .rise or protocol != .uefi) {
if (bootloader_tag != .birth or protocol != .uefi) {
page_counters[total_allocation.index] = bootloader_information.getAlignedTotalSize() >> lib.arch.page_shifter(lib.arch.valid_page_sizes[0]);
const new_memory_map_entry_count = try bootloader_information.initializeMemoryMap(initialization);
@ -307,7 +307,7 @@ pub const Information = extern struct {
const compressed_bundle = try initialization.filesystem.readFile("/bundle", compressed_bundle_buffer);
assert(compressed_bundle.len > 0);
if (bootloader_tag == .rise and protocol == .uefi) {
if (bootloader_tag == .birth and protocol == .uefi) {
// Check if the memory map entry count matches here is not useful because probably it's going to be less as exiting boot services seems
// like making some deallocations
const new_memory_map_entry_count = @as(u32, @intCast(try bootloader_information.initializeMemoryMap(initialization)));

View File

@ -269,7 +269,7 @@ export fn _start() callconv(.C) noreturn {
bios.A20Enable() catch @panic("A20 is not enabled");
initialization.initialize() catch |err| @panic(@errorName(err));
bootloader.Information.initialize(&initialization, .rise, .bios) catch |err| {
bootloader.Information.initialize(&initialization, .birth, .bios) catch |err| {
@panic(@errorName(err));
};
}

View File

@ -419,7 +419,7 @@ pub fn main() noreturn {
initialization.initialize() catch |err| {
@panic(@errorName(err));
};
bootloader.Information.initialize(&initialization, .rise, .uefi) catch |err| {
bootloader.Information.initialize(&initialization, .birth, .uefi) catch |err| {
@panic(@errorName(err));
};
}

View File

@ -2,7 +2,7 @@
TIMEOUT=0
# The entry name that will be displayed in the boot menu
:Rise
:Birth
# Change the protocol line depending on the used protocol.
PROTOCOL=limine

View File

@ -1,7 +1,7 @@
// TODO: legacy stuff; refactor when SMP is implemented
// pub fn initializeSMP(bootloader_information: *Information, madt: *const ACPI.MADT) void {
// if (bootloader_information.bootloader != .rise) @panic("Protocol not supported");
// if (bootloader_information.bootloader != .birth) @panic("Protocol not supported");
//
// const smp_records = bootloader_information.getSlice(.smps);
//

View File

@ -180,7 +180,7 @@ pub const DiskType = enum(u32) {
};
pub const FilesystemType = enum(u32) {
rise = 0,
birth = 0,
ext2 = 1,
fat32 = 2,
@ -221,7 +221,7 @@ pub const architecture_bootloader_map = blk: {
array[architectureIndex(.x86_64)] = &.{
.{
.id = .rise,
.id = .birth,
.protocols = &.{ .bios, .uefi },
},
.{
@ -232,7 +232,7 @@ pub const architecture_bootloader_map = blk: {
// array[architectureIndex(.aarch64)] = &.{
// .{
// .id = .rise,
// .id = .birth,
// .protocols = &.{.uefi},
// },
// .{
@ -243,7 +243,7 @@ pub const architecture_bootloader_map = blk: {
// array[architectureIndex(.riscv64)] = &.{
// .{
// .id = .rise,
// .id = .birth,
// .protocols = &.{.uefi},
// },
// };
@ -252,7 +252,7 @@ pub const architecture_bootloader_map = blk: {
};
pub const Bootloader = enum(u32) {
rise,
birth,
limine,
pub const Protocol = enum(u32) {
@ -276,7 +276,6 @@ pub const ExecutionEnvironment = enum {
};
pub const ImageConfig = struct {
image_name: []const u8,
sector_count: u64,
sector_size: u16,
partition_table: PartitionTableType,
@ -398,7 +397,7 @@ pub const UserProgram = struct {
};
};
pub const RiseProgram = enum {
pub const BirthProgram = enum {
bootloader,
cpu,
user,

View File

@ -16,7 +16,7 @@ const stopCPU = privileged.arch.stopCPU;
const VirtualAddress = privileged.VirtualAddress;
const VirtualMemoryRegion = privileged.VirtualMemoryRegion;
const rise = @import("rise");
const birth = @import("birth");
pub const test_runner = @import("cpu/test_runner.zig");
pub const arch = @import("cpu/arch.zig");
@ -67,10 +67,10 @@ pub const Driver = extern struct {
/// This data structure holds the information needed to run a program in a core (cpu side)
pub const UserScheduler = extern struct {
capability_root_node: capabilities.Root,
common: *rise.UserScheduler,
common: *birth.UserScheduler,
padding: [padding_byte_count]u8 = .{0} ** padding_byte_count,
const total_size = @sizeOf(capabilities.Root) + @sizeOf(*rise.UserScheduler);
const total_size = @sizeOf(capabilities.Root) + @sizeOf(*birth.UserScheduler);
const aligned_size = lib.alignForward(usize, total_size, lib.arch.valid_page_sizes[0]);
const padding_byte_count = aligned_size - total_size;

View File

@ -2,7 +2,7 @@ const bootloader = @import("bootloader");
const cpu = @import("cpu");
const lib = @import("lib");
const privileged = @import("privileged");
const rise = @import("rise");
const birth = @import("birth");
const Allocator = lib.Allocator;
const assert = lib.assert;
@ -415,8 +415,8 @@ export var idt = x86_64.IDT{};
export var user_stack: u64 = 0;
comptime {
assert(rise.arch.user_code_selector == x86_64.user_code_selector);
assert(rise.arch.user_data_selector == x86_64.user_data_selector);
assert(birth.arch.user_code_selector == x86_64.user_code_selector);
assert(birth.arch.user_data_selector == x86_64.user_data_selector);
}
pub fn InterruptHandler(comptime interrupt_number: u64, comptime has_error_code: bool) fn () callconv(.Naked) noreturn {
@ -934,7 +934,7 @@ fn spawnInitBSP(init_file: []const u8, cpu_page_tables: paging.CPUPageTables) !n
scheduler_common_arch.disabled_save_area.registers.rsi = @intFromBool(is_init);
scheduler_common_arch.disabled_save_area.registers.rip = entry_point; // Set entry point
scheduler_common_arch.disabled_save_area.registers.rsp = user_scheduler_virtual_address.offset(@offsetOf(rise.UserScheduler, "setup_stack")).value() + scheduler_common_arch.generic.setup_stack.len;
scheduler_common_arch.disabled_save_area.registers.rsp = user_scheduler_virtual_address.offset(@offsetOf(birth.UserScheduler, "setup_stack")).value() + scheduler_common_arch.generic.setup_stack.len;
scheduler_common.setup_stack_lock.value = true;
scheduler_common_arch.disabled_save_area.registers.rflags = .{ .IF = true }; // Set RFLAGS
@ -1452,7 +1452,7 @@ fn spawnInitCommon(cpu_page_tables: paging.CPUPageTables) !SpawnInitCommonResult
});
init_cpu_scheduler.* = cpu.UserScheduler{
.common = user_scheduler_virtual_address.access(*rise.UserScheduler),
.common = user_scheduler_virtual_address.access(*birth.UserScheduler),
.capability_root_node = cpu.capabilities.Root{
.static = .{
.cpu = true,
@ -1478,7 +1478,7 @@ fn spawnInitCommon(cpu_page_tables: paging.CPUPageTables) !SpawnInitCommonResult
},
};
const higher_half_scheduler_common = scheduler_memory_physical_region.address.toHigherHalfVirtualAddress().access(*rise.UserScheduler);
const higher_half_scheduler_common = scheduler_memory_physical_region.address.toHigherHalfVirtualAddress().access(*birth.UserScheduler);
// log.debug("Higher half: 0x{x}", .{@ptrToInt(higher_half_scheduler_common)});
higher_half_scheduler_common.disabled = true;
higher_half_scheduler_common.core_id = cpu.core_id;

View File

@ -2,7 +2,7 @@ const cpu = @import("cpu");
const lib = @import("lib");
const log = lib.log;
const privileged = @import("privileged");
const rise = @import("rise");
const birth = @import("birth");
const assert = lib.assert;
@ -24,11 +24,11 @@ const pcid_mask = 1 << pcid_bit;
/// - R10: argument 3
/// - R8: argument 4
/// - R9: argument 5
fn riseSyscall(comptime Syscall: type, raw_arguments: rise.syscall.Arguments) Syscall.ErrorSet.Error!Syscall.Result {
fn birthSyscall(comptime Syscall: type, raw_arguments: birth.syscall.Arguments) Syscall.ErrorSet.Error!Syscall.Result {
cpu.syscall_count += 1;
comptime assert(Syscall == rise.capabilities.Syscall(Syscall.capability, Syscall.command));
const capability: rise.capabilities.Type = Syscall.capability;
const command: rise.capabilities.Command(capability) = Syscall.command;
comptime assert(Syscall == birth.capabilities.Syscall(Syscall.capability, Syscall.command));
const capability: birth.capabilities.Type = Syscall.capability;
const command: birth.capabilities.Command(capability) = Syscall.command;
const arguments = try Syscall.toArguments(raw_arguments);
return if (cpu.user_scheduler.capability_root_node.hasPermissions(capability, command)) switch (capability) {
@ -78,16 +78,16 @@ fn riseSyscall(comptime Syscall: type, raw_arguments: rise.syscall.Arguments) Sy
} else error.forbidden;
}
export fn syscall(registers: *const Registers) callconv(.C) rise.syscall.Result {
const options = @as(rise.syscall.Options, @bitCast(registers.syscall_number));
const arguments = rise.syscall.Arguments{ registers.rdi, registers.rsi, registers.rdx, registers.r10, registers.r8, registers.r9 };
export fn syscall(registers: *const Registers) callconv(.C) birth.syscall.Result {
const options = @as(birth.syscall.Options, @bitCast(registers.syscall_number));
const arguments = birth.syscall.Arguments{ registers.rdi, registers.rsi, registers.rdx, registers.r10, registers.r8, registers.r9 };
return switch (options.general.convention) {
.rise => switch (options.rise.type) {
inline else => |capability| switch (@as(rise.capabilities.Command(capability), @enumFromInt(options.rise.command))) {
.birth => switch (options.birth.type) {
inline else => |capability| switch (@as(birth.capabilities.Command(capability), @enumFromInt(options.birth.command))) {
inline else => |command| blk: {
const Syscall = rise.capabilities.Syscall(capability, command);
const result: Syscall.Result = riseSyscall(Syscall, arguments) catch |err| break :blk Syscall.errorToRaw(err);
const Syscall = birth.capabilities.Syscall(capability, command);
const result: Syscall.Result = birthSyscall(Syscall, arguments) catch |err| break :blk Syscall.errorToRaw(err);
break :blk Syscall.resultToRaw(result);
},
},

View File

@ -26,7 +26,7 @@ const init = @import("./x86/64/init.zig");
pub const syscall = @import("./x86/64/syscall.zig");
pub const entryPoint = init.entryPoint;
const rise = @import("rise");
const birth = @import("birth");
var writer_lock: Spinlock = .released;

View File

@ -7,7 +7,7 @@ const log = lib.log.scoped(.capabilities);
const privileged = @import("privileged");
const PhysicalAddress = lib.PhysicalAddress;
const PhysicalMemoryRegion = lib.PhysicalMemoryRegion;
const rise = @import("rise");
const birth = @import("birth");
const cpu = @import("cpu");
pub const RootDescriptor = extern struct {
@ -149,7 +149,7 @@ pub const Scheduler = extern struct {
};
comptime {
assert(enumCount(Dynamic) + enumCount(Static) == enumCount(rise.capabilities.Type));
assert(enumCount(Dynamic) + enumCount(Static) == enumCount(birth.capabilities.Type));
}
pub const Root = extern struct {
@ -174,7 +174,7 @@ pub const Root = extern struct {
other.dynamic = root.dynamic;
}
pub inline fn hasPermissions(root: *const Root, comptime capability_type: rise.capabilities.Type, command: rise.capabilities.Command(capability_type)) bool {
pub inline fn hasPermissions(root: *const Root, comptime capability_type: birth.capabilities.Type, command: birth.capabilities.Command(capability_type)) bool {
return switch (capability_type) {
// static capabilities
inline .cpu,

View File

@ -210,7 +210,7 @@ pub fn main() anyerror!void {
.buffer = host.ArrayList(u8).init(wrapped_allocator.zigUnwrap()),
};
try limine_cfg_generator.addField("TIMEOUT", "0");
try limine_cfg_generator.addEntryName("Rise");
try limine_cfg_generator.addEntryName("Birth");
try limine_cfg_generator.addField("PROTOCOL", "limine");
try limine_cfg_generator.addField("DEFAULT_ENTRY", "0");
try limine_cfg_generator.addField("KERNEL_PATH", try lib.concat(wrapped_allocator.zigUnwrap(), u8, &.{ "boot:///", loader_fat_path }));
@ -233,7 +233,7 @@ pub fn main() anyerror!void {
else => unreachable,
}
},
.rise => switch (configuration.boot_protocol) {
.birth => switch (configuration.boot_protocol) {
.bios => {
const partition_first_usable_lba = gpt_partition_cache.gpt.header.first_usable_lba;
assert((fat_partition_cache.partition_range.first_lba - partition_first_usable_lba) * disk.sector_size > lib.alignForward(usize, loader_file.len, disk.sector_size));

View File

@ -402,7 +402,7 @@ const limine_unique_partition_guid = GUID{
const FilesystemCacheTypes = blk: {
var types: [Filesystem.Type.count]type = undefined;
types[@intFromEnum(Filesystem.Type.rise)] = void;
types[@intFromEnum(Filesystem.Type.birth)] = void;
types[@intFromEnum(Filesystem.Type.ext2)] = void;
types[@intFromEnum(Filesystem.Type.fat32)] = FAT32.Cache;

View File

@ -3,9 +3,9 @@ const log = lib.log;
const assert = lib.assert;
const ExecutionMode = lib.Syscall.ExecutionMode;
const rise = @import("rise");
const capabilities = rise.capabilities;
pub const Syscall = rise.capabilities.Syscall;
const birth = @import("birth");
const capabilities = birth.capabilities;
pub const Syscall = birth.capabilities.Syscall;
pub const arch = @import("user/arch.zig");
const core_state = @import("user/core_state.zig");
@ -75,7 +75,7 @@ fn schedulerInitDisabled(scheduler: *arch.Scheduler) void {
}
pub var is_init = false;
pub var command_buffer: rise.CommandBuffer = undefined;
pub var command_buffer: birth.CommandBuffer = undefined;
pub export fn start(scheduler: *arch.Scheduler, arg_init: bool) callconv(.C) noreturn {
assert(arg_init);
@ -89,7 +89,7 @@ pub export fn start(scheduler: *arch.Scheduler, arg_init: bool) callconv(.C) nor
Syscall(.cpu, .shutdown).blocking({}) catch unreachable;
}
// export fn riseInitializeDisabled(scheduler: *arch.Scheduler, arg_init: bool) callconv(.C) noreturn {
// export fn birthInitializeDisabled(scheduler: *arch.Scheduler, arg_init: bool) callconv(.C) noreturn {
// // TODO: delete when this code is unnecessary. In the meanwhile it counts as a sanity check
// assert(arg_init);
// is_init = arg_init;

View File

@ -1,12 +1,12 @@
const lib = @import("lib");
const log = lib.log;
const assert = lib.assert;
const rise = @import("rise");
const birth = @import("birth");
const user = @import("user");
const FPU = rise.arch.FPU;
const Registers = rise.arch.Registers;
const RegisterArena = rise.arch.RegisterArena;
const FPU = birth.arch.FPU;
const Registers = birth.arch.Registers;
const RegisterArena = birth.arch.RegisterArena;
const VirtualAddress = lib.VirtualAddress;
@ -17,7 +17,7 @@ const Thread = user.Thread;
const VirtualAddressSpace = user.VirtualAddressSpace;
pub const Scheduler = extern struct {
common: rise.arch.UserScheduler,
common: birth.arch.UserScheduler,
generic: user.Scheduler,
pub fn initDisabled(scheduler: *Scheduler) void {
@ -50,7 +50,7 @@ pub fn _start() callconv(.Naked) noreturn {
unreachable;
}
pub inline fn setInitialState(register_arena: *RegisterArena, entry: VirtualAddress, stack_virtual_address: VirtualAddress, arguments: rise.syscall.Arguments) void {
pub inline fn setInitialState(register_arena: *RegisterArena, entry: VirtualAddress, stack_virtual_address: VirtualAddress, arguments: birth.syscall.Arguments) void {
assert(stack_virtual_address.value() > lib.arch.valid_page_sizes[0]);
assert(lib.isAligned(stack_virtual_address.value(), lib.arch.stack_alignment));
var stack_address = stack_virtual_address;

View File

@ -1,18 +1,20 @@
const lib = @import("lib");
const assert = lib.assert;
const rise = @import("rise");
const birth = @import("birth");
// TODO: ref
pub fn frameCreate(ref: usize, bytes: usize) !usize {
return mappableCapabilityCreate(ref, .cpu_memory, bytes);
}
fn mappableCapabilityCreate(ref: usize, mappable_capability: rise.capabilities.Type.Mappable, bytes: usize) !usize {
fn mappableCapabilityCreate(ref: usize, mappable_capability: birth.capabilities.Type.Mappable, bytes: usize) !usize {
_ = mappable_capability;
_ = ref;
assert(bytes > 0);
}
fn ramDescendantCreate(ref: usize, ) !usize {
fn ramDescendantCreate(
ref: usize,
) !usize {
_ = ref;
}

View File

@ -1,7 +1,7 @@
const lib = @import("lib");
const log = lib.log.scoped(.thread);
const user = @import("user");
const rise = @import("rise");
const birth = @import("birth");
const MoreCore = user.MoreCore;
const MMUAwareVirtualAddressSpace = user.MMUAwareVirtualAddressSpace;
@ -17,7 +17,7 @@ pub const Thread = extern struct {
next: ?*Thread,
stack: [*]u8,
stack_top: [*]align(lib.arch.stack_alignment) u8,
register_arena: rise.arch.RegisterArena align(lib.arch.stack_alignment),
register_arena: birth.arch.RegisterArena align(lib.arch.stack_alignment),
core_id: u32,
pub fn init(thread: *Thread, scheduler: *user.arch.Scheduler) void {