Skip to content

Commit

Permalink
fdsfsd
Browse files Browse the repository at this point in the history
Signed-off-by: TalonFloof <[email protected]>
  • Loading branch information
TalonFloof committed Nov 19, 2024
1 parent 73a32d6 commit 9322f1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ iso: build_pc64
rm -r --force /tmp/kobold_iso

run_pc64: iso
qemu-system-x86_64 -enable-kvm -cpu host,migratable=off -m 8M -serial stdio -device pcie-pci-bridge -cdrom kobold.iso -smp 2 -no-shutdown -no-reboot
qemu-system-x86_64 -enable-kvm -cpu host,migratable=off -m 8M -serial stdio -device pcie-pci-bridge -cdrom kobold.iso -smp 2 -no-hpet -no-shutdown -no-reboot

run_rv64: build_rv64
qemu-system-riscv64 -machine virt -m 128M -serial stdio -device ramfb -device virtio-keyboard-device -device virtio-mouse-device -kernel kobold/zig-out/bin/kernel
Expand Down
10 changes: 5 additions & 5 deletions kobold/hal/x86_64/timer.zig
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ pub fn init() void {
const count = 0xffffffff - apic.read(0x390);
ticksPerSecond = count;
} else {
std.log.info("PIT @ 100 Hz for APIC Timer Calibration", .{});
std.log.info("PIT @ 64 Hz for APIC Timer Calibration", .{});
var speakerControlByte = io.inb(0x61);
speakerControlByte &= ~@as(u8, 2);
io.outb(0x61, speakerControlByte);
io.outb(0x43, 0x80 | 0x00 | 0x30);
const sleepDivisor = 1193180 / (1000000 / 10000); // 10 ms
const sleepDivisor = 0x48d3; // 64 Hz
io.outb(0x42, sleepDivisor & 0xFF);
io.outb(0x42, sleepDivisor >> 8);
const pitControlByte = io.inb(0x61);
Expand All @@ -66,7 +66,7 @@ pub fn init() void {
}
apic.write(0x320, 0x10000);
const count = 0xffffffff - apic.read(0x390);
ticksPerSecond = count * 100;
ticksPerSecond = count * 64;
}
std.log.info("{} APIC Ticks/s", .{ticksPerSecond});
}
Expand All @@ -77,8 +77,8 @@ pub fn init() void {

pub fn setDeadline(microsecs: u64) void {
const t: u64 = @intFromFloat(@as(f64, @floatFromInt(ticksPerSecond)) * (@as(f64, @floatFromInt(microsecs)) / 1000000.0));
if(t > 0xffffffff) {
apic.write(0x380,0xffffffff);
if (t > 0xffffffff) {
apic.write(0x380, 0xffffffff);
} else {
apic.write(0x380, t);
}
Expand Down

0 comments on commit 9322f1d

Please sign in to comment.