mirror of
https://github.com/rdmsr/zag.git
synced 2026-11-02 08:08:21 +00:00
meta: remove extraneous spaces
This commit is contained in:
@@ -58,14 +58,12 @@ pub fn enqueue(dpc: *Dpc, arg: ?*anyopaque) void {
|
|||||||
|
|
||||||
// Insert the DPC on this CPU's DPC queue
|
// Insert the DPC on this CPU's DPC queue
|
||||||
dpc_cpu.lock.acquire_no_ipl();
|
dpc_cpu.lock.acquire_no_ipl();
|
||||||
|
|
||||||
dpc_cpu.queue.insert_tail(&dpc.link);
|
dpc_cpu.queue.insert_tail(&dpc.link);
|
||||||
|
|
||||||
// Mark the DPC as pending on this CPU
|
// Mark the DPC as pending on this CPU
|
||||||
ki.ipl.set_softint_pending(cpu, .Dispatch);
|
ki.ipl.set_softint_pending(cpu, .Dispatch);
|
||||||
|
|
||||||
dpc.inserted = true;
|
dpc.inserted = true;
|
||||||
|
|
||||||
dpc_cpu.lock.release_no_ipl();
|
dpc_cpu.lock.release_no_ipl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +81,6 @@ fn dispatch_queue(cpu: *ke.Cpu) void {
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const ipl = dpc_cpu.lock.acquire_at(.High);
|
const ipl = dpc_cpu.lock.acquire_at(.High);
|
||||||
|
|
||||||
var dpc: *Dpc = undefined;
|
var dpc: *Dpc = undefined;
|
||||||
|
|
||||||
if (dpc_cpu.queue.is_empty()) {
|
if (dpc_cpu.queue.is_empty()) {
|
||||||
@@ -94,7 +91,6 @@ fn dispatch_queue(cpu: *ke.Cpu) void {
|
|||||||
|
|
||||||
// Pop the head
|
// Pop the head
|
||||||
var first_elem = dpc_cpu.queue.first();
|
var first_elem = dpc_cpu.queue.first();
|
||||||
|
|
||||||
first_elem.remove();
|
first_elem.remove();
|
||||||
|
|
||||||
dpc = @fieldParentPtr("link", first_elem);
|
dpc = @fieldParentPtr("link", first_elem);
|
||||||
@@ -105,7 +101,6 @@ fn dispatch_queue(cpu: *ke.Cpu) void {
|
|||||||
const arg = dpc.arg;
|
const arg = dpc.arg;
|
||||||
|
|
||||||
dpc_cpu.lock.release(ipl);
|
dpc_cpu.lock.release(ipl);
|
||||||
|
|
||||||
std.debug.assert(cpu.ipl == .Dispatch);
|
std.debug.assert(cpu.ipl == .Dispatch);
|
||||||
|
|
||||||
dpc.func(arg);
|
dpc.func(arg);
|
||||||
@@ -118,7 +113,6 @@ fn dispatch_queue(cpu: *ke.Cpu) void {
|
|||||||
if (cpu.preemption_reason == .HigherPriority) {
|
if (cpu.preemption_reason == .HigherPriority) {
|
||||||
// Reload the quantum for the new thread.
|
// Reload the quantum for the new thread.
|
||||||
ke.timer.cancel(&cpu.resched_timer);
|
ke.timer.cancel(&cpu.resched_timer);
|
||||||
|
|
||||||
ke.timer.set(&cpu.resched_timer, std.time.ns_per_ms * config.CONFIG_SCHED_TIMESLICE, &cpu.resched_dpc);
|
ke.timer.set(&cpu.resched_timer, std.time.ns_per_ms * config.CONFIG_SCHED_TIMESLICE, &cpu.resched_dpc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,7 @@ pub const SpinLock = struct {
|
|||||||
/// Acquire the lock at IPL `ipl`.
|
/// Acquire the lock at IPL `ipl`.
|
||||||
pub fn acquire_at(self: *SpinLock, ipl: ke.Ipl) ke.Ipl {
|
pub fn acquire_at(self: *SpinLock, ipl: ke.Ipl) ke.Ipl {
|
||||||
const old_ipl = ke.ipl.raise(ipl);
|
const old_ipl = ke.ipl.raise(ipl);
|
||||||
|
|
||||||
self.acquire_no_ipl();
|
self.acquire_no_ipl();
|
||||||
|
|
||||||
return old_ipl;
|
return old_ipl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user