mirror of
https://github.com/rdmsr/zag.git
synced 2026-10-31 15:28:21 +00:00
build: switch to zonfig
This commit is contained in:
+1
-1
@@ -69,7 +69,7 @@ pub fn ExportedCpuLocal(comptime T: type, comptime init: T, comptime name: []con
|
||||
/// Bitmask of CPUs.
|
||||
pub const CpuMask = struct {
|
||||
const bits_per_word = @bitSizeOf(usize);
|
||||
const num_words = (config.CONFIG_NCPUS + bits_per_word - 1) / bits_per_word;
|
||||
const num_words = (config.ncpus + bits_per_word - 1) / bits_per_word;
|
||||
|
||||
bits: [num_words]usize,
|
||||
|
||||
|
||||
+2
-2
@@ -110,13 +110,13 @@ fn dispatch_queue(cpu: u32) void {
|
||||
}
|
||||
|
||||
if (sched_cpu.start_timer) {
|
||||
ke.timer.set(&sched_cpu.resched_timer, std.time.ns_per_ms * config.CONFIG_SCHED_TIMESLICE, &sched_cpu.resched_dpc);
|
||||
ke.timer.set(&sched_cpu.resched_timer, std.time.ns_per_ms * config.sched_timeslice, &sched_cpu.resched_dpc);
|
||||
}
|
||||
|
||||
if (sched_cpu.preemption_reason == .HigherPriority) {
|
||||
// Reload the quantum for the new thread.
|
||||
ke.timer.cancel(&sched_cpu.resched_timer);
|
||||
ke.timer.set(&sched_cpu.resched_timer, std.time.ns_per_ms * config.CONFIG_SCHED_TIMESLICE, &sched_cpu.resched_dpc);
|
||||
ke.timer.set(&sched_cpu.resched_timer, std.time.ns_per_ms * config.sched_timeslice, &sched_cpu.resched_dpc);
|
||||
}
|
||||
|
||||
sched_cpu.start_timer = false;
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ const DebugWriter = struct {
|
||||
// Messages are on average 2^5 = 32 bytes.
|
||||
const avg_msg_size_bits = 5;
|
||||
|
||||
pub var ringbuffer = ki.log_ring.RingBuffer(config.CONFIG_LOG_BUFFER_SHIFT, avg_msg_size_bits).init();
|
||||
pub var ringbuffer = ki.log_ring.RingBuffer(config.log_buffer_shift, avg_msg_size_bits).init();
|
||||
|
||||
pub fn log(
|
||||
comptime level: std.log.Level,
|
||||
|
||||
@@ -3,12 +3,11 @@ const config = @import("config");
|
||||
|
||||
const init_mod = @import("init.zig");
|
||||
|
||||
pub const impl = if (@hasDecl(config, "CONFIG_ARCH_AMD64"))
|
||||
@import("amd64/impl.zig")
|
||||
else if (@hasDecl(config, "CONFIG_ARCH_UM"))
|
||||
@import("um/impl.zig")
|
||||
else
|
||||
@compileError("unsupported architecture");
|
||||
pub const impl = switch (config.arch) {
|
||||
.amd64 => @import("amd64/impl.zig"),
|
||||
.um => @import("um/impl.zig"),
|
||||
else => @compileError("unsupported architecture"),
|
||||
};
|
||||
|
||||
pub const init = init_mod.init;
|
||||
|
||||
|
||||
+3
-3
@@ -96,7 +96,7 @@ const runqueues_n = 64;
|
||||
const interactivity_threshold = 30;
|
||||
const scaling_factor = 50;
|
||||
const preempt_threshold = ke.Thread.Priority.realtime;
|
||||
const balance_interval = @as(u64, config.CONFIG_BALANCE_INTERVAL);
|
||||
const balance_interval = @as(u64, config.sched_balance_interval);
|
||||
const steal_threshold = 1;
|
||||
|
||||
var balance_timer: ke.Timer = undefined;
|
||||
@@ -211,7 +211,7 @@ pub fn clock(_: ?*anyopaque) void {
|
||||
|
||||
if (curtd.priority_class == .Batch) {
|
||||
// Update interactivity metrics.
|
||||
curtd.run_time += config.CONFIG_SCHED_TIMESLICE;
|
||||
curtd.run_time += config.sched_timeslice;
|
||||
|
||||
clamp_time(curtd);
|
||||
recompute_priority(curtd);
|
||||
@@ -261,7 +261,7 @@ pub fn unblock(td: *ke.Thread) void {
|
||||
|
||||
td.sleep_time = (ke.time.read_time() - td.sleep_start) / std.time.ns_per_ms;
|
||||
|
||||
if (td.sleep_time >= config.CONFIG_SCHED_TIMESLICE and td.priority_class == .Batch) {
|
||||
if (td.sleep_time >= config.sched_timeslice and td.priority_class == .Batch) {
|
||||
// If we have slept for more than a tick, update interactivity.
|
||||
clamp_time(td);
|
||||
recompute_priority(td);
|
||||
|
||||
+5
-6
@@ -8,11 +8,10 @@ pub const heap = @import("heap.zig");
|
||||
pub const zone = @import("zone.zig");
|
||||
pub const PMap = pmap.PMap;
|
||||
|
||||
pub const impl = if (@hasDecl(config, "CONFIG_ARCH_AMD64"))
|
||||
@import("amd64/impl.zig")
|
||||
else if (@hasDecl(config, "CONFIG_ARCH_UM"))
|
||||
@import("um/impl.zig")
|
||||
else
|
||||
@compileError("unsupported architecture");
|
||||
pub const impl = switch (config.arch) {
|
||||
.amd64 => @import("amd64/impl.zig"),
|
||||
.um => @import("um/impl.zig"),
|
||||
else => @compileError("unsupported architecture"),
|
||||
};
|
||||
|
||||
pub var kernel_pmap: PMap = undefined;
|
||||
|
||||
@@ -17,7 +17,7 @@ extern var AP_TRAMPOLINE_DATA: u8;
|
||||
extern var __percpu_start: u8;
|
||||
extern var __percpu_end: u8;
|
||||
|
||||
pub export var cpu_id_to_apic_id: [config.CONFIG_NCPUS]u32 = undefined;
|
||||
pub export var cpu_id_to_apic_id: [config.ncpus]u32 = undefined;
|
||||
|
||||
const start_stack = ke.ExportedCpuLocal(usize, 0, "ap_start_stack");
|
||||
|
||||
|
||||
@@ -3,12 +3,11 @@
|
||||
|
||||
const config = @import("config");
|
||||
|
||||
pub const impl = if (@hasDecl(config, "CONFIG_ARCH_AMD64"))
|
||||
@import("pc/impl.zig")
|
||||
else if (@hasDecl(config, "CONFIG_ARCH_UM"))
|
||||
@import("um/impl.zig")
|
||||
else
|
||||
@compileError("unsupported architecture");
|
||||
pub const impl = switch (config.arch) {
|
||||
.amd64 => @import("pc/impl.zig"),
|
||||
.um => @import("um/impl.zig"),
|
||||
else => @compileError("unsupported architecture"),
|
||||
};
|
||||
|
||||
pub const acpi = @import("acpi/root.zig");
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#define _GNU_SOURCE 1
|
||||
#include <SDL.h>
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
#include <signal.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/time.h>
|
||||
#include <ucontext.h>
|
||||
#include <unistd.h>
|
||||
@@ -3,12 +3,7 @@ const r = @import("root");
|
||||
pub const std_options = r.std_options;
|
||||
pub const panic = r.panic;
|
||||
|
||||
const c = @cImport({
|
||||
@cInclude("SDL.h");
|
||||
@cInclude("signal.h");
|
||||
@cInclude("pthread.h");
|
||||
});
|
||||
|
||||
const c = @import("c");
|
||||
const std = @import("std");
|
||||
const ke = r.ke;
|
||||
const pl = r.pl;
|
||||
|
||||
@@ -10,16 +10,7 @@ pub const entry = @import("entry.zig");
|
||||
|
||||
const timer = @import("timer.zig");
|
||||
|
||||
pub const c = @cImport({
|
||||
@cDefine("_GNU_SOURCE", "1");
|
||||
@cInclude("pthread.h");
|
||||
@cInclude("sys/mman.h");
|
||||
@cInclude("ucontext.h");
|
||||
@cInclude("signal.h");
|
||||
@cInclude("unistd.h");
|
||||
@cInclude("sys/time.h");
|
||||
@cInclude("sched.h");
|
||||
});
|
||||
pub const c = @import("c");
|
||||
|
||||
pub const name = "User-Mode";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user