summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-05-26 23:42:50 -0400
committerIan Moffett <ian@osmora.org>2024-05-26 23:44:35 -0400
commitc3e50e6a2101afeadca9568481b6ed4395ae560b (patch)
tree96cd08853bdde8a77a6d89511502f2a72ec4ea61
parenta59842033c0a29f774f895278597c8fc8141f7ac (diff)
kernel: Fixup logging to work with syslog changes
This commit removes the KINFO(), KERR(), ... macros Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/arch/amd64/amd64/cpu_mp.c8
-rw-r--r--sys/arch/amd64/amd64/hpet.c13
-rw-r--r--sys/arch/amd64/amd64/ioapic.c3
-rw-r--r--sys/arch/amd64/amd64/lapic.c15
-rw-r--r--sys/arch/amd64/amd64/machdep.c4
-rw-r--r--sys/arch/amd64/amd64/trap.c32
-rw-r--r--sys/dev/ic/nvme.c25
-rw-r--r--sys/dev/pci/pci.c4
-rw-r--r--sys/dev/usb/xhci.c21
-rw-r--r--sys/firmware/acpi/acpi_init.c12
-rw-r--r--sys/firmware/acpi/acpi_madt.c5
-rw-r--r--sys/include/lib/logo.h6
-rw-r--r--sys/include/sys/syslog.h16
-rw-r--r--sys/kern/init_main.c6
-rw-r--r--sys/kern/kern_exec.c2
-rw-r--r--sys/kern/kern_panic.c2
16 files changed, 93 insertions, 81 deletions
diff --git a/sys/arch/amd64/amd64/cpu_mp.c b/sys/arch/amd64/amd64/cpu_mp.c
index cbc6afd..b9de227 100644
--- a/sys/arch/amd64/amd64/cpu_mp.c
+++ b/sys/arch/amd64/amd64/cpu_mp.c
@@ -42,6 +42,8 @@ __MODULE_NAME("cpu_mp");
__KERNEL_META("$Hyra$: cpu_mp.c, Ian Marco Moffett, "
"SMP related code");
+#define pr_trace(fmt, ...) kprintf("cpu_mp: " fmt, ##__VA_ARGS__)
+
static volatile struct limine_smp_request g_smp_req = {
.id = LIMINE_SMP_REQUEST,
.revision = 0
@@ -124,14 +126,14 @@ ap_bootstrap(struct cpu_info *ci)
tmr_irqstat_add(ci);
if (resp->cpu_count == 1) {
- KINFO("CPU has 1 core, no APs to bootstrap...\n");
+ pr_trace("CPU has 1 core, no APs to bootstrap...\n");
return;
}
- KINFO("Bootstrapping %d cores...\n", cpu_init_counter);
+ pr_trace("Bootstrapping %d cores...\n", cpu_init_counter);
for (size_t i = 0; i < resp->cpu_count; ++i) {
if (ci->id == cpus[i]->lapic_id) {
- KINFO("Skip %d (BSP)... continue\n", ci->id);
+ pr_trace("Skip %d (BSP)... continue\n", ci->id);
continue;
}
diff --git a/sys/arch/amd64/amd64/hpet.c b/sys/arch/amd64/amd64/hpet.c
index f63b47e..69dc0dd 100644
--- a/sys/arch/amd64/amd64/hpet.c
+++ b/sys/arch/amd64/amd64/hpet.c
@@ -41,6 +41,9 @@ __MODULE_NAME("hpet");
__KERNEL_META("$Hyra$: hpet.c, Ian Marco Moffett, "
"HPET driver");
+#define pr_trace(fmt, ...) kprintf("hpet: " fmt, ##__VA_ARGS__)
+#define pr_error(...) pr_trace(__VA_ARGS__)
+
#define HPET_REG_CAPS 0x00
#define HPET_GENERAL_CONFIG 0x10
#define HPET_REG_MAIN_COUNTER 0xF0
@@ -168,7 +171,7 @@ hpet_init(void)
/* Ensure caps aren't bogus */
if (CAP_REV_ID(caps) == 0) {
- KERR("Found bogus revision, assuming faulty\n");
+ pr_error("Found bogus revision, assuming faulty\n");
is_faulty = true;
return 1;
}
@@ -178,14 +181,14 @@ hpet_init(void)
* must be <= 0x05F5E100. So we'll consider it
* as bogus if it exceeds this value
*/
- KERR("Found bogus COUNTER_CLK_PERIOD, assuming faulty\n");
- KINFO("HPET REV - 0x%x\n", CAP_REV_ID(caps));
- KINFO("COUNTER_CLK_PERIOD - 0x%x\n", CAP_CLK_PERIOD(caps));
+ pr_error("Found bogus COUNTER_CLK_PERIOD, assuming faulty\n");
+ pr_trace("HPET REV - 0x%x\n", CAP_REV_ID(caps));
+ pr_trace("COUNTER_CLK_PERIOD - 0x%x\n", CAP_CLK_PERIOD(caps));
is_faulty = true;
return 1;
}
- KINFO("HPET integrity verified\n");
+ pr_trace("HPET integrity verified\n");
hpet_write(HPET_REG_MAIN_COUNTER, 0);
hpet_write(HPET_GENERAL_CONFIG, 1);
diff --git a/sys/arch/amd64/amd64/ioapic.c b/sys/arch/amd64/amd64/ioapic.c
index ffc732d..5dfdfa8 100644
--- a/sys/arch/amd64/amd64/ioapic.c
+++ b/sys/arch/amd64/amd64/ioapic.c
@@ -39,6 +39,7 @@ __MODULE_NAME("ioapic");
__KERNEL_META("$Hyra$: ioapic.c, Ian Marco Moffett, "
"I/O APIC driver");
+#define pr_trace(fmt, ...) kprintf("ioapic: " fmt, ##__VA_ARGS__)
#define IOAPIC_BASE_OFF(off) ((void *)((uintptr_t)ioapic_base + off))
static void *ioapic_base = NULL;
@@ -191,7 +192,7 @@ ioapic_init(void)
tmp = ioapic_readl(IOAPICVER);
redir_entry_cnt = __SHIFTOUT(tmp, 0xFF << 16) + 1;
- KINFO("Masking %d GSIs...\n", redir_entry_cnt);
+ pr_trace("Masking %d GSIs...\n", redir_entry_cnt);
for (uint8_t i = 0; i < redir_entry_cnt; ++i) {
ioapic_gsi_mask(i);
diff --git a/sys/arch/amd64/amd64/lapic.c b/sys/arch/amd64/amd64/lapic.c
index 2f9c0b7..81432dd 100644
--- a/sys/arch/amd64/amd64/lapic.c
+++ b/sys/arch/amd64/amd64/lapic.c
@@ -47,15 +47,18 @@ __MODULE_NAME("lapic");
__KERNEL_META("$Hyra$: lapic.c, Ian Marco Moffett, "
"Local APIC driver");
+#define pr_trace(fmt, ...) kprintf("lapic: " fmt, ##__VA_ARGS__)
+#define pr_error(...) pr_trace(__VA_ARGS__)
+
/*
- * Only calls KINFO if we are the BSP.
+ * Only calls pr_trace if we are the BSP.
*/
-#define BSP_KINFO(...) do { \
+#define BSP_TRACE(...) do { \
uint64_t msr_val; \
\
msr_val = rdmsr(IA32_APIC_BASE_MSR); \
if (__TEST(msr_val, 1 << 8)) { \
- KINFO(__VA_ARGS__); \
+ pr_trace(__VA_ARGS__); \
} \
} while (0);
@@ -397,7 +400,7 @@ lapic_init(void)
/* Software enable the Local APIC via SVR */
lapic_reg_set(LAPIC_SVR, LAPIC_SW_ENABLE);
- BSP_KINFO("Enabled Local APIC for BSP\n");
+ BSP_TRACE("Enabled Local APIC for BSP\n");
lapic_set_ldr(ci);
/* Setup the timer descriptor */
@@ -411,7 +414,7 @@ lapic_init(void)
/* Set the Local APIC ID */
ci->id = lapic_get_id(ci);
- BSP_KINFO("BSP Local APIC ID: %d\n", ci->id);
+ BSP_TRACE("BSP Local APIC ID: %d\n", ci->id);
/* Setup LAPIC Timer TSS stack */
if (tss_alloc_stack(&tmr_stack, vm_get_page_size()) != 0) {
@@ -427,6 +430,6 @@ lapic_init(void)
idt_set_desc(SYSVEC_LAPIC_TIMER, IDT_INT_GATE_FLAGS,
(uintptr_t)lapic_tmr_isr, IST_SCHED);
- BSP_KINFO("LAPIC Timer on Interrupt Stack %d (IST_SCHED) with vector 0x%x\n",
+ BSP_TRACE("LAPIC Timer on Interrupt Stack %d (IST_SCHED) with vector 0x%x\n",
IST_SCHED, SYSVEC_LAPIC_TIMER);
}
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 34bea11..0c2718a 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -145,7 +145,7 @@ backtrace(void)
off_t off;
const char *name;
- kprintf("** Backtrace **\n");
+ kprintf(OMIT_TIMESTAMP "** Backtrace **\n");
__ASMV("mov %%rbp, %0" : "=r" (rbp) :: "memory");
while (1) {
@@ -158,7 +158,7 @@ backtrace(void)
if (name == NULL)
name = "???";
- kprintf("[0x%p] <%s+0x%x>\n", rip, name, off);
+ kprintf(OMIT_TIMESTAMP "[0x%p] <%s+0x%x>\n", rip, name, off);
}
}
diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c
index 539ee48..531f2f5 100644
--- a/sys/arch/amd64/amd64/trap.c
+++ b/sys/arch/amd64/amd64/trap.c
@@ -44,6 +44,8 @@ __MODULE_NAME("trap");
__KERNEL_META("$Hyra$: trap.c, Ian Marco Moffett, "
"Trap handling");
+#define pr_error(fmt, ...) kprintf("trap: " fmt, ##__VA_ARGS__)
+
static const char *trap_type[] = {
[TRAP_BREAKPOINT] = "breakpoint",
[TRAP_ARITH_ERR] = "arithmetic error",
@@ -92,14 +94,15 @@ dbg_errcode(struct trapframe *tf)
switch (tf->trapno) {
case TRAP_PAGEFLT:
- kprintf("bits (pwui): %c%c%c%c\n",
+ kprintf(OMIT_TIMESTAMP
+ "bits (pwui): %c%c%c%c\n",
__TEST(ec, __BIT(0)) ? 'p' : '-',
__TEST(ec, __BIT(1)) ? 'w' : '-',
__TEST(ec, __BIT(2)) ? 'u' : '-',
__TEST(ec, __BIT(4)) ? 'i' : '-');
break;
case TRAP_SS:
- kprintf("ss: 0x%x\n", ec);
+ kprintf(OMIT_TIMESTAMP "ss: 0x%x\n", ec);
break;
}
}
@@ -108,9 +111,9 @@ static void
trap_print(struct trapframe *tf)
{
if (tf->trapno < TRAP_COUNT) {
- kprintf("** Fatal %s **\n", trap_type[tf->trapno]);
+ kprintf(OMIT_TIMESTAMP "** Fatal %s **\n", trap_type[tf->trapno]);
} else {
- kprintf("** Unknown trap %d **\n", tf->trapno);
+ kprintf(OMIT_TIMESTAMP "** Unknown trap %d **\n", tf->trapno);
}
dbg_errcode(tf);
@@ -127,7 +130,8 @@ regdump(struct trapframe *tf)
: "memory"
);
- kprintf("RAX=%p RCX=%p RDX=%p\n"
+ kprintf(OMIT_TIMESTAMP
+ "RAX=%p RCX=%p RDX=%p\n"
"RBX=%p RSI=%p RDI=%p\n"
"RFL=%p CR2=%p CR3=%p\n"
"RBP=%p RSP=%p RIP=%p\n",
@@ -186,9 +190,9 @@ handle_user_pf(struct proc *curtd, struct trapframe *tf,
s = vm_fault(fault_addr, access_type);
if (s != 0) {
- KERR("Got page fault @ 0x%p\n", fault_addr);
- KERR("Fault access mask: 0x%x\n", access_type);
- KERR("Raising SIGSEGV to PID %d...\n", curtd->pid);
+ pr_error("Got page fault @ 0x%p\n", fault_addr);
+ pr_error("Fault access mask: 0x%x\n", access_type);
+ pr_error("Raising SIGSEGV to PID %d...\n", curtd->pid);
regdump(tf);
raise_fatal(curtd, sched_tmr, SIGSEGV);
}
@@ -232,8 +236,8 @@ trap_handler(struct trapframe *tf)
*/
if (tf->trapno == TRAP_NMI) {
trap_print(tf);
- kprintf("Possible hardware failure?\n");
- panic("Caught NMI; bailing out\n");
+ kprintf(OMIT_TIMESTAMP "Possible hardware failure?\n");
+ panic(OMIT_TIMESTAMP "Caught NMI; bailing out\n");
}
if (curtd == NULL) {
@@ -244,16 +248,16 @@ trap_handler(struct trapframe *tf)
switch (tf->trapno) {
case TRAP_ARITH_ERR:
- KERR("Got arithmetic error - raising SIGFPE...\n");
- KERR("SIGFPE -> PID %d\n", curtd->pid);
+ pr_error("Got arithmetic error - raising SIGFPE...\n");
+ pr_error("SIGFPE -> PID %d\n", curtd->pid);
raise_fatal(curtd, &sched_tmr, SIGFPE);
break;
case TRAP_PAGEFLT:
handle_user_pf(curtd, tf, &sched_tmr);
break;
default:
- KERR("Got %s - raising SIGSEGV...\n", trap_type[tf->trapno]);
- KERR("SIGSEGV -> PID %d\n", curtd->pid);
+ pr_error("Got %s - raising SIGSEGV...\n", trap_type[tf->trapno]);
+ pr_error("SIGSEGV -> PID %d\n", curtd->pid);
regdump(tf);
raise_fatal(curtd, &sched_tmr, SIGSEGV);
break;
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c
index 729abe8..df533a3 100644
--- a/sys/dev/ic/nvme.c
+++ b/sys/dev/ic/nvme.c
@@ -43,6 +43,9 @@ __MODULE_NAME("nvme");
__KERNEL_META("$Hyra$: nvme.c, Ian Marco Moffett, "
"NVMe driver");
+#define pr_trace(fmt, ...) kprintf("nvme: " fmt, ##__VA_ARGS__)
+#define pr_error(...) pr_trace(__VA_ARGS__)
+
static struct pci_device *nvme_dev;
static struct timer driver_tmr;
static TAILQ_HEAD(,nvme_ns) namespaces;
@@ -168,12 +171,12 @@ nvme_poll_submit_cmd(struct nvme_queue *queue, struct nvme_cmd cmd)
break;
}
if ((status & ~1) != 0) {
- KDEBUG("NVMe cmd error (bits=0x%x)\n", status >> 1);
+ pr_trace("NVMe cmd error (bits=0x%x)\n", status >> 1);
break;
}
if (spins > 5) {
/* Attempts exhausted */
- KERR("Hang on phase bit poll, giving up (cmd error)\n");
+ pr_error("Hang on phase bit poll, giving up (cmd error)\n");
break;
}
@@ -422,7 +425,7 @@ nvme_init_ns(struct nvme_state *state, uint16_t nsid)
snprintf(devname, sizeof(devname), "nvme0n%d", nsid);
if (devfs_add_dev(devname, dev) != 0) {
- KERR("Failed to create /dev/%s\n", devname);
+ pr_error("Failed to create /dev/%s\n", devname);
}
TAILQ_INSERT_TAIL(&namespaces, ns, link);
@@ -443,7 +446,7 @@ nvme_disable_controller(struct nvme_state *state)
}
if (nvme_poll_ready(bar, 0) < 0) {
- KERR("Failed to disable controller\n");
+ pr_error("Failed to disable controller\n");
return -1;
}
@@ -467,8 +470,8 @@ nvme_log_ctrl_id(struct nvme_id *id)
fr[i] = id->fr[i];
}
- KDEBUG("NVMe model: %s\n", mn);
- KDEBUG("NVMe firmware revision: %s\n", fr);
+ pr_trace("NVMe model: %s\n", mn);
+ pr_trace("NVMe firmware revision: %s\n", fr);
}
/*
@@ -508,7 +511,7 @@ nvme_enable_controller(struct nvme_state *state)
}
if (nvme_poll_ready(bar, 1) < 0) {
- KERR("Failed to enable controller\n");
+ pr_error("Failed to enable controller\n");
return -1;
}
@@ -539,7 +542,7 @@ nvme_enable_controller(struct nvme_state *state)
/* Init NVMe namespaces */
for (size_t i = 0; i < id->nn; ++i) {
if (nsids[i] != 0) {
- KINFO("Found NVMe namespace (id=%d)\n", nsids[i]);
+ pr_trace("Found NVMe namespace (id=%d)\n", nsids[i]);
nvme_init_ns(state, nsids[i]);
}
}
@@ -583,12 +586,12 @@ nvme_init(void)
};
if (req_timer(TIMER_GP, &driver_tmr) != 0) {
- KERR("Failed to fetch general purpose timer\n");
+ pr_error("Failed to fetch general purpose timer\n");
return -1;
}
if (driver_tmr.msleep == NULL) {
- KERR("Timer does not have msleep()\n");
+ pr_error("Timer does not have msleep()\n");
return -1;
}
@@ -598,7 +601,7 @@ nvme_init(void)
}
bar = PCI_BAR_MEMBASE(nvme_dev->bar[0]);
- KINFO("NVMe BAR0 @ 0x%p\n", bar);
+ pr_trace("NVMe BAR0 @ 0x%p\n", bar);
TAILQ_INIT(&namespaces);
if (nvme_init_controller(bar) < 0) {
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 4985dd8..006b428 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -43,6 +43,8 @@ __MODULE_NAME("pci");
__KERNEL_META("$Hyra$: pci.c, Ian Marco Moffett, "
"PCI driver core");
+#define pr_trace(fmt, ...) kprintf("pci: " fmt, ##__VA_ARGS__)
+
static TAILQ_HEAD(, pci_device) device_list;
static int access_method = PCI_ACCESS_CAM;
@@ -276,7 +278,7 @@ pci_init(void)
{
TAILQ_INIT(&device_list);
- KINFO("Scanning each bus...\n");
+ pr_trace("Scanning each bus...\n");
for (uint16_t i = 0; i < 256; ++i) {
pci_scan_bus(i);
diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c
index 61e9b8b..f221843 100644
--- a/sys/dev/usb/xhci.c
+++ b/sys/dev/usb/xhci.c
@@ -43,6 +43,9 @@ __MODULE_NAME("xhci");
__KERNEL_META("$Hyra$: xhci.c, Ian Marco Moffett, "
"xHCI driver");
+#define pr_trace(fmt, ...) kprintf("xhci: " fmt, ##__VA_ARGS__)
+#define pr_error(...) pr_trace(__VA_ARGS__)
+
static struct pci_device *hci_dev;
static struct timer driver_tmr;
@@ -188,12 +191,12 @@ xhci_init_scratchpads(struct xhci_hc *hc)
return 0;
}
- KINFO("Need %d scratchpad buffers\n", max_bufs);
+ pr_trace("Need %d scratchpad buffers\n", max_bufs);
/* Allocate buffer array */
buffer_array = dynalloc_memalign(sizeof(uintptr_t)*max_bufs, 0x1000);
if (buffer_array == NULL) {
- KERR("Failed to allocate scratchpad buffer array\n");
+ pr_error("Failed to allocate scratchpad buffer array\n");
return -1;
}
@@ -205,7 +208,7 @@ xhci_init_scratchpads(struct xhci_hc *hc)
if (tmp == 0) {
/* TODO: Shutdown, free memory */
- KERR("Failed to fill scratchpad buffer array\n");
+ pr_error("Failed to fill scratchpad buffer array\n");
return -1;
}
@@ -229,7 +232,7 @@ xhci_init_ports(struct xhci_hc *hc)
for (size_t i = 1; i < maxports; ++i) {
portsc = xhci_get_portsc(hc, i);
if (__TEST(*portsc, XHCI_PORTSC_CCS)) {
- KINFO("Device connected on port %d, resetting...\n", i);
+ pr_trace("Device connected on port %d, resetting...\n", i);
*portsc |= XHCI_PORTSC_PR;
}
}
@@ -287,7 +290,7 @@ xhci_reset_hc(struct xhci_hc *hc)
struct xhci_opregs *opregs = hc->opregs;
size_t time_waiting = 0; /* In ms */
- KINFO("Resetting host controller...\n");
+ pr_trace("Resetting host controller...\n");
/*
* Set USBCMD.HCRST to reset the controller and
@@ -300,7 +303,7 @@ xhci_reset_hc(struct xhci_hc *hc)
break;
}
if (time_waiting >= XHCI_TIMEOUT) {
- KERR("Hang while polling USBCMD.HCRST to be zero\n");
+ pr_error("Hang while polling USBCMD.HCRST to be zero\n");
return -1;
}
driver_tmr.msleep(50);
@@ -443,14 +446,14 @@ xhci_init(void)
bar1 = hci_dev->bar[1] & ~7;
base = __COMBINE32(bar1, bar0);
hc.base = PHYS_TO_VIRT(base);
- KINFO("xHCI HC base @ 0x%p\n", base);
+ pr_trace("xHCI HC base @ 0x%p\n", base);
if (req_timer(TIMER_GP, &driver_tmr) != 0) {
- KERR("Failed to fetch general purpose timer\n");
+ pr_error("Failed to fetch general purpose timer\n");
return -1;
}
if (driver_tmr.msleep == NULL) {
- KERR("Timer does not have msleep()\n");
+ pr_error("Timer does not have msleep()\n");
return -1;
}
diff --git a/sys/firmware/acpi/acpi_init.c b/sys/firmware/acpi/acpi_init.c
index c23506b..a98e429 100644
--- a/sys/firmware/acpi/acpi_init.c
+++ b/sys/firmware/acpi/acpi_init.c
@@ -39,6 +39,8 @@ __MODULE_NAME("acpi");
__KERNEL_META("$Hyra$: acpi_init.c, Ian Marco Moffett, "
"ACPI init logic");
+#define pr_trace(fmt, ...) kprintf("acpi: " fmt, ##__VA_ARGS__)
+
static volatile struct limine_rsdp_request rsdp_req = {
.id = LIMINE_RSDP_REQUEST,
.revision = 0
@@ -58,13 +60,13 @@ static void
acpi_print_oemid(const char *type, char oemid[OEMID_SIZE])
{
if (type != NULL) {
- KINFO("%s OEMID: ", type);
+ pr_trace("%s OEMID: ", type);
}
for (size_t i = 0; i < OEMID_SIZE; ++i) {
- kprintf("%c", oemid[i]);
+ kprintf(OMIT_TIMESTAMP "%c", oemid[i]);
}
- kprintf("\n");
+ kprintf(OMIT_TIMESTAMP "\n");
}
struct acpi_root_sdt *
@@ -97,10 +99,10 @@ acpi_init(void)
if (rsdp->revision >= 2) {
using_xsdt = true;
root_sdt = PHYS_TO_VIRT(rsdp->xsdt_addr);
- KINFO("Using XSDT as root SDT\n");
+ pr_trace("Using XSDT as root SDT\n");
} else {
root_sdt = PHYS_TO_VIRT(rsdp->rsdt_addr);
- KINFO("Using RSDT as root SDT\n");
+ pr_trace("Using RSDT as root SDT\n");
}
if (!acpi_is_checksum_valid(&root_sdt->hdr)) {
panic("Root SDT has an invalid checksum!\n");
diff --git a/sys/firmware/acpi/acpi_madt.c b/sys/firmware/acpi/acpi_madt.c
index 055ebd2..0e2b338 100644
--- a/sys/firmware/acpi/acpi_madt.c
+++ b/sys/firmware/acpi/acpi_madt.c
@@ -40,10 +40,13 @@
#define APIC_TYPE_IO_APIC 1
#define APIC_TYPE_INTERRUPT_OVERRIDE 2
+#define pr_trace(fmt, ...) kprintf("acpi: " fmt, ##__VA_ARGS__)
+
__MODULE_NAME("acpi");
__KERNEL_META("$Hyra$: acpi_madt.c, Ian Marco Moffett, "
"ACPI MADT parsing");
+
static struct acpi_madt *madt = NULL;
void *
@@ -84,7 +87,7 @@ do_parse(struct cpu_info *ci)
ioapic = (struct ioapic *)cur;
- KINFO("Detected I/O APIC (id=%d, gsi_base=%d)\n",
+ pr_trace("Detected I/O APIC (id=%d, gsi_base=%d)\n",
ioapic->ioapic_id, ioapic->gsi_base);
ioapic_mmio_base = (void *)(uintptr_t)ioapic->ioapic_addr;
diff --git a/sys/include/lib/logo.h b/sys/include/lib/logo.h
index d3ba04a..c33d3d2 100644
--- a/sys/include/lib/logo.h
+++ b/sys/include/lib/logo.h
@@ -32,8 +32,8 @@
#define COPYRIGHT "Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team."
-#define PRINT_LOGO() \
- kprintf("%s v%s\n\n", g_logo, HYRA_VERSION); \
- kprintf("\t%s\n\n", COPYRIGHT);
+#define PRINT_LOGO() \
+ kprintf(OMIT_TIMESTAMP "%s v%s\n\n", g_logo, HYRA_VERSION); \
+ kprintf(OMIT_TIMESTAMP "\t%s\n\n", COPYRIGHT);
extern uint8_t g_logo[];
diff --git a/sys/include/sys/syslog.h b/sys/include/sys/syslog.h
index 12febbc..18948ee 100644
--- a/sys/include/sys/syslog.h
+++ b/sys/include/sys/syslog.h
@@ -40,21 +40,7 @@
#if defined(_KERNEL)
-#define KINFO(...) \
- kprintf("%s[info]: ", __THIS_MODULE); \
- kprintf(__VA_ARGS__);
-
-#define KWARN(...) \
- kprintf("%s[WARN]: ", __THIS_MODULE); \
- kprintf(__VA_ARGS__);
-
-#define KDEBUG(...) \
- kprintf("%s[debug]: ", __THIS_MODULE); \
- kprintf(__VA_ARGS__);
-
-#define KERR(...) \
- kprintf("%s[ERROR]: ", __THIS_MODULE); \
- kprintf(__VA_ARGS__);
+#define OMIT_TIMESTAMP "\x01"
void syslog_init(void);
void syslog_init_proc(void);
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 5f5e8c3..847f4a6 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -48,11 +48,11 @@ static inline void
log_timer(const char *purpose, tmrr_status_t s, const struct timer *tmr)
{
if (s == TMRR_EMPTY_ENTRY) {
- KINFO("%s not yet registered\n", purpose);
+ kprintf("init_main: %s not yet registered\n", purpose);
} else if (tmr->name == NULL) {
- KINFO("Nameless %s registered; unknown\n", purpose);
+ kprintf("init_main: Nameless %s registered; unknown\n", purpose);
} else {
- KINFO("%s registered: %s\n", purpose, tmr->name);
+ kprintf("init_main: %s registered: %s\n", purpose, tmr->name);
}
}
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index c76179a..a1e97be 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -198,7 +198,7 @@ execv(char *pathname, char **argv, uintptr_t *sp_res)
status = loader_load(td->addrsp, bin, &args.auxv, 0, NULL, exec_range);
if (status != 0) {
/* Well shit */
- KERR("Failed to load new process image\n");
+ kprintf("exec: Failed to load new process image\n");
signal_raise(td, SIGSEGV);
for (;;);
}
diff --git a/sys/kern/kern_panic.c b/sys/kern/kern_panic.c
index 8b5fbb1..2adbcb9 100644
--- a/sys/kern/kern_panic.c
+++ b/sys/kern/kern_panic.c
@@ -54,7 +54,7 @@ panic(const char *fmt, ...)
va_start(ap, fmt);
- kprintf("panic: ");
+ kprintf(OMIT_TIMESTAMP "panic: ");
vkprintf(fmt, &ap);
machine_panic();