diff --git a/hermit/arch/x86/kernel/processor.c b/hermit/arch/x86/kernel/processor.c index 0dd7500a5..609195bf2 100644 --- a/hermit/arch/x86/kernel/processor.c +++ b/hermit/arch/x86/kernel/processor.c @@ -35,7 +35,7 @@ extern void isrsyscall(void); cpu_info_t cpu_info = { 0, 0, 0, 0}; -static uint32_t cpu_freq = 0; +extern uint32_t cpu_freq; static void default_mb(void) { diff --git a/hermit/arch/x86/kernel/timer.c b/hermit/arch/x86/kernel/timer.c index 76c2fb9ae..250cff5ca 100644 --- a/hermit/arch/x86/kernel/timer.c +++ b/hermit/arch/x86/kernel/timer.c @@ -39,6 +39,7 @@ * has been running for */ static volatile uint64_t timer_ticks = 0; +extern uint32_t cpu_freq; uint64_t get_clock_tick(void) { @@ -54,6 +55,14 @@ static void timer_handler(struct state *s) { /* Increment our 'tick counter' */ timer_ticks++; + + /* + * Every TIMER_FREQ clocks (approximately 1 second), we will + * display a message on the screen + */ + if (timer_ticks % TIMER_FREQ == 0) { + kputs("One second has passed\n"); + } } #define LATCH(f) ((CLOCK_TICK_RATE + f/2) / f) @@ -74,6 +83,9 @@ int timer_init(void) irq_install_handler(32, timer_handler); irq_install_handler(123, timer_handler); + if (cpu_freq) // do we need to configure the timer? + return 0; + /* * Port 0x43 is for initializing the PIT: *