Compare commits

..

3 Commits

2 changed files with 2 additions and 17 deletions

View File

@ -108,8 +108,7 @@ pub fn Arm32(comptime arch: Architecture) type {
}; };
} }
// public so that we can set up fast-boot inline fn regIdx(mode: Mode, kind: Kind) usize {
pub inline fn regIdx(mode: Mode, kind: Kind) usize {
const idx: usize = switch (mode) { const idx: usize = switch (mode) {
.User, .System => 0, .User, .System => 0,
.Supervisor => 1, .Supervisor => 1,

View File

@ -139,7 +139,6 @@ pub const Scheduler = struct {
// VTable // VTable
nowFn: *const fn (ptr: *anyopaque) u64, nowFn: *const fn (ptr: *anyopaque) u64,
resetFn: *const fn (ptr: *anyopaque) void,
pub fn init(obj: anytype) @This() { pub fn init(obj: anytype) @This() {
const P = @TypeOf(obj); const P = @TypeOf(obj);
@ -156,23 +155,14 @@ pub const Scheduler = struct {
const self = @ptrCast(P, @alignCast(alignment, ptr)); const self = @ptrCast(P, @alignCast(alignment, ptr));
return self.now(); return self.now();
} }
fn reset(ptr: *anyopaque) void {
const self = @ptrCast(P, @alignCast(alignment, ptr));
self.reset();
}
}; };
return .{ .ptr = obj, .nowFn = impl.now, .resetFn = impl.reset }; return .{ .ptr = obj, .nowFn = impl.now };
} }
pub fn now(self: @This()) u64 { pub fn now(self: @This()) u64 {
return self.nowFn(self.ptr); return self.nowFn(self.ptr);
} }
pub fn reset(self: @This()) void {
self.resetFn(self.ptr);
}
}; };
// --- // ---
@ -201,10 +191,6 @@ const ExampleScheduler = struct {
pub fn now(self: *const @This()) u64 { pub fn now(self: *const @This()) u64 {
return self.tick; return self.tick;
} }
pub fn reset(self: *@This()) void {
self.tick = 0;
}
}; };
test "create ARMv4T interface" { test "create ARMv4T interface" {