Browse Source

debug logging

master
Mathieu Serandour 1 year ago
parent
commit
7ccbe80860
  1. 4
      kernel/debug/logging.h
  2. 3
      kernel/drivers/hpet.c
  3. 6
      kernel/int/apic.c
  4. 3
      kernel/video/terminal.c

4
kernel/debug/logging.h

@ -15,9 +15,9 @@
#ifndef NDEBUG
#define klog_debug(fmt, ...) klogf(LOG_LEVEL_DEBUG, fmt, __VA_ARGS__)
#define klog_debug(...) klogf(LOG_LEVEL_DEBUG, __VA_ARGS__)
#else
#define klog_debug(fmt, ...)
#define klog_debug(...)
#endif
#define klog_info(...) klogf(LOG_LEVEL_INFO, __VA_ARGS__)

3
kernel/drivers/hpet.c

@ -3,6 +3,7 @@
#include "hpet.h"
#include "../memory/vmap.h"
#include "../debug/assert.h"
#include "../debug/logging.h"
/**
000-007h General Capabilities and ID Register Read Only
008-00Fh Reserved
@ -51,6 +52,8 @@ struct HPET_MMIO* const base = (void *)HPET_VIRTUAL_ADDRESS;
static uint32_t hpet_period = 0;
void hpet_init(void) {
klog_debug("init hpet...");
hpet_period = base->capabilities >> 32;
}

6
kernel/int/apic.c

@ -1,8 +1,10 @@
#include <stdint.h>
#include "../debug/assert.h"
#include "idt.h"
#include "apic.h"
#include "../debug/assert.h"
#include "../debug/logging.h"
#include "../klib/sprintf.h"
#include "../memory/vmap.h"
#include "../drivers/hpet.h"
@ -40,7 +42,7 @@ inline uint64_t read(uint32_t m_address) {
}
void apic_setup_clock(void) {
klog_info("setup local apic clock...");
// enable apic msr
uint64_t IA32_APIC_BASE = read_msr(0x1b);

3
kernel/video/terminal.c

@ -4,6 +4,7 @@
#include "../debug/assert.h"
#include "video.h"
#include "../klib/string.h"
#include "../debug/logging.h"
#define TAB_SPACE 6
@ -57,6 +58,8 @@ extern int _binary_charmap_bmp;
void setup_terminal(void) {
klog_debug("setup the terminal...");
assert(charmap == NULL);
charmap = loadBMP_24b_1b(&_binary_charmap_bmp);

Loading…
Cancel
Save