Skip to content

Commit

Permalink
kern: Remove support for (broken) stacktrace
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsuki committed Feb 21, 2025
1 parent 7df8193 commit f1d64f3
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 151 deletions.
6 changes: 0 additions & 6 deletions kernel/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ CC := cc
# User controllable archiver command.
AR := ar

# User controllable objdump command.
OBJDUMP := objdump

# User controllable V command.
V := v

Expand Down Expand Up @@ -151,9 +148,6 @@ cc-runtime-x86_64/cc-runtime.a: GNUmakefile cc-runtime/*
bin/$(OUTPUT): GNUmakefile linker.ld obj/blob.c.o $(OBJ) cc-runtime-x86_64/cc-runtime.a
mkdir -p "$$(dirname $@)"
$(CC) $(CFLAGS) $(LDFLAGS) obj/blob.c.o $(OBJ) cc-runtime-x86_64/cc-runtime.a -o $@
./gensyms.sh $(OBJDUMP) $@ > obj/symbol_table.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c obj/symbol_table.c -o obj/symbol_table.c.o
$(CC) $(CFLAGS) $(LDFLAGS) obj/blob.c.o $(OBJ) cc-runtime-x86_64/cc-runtime.a -o $@

obj/blob.c.o: GNUmakefile $(VFILES)
mkdir -p "$$(dirname $@)"
Expand Down
54 changes: 0 additions & 54 deletions kernel/gensyms.sh

This file was deleted.

2 changes: 2 additions & 0 deletions kernel/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import socket
import time
import limine

#include <symbols.h>

@[_linker_section: '.requests']
@[cinit]
__global (
Expand Down
10 changes: 1 addition & 9 deletions kernel/modules/klock/klock.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
module klock

import katomic
import trace

pub struct Lock {
pub mut:
Expand All @@ -18,7 +17,7 @@ fn C.__builtin_return_address(int) voidptr
pub fn (mut l Lock) acquire() {
caller := u64(C.__builtin_return_address(0))

for i := u64(0); i < u64(50000000); i++ {
for {
if l.test_and_acquire() == true {
l.caller = caller
return
Expand All @@ -28,13 +27,6 @@ pub fn (mut l Lock) acquire() {
; ; ; memory
}
}

C.printf_panic(c'Lock address: 0x%llx\n', voidptr(l))
mut offset, mut symbol := trace.address(caller) or { return }
C.printf_panic(c'Current caller: 0x%llx <%s+0x%llx>\n', caller, symbol.name, offset)
offset, symbol = trace.address(l.caller) or { return }
C.printf_panic(c'Last caller: 0x%llx <%s+0x%llx>\n', l.caller, symbol.name, offset)
panic('Deadlock detected')
}

pub fn (mut l Lock) release() {
Expand Down
7 changes: 0 additions & 7 deletions kernel/modules/lib/panic.v
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

module lib

import trace
import x86.apic
import x86.cpu.local as cpulocal
import x86.cpu
Expand Down Expand Up @@ -46,12 +45,6 @@ pub fn kpanic(gpr_state &cpulocal.GPRState, message charptr) {
gpr_state.r13, gpr_state.r14, gpr_state.r15)
}

C.printf_panic(c'Stacktrace:\n')
trace.stacktrace(0)
if gpr_state != unsafe { nil } && gpr_state.cs == 0x28 {
trace.stacktrace(gpr_state.rbp)
}

for {
asm volatile amd64 {
hlt
Expand Down
71 changes: 0 additions & 71 deletions kernel/modules/trace/trace.v

This file was deleted.

5 changes: 1 addition & 4 deletions kernel/modules/x86/cpu/local/local.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
module local

import x86.cpu
import trace

@[packed]
pub struct TSS {
Expand Down Expand Up @@ -76,9 +75,7 @@ __global (
pub fn current() &Local {
ints := cpu.interrupt_state()
if ints != false {
print('Attempted to get current CPU struct without disabling ints\n')
trace.stacktrace(0)
panic('')
panic('Attempted to get current CPU struct without disabling ints')
}

mut cpu_number := u64(0)
Expand Down

0 comments on commit f1d64f3

Please # to comment.